ArticleslgStudy

computer science

Actor-critic algorithm

Actor-critic algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Actor-critic algorithm rather than just read about it. In short: The actor-critic algorithm (AC) is a family of reinforcement learning (RL) algorithms that combine policy-based RL algorithms such as policy gradient methods, and value-based RL algorithms such as value iteration, Q-learning, SARSA, and TD learning. An AC algorithm consists of two main components: an "actor" that determines which actions to take according to a policy function, and a "critic" that evaluates those act…

Key takeaways

  • Actor-critic algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Actor-critic algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Actor-critic algorithm from memory before moving on to harder problems.

Reference excerpt

The actor-critic algorithm (AC) is a family of reinforcement learning (RL) algorithms that combine policy-based RL algorithms such as policy gradient methods, and value-based RL algorithms such as value iteration, Q-learning, SARSA, and TD learning. An AC algorithm consists of two main components: an "actor" that determines which actions to take according to a policy function, and a "critic" that evaluates those actions according to a value function. Some AC algorithms are on-policy, some are off-policy. Some apply to either continuous or discrete action spaces. Some work in both cases.

Overview The actor-critic methods can be understood as an improvement over pure policy gradient methods like REINFORCE via introducing a baseline.

Actor The actor uses a policy function π(a|s), while the critic estimates either the value function V(s), the action-value Q-function Q(s,a), the advantage function A(s,a), or any combination thereof. The actor is a parameterized function πθ, where θ are the parameters of the actor. The actor takes as argument the state of the environment s and produces a probability distribution πθ(⋅|s). If the action space is discrete, then ∑aπθ(a|s)=1. If the action space is continuous, then ∫aπθ(a|s)da=1. The goal of policy optimization is to improve the actor. That is, to find some θ that maximizes the expected episodic reward J(θ):J(θ)=𝔼πθ[∑t=0Tγtrt]where γ is the discount factor, rt is the reward at step t, and T is the time-horizon (which can be infinite). The goal of policy gradient method is to optimize J(θ) by gradient ascent on the policy gradient ∇J(θ). As detailed on the policy gradient method page, there are many unbiased estimators of the policy gradient:∇θJ(θ)=𝔼πθ[∑0≤j≤T∇θln⁡πθ(Aj|Sj)⋅Ψj|S0=s0]where Ψj is a linear sum of the following:

∑0≤i≤T(γiRi). γj∑j≤i≤T(γi−jRi): the REINFORCE algorithm. γj∑j≤i≤T(γi−jRi)−b(Sj): the REINFORCE with baseline algorithm. Here b is an arbitrary function. γj(Rj+γVπθ(Sj+1)−Vπθ(Sj)): TD(1) learning. γjQπθ(Sj,Aj). γjAπθ(Sj,Aj): Advantage Actor-Critic (A2C). γj(Rj+γRj+1+γ2Vπθ(Sj+2)−Vπθ(Sj)): TD(2) learning. γj(∑k=0n−1γkRj+k+γnVπθ(Sj+n)−Vπθ(Sj)): TD(n) learning. γj∑n=1∞λn−11−λ⋅(∑k=0n−1γkRj+k+γnVπθ(Sj+n)−Vπθ(Sj)): TD(λ) learning, also known as GAE (generalized advantage estimate). This is obtained by an exponentially decaying sum of the TD(n) learning terms.

Critic In the unbiased estimators given above, certain functions such as Vπθ,Qπθ,Aπθ appear. These are approximated by the critic. Since these functions all depend on the actor, the critic must learn alongside the actor. The critic is learned by value-based RL algorithms. For example, if the critic is estimating the state-value function Vπθ(s), then it can be learned by any value function approximation method. Let the critic be a function approximator Vϕ(s) with parameters ϕ. The simplest example is TD(1) learning, which trains the critic to minimize the TD(1) error:δi=Ri+γVϕ(Si+1)−Vϕ(Si)The critic parameters are updated by gradient descent on the squared TD error:ϕ←ϕ−α∇ϕ(δi)2=ϕ+αδi∇ϕVϕ(Si)where α is the learning rate. Note that the gradient is taken with respect to the ϕ in Vϕ(Si) only, since the ϕ in γVϕ(Si+1) constitutes a moving target, and the gradient is not taken with respect to that. This is a common source of error in implementations that use automatic differentiation, and requires "stopping the gradient" at that point. Similarly, if the critic is estimating the action-value function Qπθ, then it can be learned by Q-learning or SARSA. In SARSA, the critic maintains an estimate of the Q-function, parameterized by ϕ, denoted as Qϕ(s,a). The temporal difference error is then calculated as δi=Ri+γQθ(Si+1,Ai+1)−Qθ(Si,Ai). The critic is then updated byθ←θ+αδi∇θQθ(Si,Ai)The advantage critic can be trained by training both a Q-function Qϕ(s,a) and a state-value function Vϕ(s), then let Aϕ(s,a)=Qϕ(s,a)−Vϕ(s). Although, it is more common to train just a state-value function Vϕ(s), then estimate the advantage byAϕ(Si,Ai)≈∑j∈0:n−1γjRi+j+γnVϕ(Si+n)−Vϕ(Si)Here, n is a positive integer. The higher n is, the more lower is the bias in the advantage estimation, but at the price of higher variance. The Generalized Advantage Estimation (GAE) introduces a hyperparameter λ that smoothly interpolates between Monte Carlo returns (λ=1, high variance, no bias) and 1-step TD learning (λ=0, low variance, high bias). This hyperparameter can be adjusted to pick the optimal bias-variance trade-off in advantage estimation. It uses an exponentially decaying average of n-step returns with λ being the decay strength.

Variants Asynchronous Advantage Actor-Critic (A3C): Parallel and asynchronous version of A2C. Soft Actor-Critic (SAC): Incorporates entropy maximization for improved exploration. Deep Deterministic Policy Gradient (DDPG): Specialized for continuous action spaces.

See also Reinforcement learning Policy gradient method Deep reinforcement learning

References

Konda, Vijay R.; Tsitsiklis, John N. (January 2003). "On Actor-Critic Algorithms". SIAM Journal on Control and Optimization. 42 (4): 1143–1166. doi:10.1137/S0363012901385691. ISSN 0363-0129. Sutton, Richard S.; Barto, Andrew G. (2018). Reinforcement learning: an introduction. Adaptive computation and machine learning series (2 ed.). Cambridge, Massachusetts: The MIT Press. ISBN 978-0-262-03924-6. Bertsekas, Dimitri P. (2019). Reinforcement learning and optimal control (2 ed.). Belmont, Massachusetts: Athena Scientific. ISBN 978-1-886529-39-7. Grossi, Csaba (2010). Algorithms for Reinforcement Learning. Synthesis Lectures on Artificial Intelligence and Machine Learning (1 ed.). Cham: Springer International Publishing. ISBN 978-3-031-00423-0. Grondman, Ivo; Busoniu, Lucian; Lopes, Gabriel A. D.; Babuska, Robert (November 2012). "A Survey of Actor-Critic Reinforcement Learning: Standard and Natural Policy Gradients". IEEE Transactions on Systems, Man, and Cybernetics - Part C: Applications and Reviews. 42 (6): 1291–1307. Bibcode:2012ITHMS..42.1291G. doi:10.1109/TSMCC.2012.2218595. ISSN 1094-6977.

Worked examples

Example 1 — a first encounter with Actor-critic algorithm

Start with the simplest possible case. Write down what Actor-critic algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Actor-critic algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Actor-critic algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Actor-critic algorithm

In research
Actor-critic algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Actor-critic algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Actor-critic algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Artificial intelligence, Machine learning algorithms, Reinforcement learning, so understanding it makes those chapters shorter.
In everyday life
Look for Actor-critic algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Actor-critic algorithm” →

How to study Actor-critic algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Actor-critic algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Actor-critic algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Actor-critic algorithm in simple terms?

The actor-critic algorithm (AC) is a family of reinforcement learning (RL) algorithms that combine policy-based RL algorithms such as policy gradient methods, and value-based RL algorithms such as value iteration, Q-learning, SARSA, and TD learning. An AC algorithm consists of two main components…

Why does Actor-critic algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Actor-critic algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Actor-critic algorithm.

Tags

  • Artificial intelligence
  • Machine learning algorithms
  • Reinforcement learning

Keep exploring