An actor critic algorithm trains two things at once. The actor is the policy, which decides what to do. The critic is a learned value function, which measures how good the action taken was. The critic’s judgement, expressed as an advantage, scales the actor’s gradient in place of the raw return, giving a much lower-variance gradient. Advantage actor-critic (A2C), a synchronous variant of A3C, is one practical form of this idea. Several copies of the environment run in parallel, the actor and critic share one network, and the advantage is estimated from n-step returns.
If the basic loop of an agent acting, receiving rewards and adjusting is new to you, start with our introduction to how agents learn through trial and error in reinforcement learning. This article assumes you already know that loop.
How the actor critic algorithm splits the work
Konda and Tsitsiklis (1999) described actor-critic methods as combining the strong points of actor-only methods (pure policy search) and critic-only methods (pure value learning). In their framing, the critic learns a value function and the actor uses it to move its policy parameters towards better performance.
In deep RL the actor is a network that maps a state to a probability distribution over actions. For discrete actions that is a softmax. For continuous control it is the mean and variance of a Gaussian. In A2C the critic is a state-value function V(s), the expected return from state s if the agent keeps following the current policy. Some actor-critic variants learn an action-value function Q(s, a) instead.
An Invitation to Deep Reinforcement Learning (2023) notes that in the actor-critic approach the Q-function critic is used only during training and discarded at inference time, which matters for on-device inference deployment.
Why a critic reduces the variance REINFORCE suffers from
REINFORCE, the plain policy-gradient method, increases the log-probability of each action in proportion to the return that followed it. The estimate is unbiased, but it is noisy. Returns from the same starting state can vary a great deal between episodes, because both the environment and the policy are stochastic. The OpenAI Spinning Up guide (part of its policy optimisation introduction) frames the practical cost as the number of sample trajectories you need before the gradient estimate becomes usable.
The standard fix is to subtract a baseline. Any function of the state alone can be subtracted from the return without changing the expected gradient, because the policy is a probability distribution. The usual choice of baseline is the value function V(s), which can greatly reduce variance. Once you subtract V(s) from the return, what remains estimates the advantage, and the learned baseline is the critic. Mnih et al. (2016) say this directly: the policy is the actor and the baseline is the critic.
There is a cost, and it is easy to overlook. An exact V(s), being a state-only baseline, adds no bias. A learned V(s) used to estimate the advantage introduces some bias. The Definitive Guide to Policy Gradients (2024) states the trade clearly: REINFORCE is unbiased but high-variance, the other algorithms reduce variance by learning V, and bias, unlike variance, does not go away even with infinite samples. Schulman et al.’s GAE paper describes the same exchange: value functions substantially reduce policy-gradient variance at the cost of some bias.
Actor-critic swaps REINFORCE’s unbiased but noisy gradient for a lower-variance gradient with some bias. Policy and value updates are tightly coupled, so if the critic’s value estimates are inaccurate, the policy degrades with them.
The advantage function and how A2C estimates it
The advantage of an action is A(s, a) = Q(s, a) − V(s). It measures how much better or worse action a is in state s than the policy’s average behaviour there. A positive advantage means making that action more likely improves the policy. Weighting gradients by advantage also means an action is credited only for its own contribution, not for everything that happened later in the episode.
The true advantage is unknown, so A2C estimates it from the critic’s value function alone. The A3C paper (Mnih et al., 2016) gives the n-step form:
A(s_t, a_t) ≈ r_t + γ r_{t+1} + … + γ^(k−1) r_{t+k−1} + γ^k V(s_{t+k}) − V(s_t)
Here k is at most t_max, the rollout length, and can vary from state to state. The first part is the observed discounted reward over k steps. The γ^k V(s_{t+k}) term bootstraps the rest of the return from the critic, and subtracting V(s_t) makes the result relative to what the critic expected.
Set k = 1 and the formula becomes r_t + γ V(s_{t+1}) − V(s_t). That is the temporal-difference (TD) error δ, with V of a terminal state taken as zero. This is why the TD error is often described as a good estimator of the advantage: it is the one-step special case, and it needs only one value network rather than separate Q and V estimators.
Generalized Advantage Estimation (GAE) replaces the single n-step choice with an exponentially weighted mix of all of them, controlled by λ, much as TD(λ) does for value learning. The A3C authors flagged GAE as a likely improvement to their own advantage estimate.
What A2C changes compared with A3C
A3C (asynchronous advantage actor-critic) ran several actor-learners in parallel threads. Each actor explored with its own policy, which decreases the correlation of their sampled data. Mnih et al. used this parallelism in place of the experience replay buffer DQN relies on. Removing replay mattered because replay requires off-policy learning, while actor-critic is on-policy. The A3C paper reports that the method beat the then state of the art on the average score over 57 Atari games, in half the training time, using 16 CPU cores and no GPU.
A2C keeps the parallel actors and drops the asynchrony. In A3C, workers update the global parameters independently, so a worker can be acting on a stale version of the policy. In A2C a coordinator waits for every actor to finish its segment, applies one update, and starts all actors from the same policy for the next round. OpenAI described A2C as a synchronous, deterministic variant of A3C that, in its experience, gives equal performance. The Stable Baselines3 documentation describes it the same way, and adds that it uses multiple workers to avoid a replay buffer.
A3C, which A2C inherits from, shares most of the network between actor and critic. Mnih et al. used a convolutional network with one softmax output for the policy and one linear output for the value, with all non-output layers shared.
Training the actor and critic: what each network learns from
Each update, A2C collects a fixed number of steps from every parallel environment, computes advantages for that batch, and takes a gradient step. The batch size is the number of steps per environment multiplied by the number of environments. Each part of the network then learns from its own term.
| Component | What it learns from | Form |
|---|---|---|
| Actor (policy head) | Policy gradient weighted by the estimated advantage | ∇ log π(a_t | s_t) · Â_t |
| Entropy bonus (actor) | Reward for keeping the action distribution spread out | + β · ∇H(π(· | s_t)), with β a hyperparameter |
| Critic (value head) | Mean squared error between V(s_t) and the n-step return target | (Σ γ^i r_{t+i} + γ^k V(s_{t+k}) − V(s_t))² |
| Shared backbone | A weighted sum of all three terms | L = L_policy + c₁ L_value + c₂ L_entropy (signs per convention) |
The critic’s regression target is the same n-step return that appears in the advantage. Spinning Up notes that mean-squared-error value fitting is the simplest method and the one used by most policy-optimisation implementations, A2C among them. The critic is updated alongside the policy, so it always approximates the value of the most recent policy. With a shared backbone, the combined loss trains actor and critic features together. Because of that, the value coefficient decides how much the critic’s error is allowed to reshape the features the actor uses.
The entropy bonus is not optional in A2C
The entropy term is easy to treat as a minor detail. Mnih et al. found that adding policy entropy to the objective improved exploration by discouraging early convergence to suboptimal deterministic policies. In the controlled comparison in the Definitive Guide to Policy Gradients (2024), A2C was the only algorithm that needed an entropy bonus, because its learned policies collapsed without one. PPO, TRPO and V-MPO avoided collapse through their constraints on the divergence between successive policies.
Hyperparameters worth tuning first
| Parameter | What it controls | Reference point from the sources |
|---|---|---|
Rollout length (n_steps, t_max) |
k in the n-step return, and batch size per environment | The A3C experiments updated every 5 actions |
| Number of parallel environments | Decorrelation of data, batch size, wall-clock speed | Batch is n_steps × n_envs |
Entropy coefficient (β, ent_coef) |
Exploration pressure, protection against collapse | A3C used β = 0.01 on Atari and TORCS |
Value coefficient (c₁, vf_coef) |
Weight of the critic loss on the shared backbone | A tunable weight in the joint loss |
GAE λ (gae_lambda) |
Bias against variance in the advantage estimate | λ = 1 is equivalent to the classic advantage |
| Discount γ | Weight on future rewards in the return | Appears in every return and TD target |
If you are building this in code rather than reading about it, our tutorial on reinforcement learning in Python for latency-aware inference control walks through a working loop.
Actor-critic or DQN: which should you use?
A central difference is on-policy against off-policy learning. DQN learns an action-value function from a replay buffer, so its updates can use data collected by older versions of the policy. A2C uses only data from the current policy and discards it after each update. The DQN paper (Mnih et al., Nature 2015) showed that a deep Q-network could learn successful policies end to end from high-dimensional sensory inputs on Atari games.
Spinning Up summarises the resulting trade-off. Policy optimisation methods optimise directly for what you want, which tends to make them stable and reliable. Q-learning methods are substantially more sample efficient when they work, because they reuse data more effectively. Li (2017) makes the same contrast: Q-learning is sample efficient, policy gradient is stable. Action spaces matter as well. DQN supports only discrete actions, while A3C extends easily to continuous actions through a Gaussian policy head.
| Your situation | Lean towards | Why |
|---|---|---|
| Environment steps are expensive (real hardware, slow simulator) | DQN or an off-policy actor-critic such as SAC | Replay reuses data, which gives better sample efficiency |
| Simulation is cheap and parallelisable, discrete actions | A2C or PPO | Wall-clock time benefits from vectorised workers |
| Continuous actions | SAC or TD3 rather than DQN | DQN is limited to discrete actions |
| Stability matters more than data efficiency | A policy-optimisation method | Direct optimisation tends to be more stable |
The Stable Baselines3 guide puts the speed side bluntly: DQN is usually slower in wall-clock time but the most sample efficient, because of its replay buffer. One more check is worth making. If the problem is to pick the best option for a given context and there is no long-horizon state, compare it against a contextual bandit before choosing either family.
How PPO and Soft Actor-Critic build on the actor critic algorithm
PPO: the same actor-critic, with a limit on step size
PPO keeps A2C’s structure: an advantage-weighted policy gradient, an MSE value loss, an entropy bonus and multiple actors. With a shared backbone it minimises the same kind of joint loss of policy, value and entropy terms. What it adds is a constraint on policy change; in the Definitive Guide to Policy Gradients comparison, such constraints avoided collapse even without an entropy bonus. Large policy changes can wreck training, and small step sizes do not fully solve that.
PPO computes the ratio r(θ) between the new policy’s probability of an action and the old policy’s, clips it to [1 − ε, 1 + ε], and takes the minimum of the clipped and unclipped advantage-weighted terms. Once an update has moved the policy outside the clip range, the objective gives no further incentive to keep moving it. With their new objective, Schulman et al. (2017) could run multiple epochs of minibatch updates on each batch, where standard policy gradients perform one gradient update per data sample. They report that PPO is much simpler to implement than TRPO. PPO normally estimates advantages with GAE.
The two algorithms are closer than they look. Huang et al. (2022) show that A2C is a special case of PPO, even though the common understanding treats them as separate algorithms.
SAC: actor-critic made off-policy
Soft Actor-Critic goes in the other direction. It takes the actor-critic structure off-policy so it can reuse a replay buffer. Haarnoja et al. (2018) build it on maximum-entropy RL, in which the actor maximises expected reward and policy entropy together, so it succeeds at the task while acting as randomly as possible. The entropy is part of the objective itself, not a bonus added on top, and the coefficient on it directly controls the explore-exploit balance.
To keep off-policy value learning stable, SAC trains two Q-functions to counter maximisation bias and uses target networks for the TD targets. It is designed for continuous control with a Gaussian policy. Haarnoja et al. report state-of-the-art results on a range of continuous control benchmarks and, unlike other off-policy algorithms, very similar performance across random seeds.
| A2C | PPO | SAC | |
|---|---|---|---|
| Data | On-policy, parallel workers | On-policy, multiple epochs per batch | Off-policy, replay buffer |
| Critic | V(s), MSE on n-step return | V(s), MSE on λ-return | Two Q-functions plus target networks |
| Stability mechanism | Entropy bonus | Clipped probability ratio | Maximum-entropy objective, twin Q |
| Action spaces | Discrete and continuous (shown for A3C) | Discrete and continuous (Gaussian policy) | Continuous |
Running one of these algorithms inside a product raises a separate set of problems. We cover where those bite in reinforcement learning use cases in production. Those operational issues, tracked through drift telemetry, decide whether what was learned still holds a month later.
FAQ
What is the A3C algorithm?
Parallel actor-learners update a shared policy and value network asynchronously, and their varied exploration does the stabilising job that experience replay does in DQN. A2C is its synchronous counterpart.
What is the difference between SARSA and Q-learning?
SARSA is an on-policy method: the policy it learns about is the one generating its data. Q-learning is off-policy: its Bellman target uses the maximum over next actions, which removes any dependence on the policy that collected the data.
What does the Q-value represent in reinforcement learning?
Q(s, a) is the expected return from taking action a in state s and then following the policy. Unlike V(s), the first action is given as an input instead of being chosen by the policy.