Advantage actor-critic

Also known as: A2C

On this page 7

Advantage actor-critic (A2C) is a policy gradient algorithm in reinforcement learning that trains two components together: an actor, which outputs a policy over actions, and a critic, which estimates the state value function. The actor is updated in the direction of the advantage, the amount by which an action turned out better or worse than the critic expected, which gives far lower-variance gradients than plain REINFORCE.

A2C is the synchronous, deterministic variant of A3C. Instead of many asynchronous workers updating shared parameters, it collects experience from several parallel environments, waits for all of them and performs one batched update. This design uses GPUs efficiently and makes results easier to reproduce, and it serves as a common baseline in deep reinforcement learning.

How advantage actor-critic learns

Each A2C iteration follows a fixed cycle of rollout, estimation and update. The agent runs its current stochastic policy in N parallel environments for a short horizon, typically 5 to 128 steps, and stores states, actions, rewards and termination flags.

  1. Rollout: every environment advances n steps under the current policy.
  2. Bootstrapped returns: for each step, the n-step return sums discounted rewards and adds the critic value of the last state, discounted by the factor gamma raised to the remaining steps.
  3. Advantage estimate: the critic value of the current state is subtracted from that return.
  4. Joint update: one gradient step combines the actor loss, the critic loss and an entropy bonus.

The actor loss is the negative log-probability of each taken action multiplied by its advantage, so actions with positive advantage become more likely. The critic loss is the squared error between predicted values and the bootstrapped returns. The entropy bonus rewards spreading probability across actions and prevents the policy from collapsing too early onto one choice.

Why the advantage reduces variance

The advantage acts as a baseline-corrected learning signal. In REINFORCE, every action in a high-return episode is reinforced, even poor ones, because the full return is noisy. Subtracting the state value removes the part of the return that the state itself explains, leaving the credit attributable to the action.

Because the baseline depends only on the state, it does not bias the gradient in expectation, yet it sharply reduces variance. Bootstrapping from the critic reduces variance further but introduces bias when the critic is inaccurate, which creates the central bias-variance trade-off controlled by the rollout length n.

Rollout lengthBiasVarianceTypical use
1 stepHigh, relies on criticLowRarely used alone
5 stepsModerateModerateOriginal Atari configurations
32 to 128 stepsLowHigherContinuous control and long horizons
Full episodeNone from bootstrappingHighestEquivalent to REINFORCE with a baseline
Effect of the rollout length on the advantage estimate

Many implementations replace the plain n-step advantage with generalized advantage estimation (GAE), which blends returns of all lengths through a parameter lambda, usually set between 0.9 and 0.99.

Key hyperparameters of A2C

A2C has few hyperparameters, but each has a strong effect on stability. The values below are common starting points, not universal settings.

HyperparameterTypical rangeWhat it controls
Number of environments8 to 64Batch size and decorrelation of samples
Rollout length n5 to 128Bias-variance balance of advantages
Discount factor gamma0.95 to 0.99Effective planning horizon
Learning rate0.0001 to 0.0007Step size of the shared optimizer
Value loss coefficient0.25 to 0.5Weight of critic training
Entropy coefficient0.0 to 0.01Amount of exploration
Gradient norm clip0.5Protection against exploding updates
Common A2C hyperparameters

Actor and critic often share a network trunk with two output heads. Sharing saves computation and helps feature learning on images, but it couples the two losses, so the value loss coefficient must be tuned to keep the critic from dominating the gradient.

A2C occupies a middle position among on-policy policy gradient methods: simpler than trust-region approaches, more stable than pure Monte Carlo methods. The comparison shows how it differs from its closest neighbors.

AlgorithmLearning signalData reuseMain difference from A2C
REINFORCEFull Monte Carlo returnOne update per episodeNo critic, much higher variance
A3Cn-step advantageOne update per rolloutAsynchronous workers, less reproducible
A2Cn-step or GAE advantageOne update per rolloutReference point
PPOGAE advantage with clipped ratioSeveral epochs per batchBetter sample efficiency and stability
Soft actor-criticQ-values with entropy termReplay buffer, off-policyFar more sample-efficient in continuous control
A2C and neighboring methods

In practice, proximal policy optimization has largely replaced A2C for demanding tasks, because PPO safely reuses each batch several times. A2C remains valuable as a clear teaching example and a fast, low-overhead baseline when environment steps are cheap.

Common failure modes and how to fix them

Because A2C is strictly on-policy, it discards each batch after one update and is sensitive to scaling issues. The following problems appear most often in practice.

  • Entropy collapse: the policy becomes deterministic early and stops exploring; raise the entropy coefficient or lower the learning rate.
  • Inaccurate critic: biased advantages push the actor in wrong directions; increase the value loss weight or use separate networks.
  • Unscaled rewards: very large rewards destabilize value targets; apply reward normalization or clipping.
  • Mishandled episode ends: bootstrapping across a terminal state corrupts returns; mask the value at true terminations but not at time-limit truncations.
  • Poor sample efficiency: millions of steps may be needed; consider PPO or an off-policy method when simulation is expensive.

The idea in brief

Picture a player and a coach. The player chooses moves. The coach watches and predicts how well things should go from each position. After each short stretch of play, they compare the result with the prediction.

If a move went better than the coach expected, the player does it more often. If it went worse, the player does it less. The coach also improves its predictions. Several games run side by side, and both learn from all of them at once. That better-than-expected signal is the advantage, and it makes learning steadier than judging moves by the final score alone.

A practical scenario

A robotics team wants a simulated two-wheeled robot to balance and drive to a target. Simulation is cheap, so they choose A2C as a first baseline before trying heavier methods. They run 16 parallel simulator instances, use rollouts of 20 steps, gamma of 0.99, GAE with lambda of 0.95 and an entropy coefficient of 0.01.

The first runs fail: the robot learns to stand still because large crash penalties dominate the value targets. After adding reward normalization and correctly masking values at falls, the policy steadily improves and reaches the target in most test episodes after about 10 million simulator steps. The team then trains PPO with the same network and finds it needs fewer environment steps, but the A2C baseline confirmed that the reward design and observation space were sound.