Skip to main content
REINFORCE weights the score of each action by the return GtG_t that followed it. The return is an unbiased estimate of qπ(St,At)q_\pi(S_t, A_t), but it sums every reward until the end of the episode, so its variance is large. Subtracting a learned baseline v^(St;w)\hat v(S_t; \mathbf w) reduces the variance without adding bias. Even then, every update waits for the end of the episode, because GtG_t is not known until then. An actor-critic method goes one step further. It replaces the return by a target that bootstraps from the learned value function, as TD prediction does. The policy π(a∣s,θ)\pi(a \mid s, \boldsymbol\theta) is the actor, and the value function v^(s;w)\hat v(s; \mathbf w) is the critic. What makes a method actor-critic is that the critic’s estimate enters the target, not only the baseline (Sutton & Barto, 2018).

The advantage

The policy gradient theorem weights each action by qπ(s,a)q_\pi(s, a). Any baseline that depends only on the state can be subtracted, and the natural choice is the state value. The difference aπ(s,a)=qπ(s,a)−vπ(s)a_\pi(s, a) = q_\pi(s, a) - v_\pi(s) is the advantage of action aa in state ss: how much better it is than the average action under π\pi. With it, the gradient reads ∇θJ(θ)∝Eπ[aπ(St,At) ∇θlog⁡π(At∣St,θ)].\nabla_{\boldsymbol\theta} J(\boldsymbol\theta) \propto \mathbb E_\pi [ a_\pi(S_t, A_t)\, \nabla_{\boldsymbol\theta} \log \pi(A_t \mid S_t, \boldsymbol\theta) ]. An action with positive advantage becomes more likely and one with negative advantage less likely. In a state where all actions are equally good, every advantage is zero and the policy does not move there. The two-state example on the PPO minimal page shows what goes wrong without this: with the trajectory reward as the weight, an action that has no effect on the reward still collapses onto one choice. The advantage is not observed, so it has to be estimated. The TD error of the true value function does this without a model: δt=Rt+1+γ vπ(St+1)−vπ(St),Eπ[δt∣St=s,At=a]=qπ(s,a)−vπ(s)=aπ(s,a).\begin{aligned} \delta_t &= R_{t+1} + \gamma\, v_\pi(S_{t+1}) - v_\pi(S_t), \\ \mathbb E_\pi[ \delta_t \mid S_t = s, A_t = a ] &= q_\pi(s, a) - v_\pi(s) = a_\pi(s, a). \end{aligned} The identity follows from the definition of qπq_\pi: given StS_t and AtA_t, the expected value of Rt+1+γvπ(St+1)R_{t+1} + \gamma v_\pi(S_{t+1}) is qπ(St,At)q_\pi(S_t, A_t). With the critic v^\hat v in place of vπv_\pi, the TD error is a biased estimate of the advantage, and the bias shrinks as the critic improves.

One-step actor-critic

One-step actor-critic updates both parameter vectors after every transition, using the same TD error for both:
The critic is TD(0) prediction for the current policy, written for a function approximator. The actor step is the REINFORCE update with δ\delta in place of Gt−v^(St)G_t - \hat v(S_t). The factor I=γtI = \gamma^t makes the update follow the gradient of the discounted objective from the start state; most implementations drop it. Compared with REINFORCE, the update is online and incremental: the agent learns during the episode and does not need episodes at all, so the method also works on continuing tasks. The price is bias. Early in training the critic is wrong, and its errors enter the actor’s update through δ\delta. This is the same bias-variance trade-off as between TD and Monte Carlo prediction, now applied to the policy gradient.

Generalized advantage estimation

The one-step TD error and the Monte Carlo advantage Gt−v^(St)G_t - \hat v(S_t) are the two ends of a family. Summing discounted TD errors over several steps gives an nn-step estimate, and an exponentially weighted average over all nn gives generalized advantage estimation (GAE), introduced by Schulman et al. (2016): A^tGAE(γ,λ)=∑l=0∞(γλ)l δt+l,δt+l=Rt+l+1+γ v^(St+l+1)−v^(St+l).\begin{aligned} \hat A_t^{\text{GAE}(\gamma, \lambda)} &= \sum_{l=0}^{\infty} (\gamma\lambda)^l\, \delta_{t+l}, \\ \delta_{t+l} &= R_{t+l+1} + \gamma\, \hat v(S_{t+l+1}) - \hat v(S_{t+l}). \end{aligned} With λ=0\lambda = 0 the estimate is the one-step TD error δt\delta_t: low variance, biased by the critic. With λ=1\lambda = 1 the sum telescopes to Gt−v^(St)G_t - \hat v(S_t): unbiased, high variance. Values such as λ=0.95\lambda = 0.95 sit in between. This is the same interpolation as the λ\lambda-return of n-step TD, applied to advantages. In practice the sum runs to the end of a rollout of fixed length and is computed backward in one pass. PPO uses GAE for its advantages.

Continuous actions

A softmax over action preferences covers discrete actions. For a continuous action, such as a turn rate, the policy can be a Gaussian whose mean and standard deviation are functions of the state: π(a∣s,θ)=1σ(s,θ)2πexp⁡(−(a−μ(s,θ))22σ(s,θ)2).\pi(a \mid s, \boldsymbol\theta) = \frac{1}{\sigma(s, \boldsymbol\theta)\sqrt{2\pi}} \exp\left( -\frac{\big(a - \mu(s, \boldsymbol\theta)\big)^2}{2\sigma(s, \boldsymbol\theta)^2} \right). Its score for the mean is ∂log⁡π(a∣s,θ)∂μ=a−μ(s,θ)σ(s,θ)2,\frac{\partial \log \pi(a \mid s, \boldsymbol\theta)}{\partial \mu} = \frac{a - \mu(s, \boldsymbol\theta)}{\sigma(s, \boldsymbol\theta)^2}, so an action above the mean with a positive advantage pulls the mean up, and one with a negative advantage pushes it down. The standard deviation sets how widely the policy explores, and it is learned too, usually through log⁡σ\log \sigma to keep it positive. Everything else in actor-critic stays the same. The DDPG and TD3 navigation sections take a different route for continuous actions: a deterministic actor μθ(s)\mu_{\boldsymbol\theta}(s) and a critic for action values q^(s,a)\hat q(s, a), trained off-policy with the replay buffer and target networks of DQN.

From actor-critic to modern methods

Most deep RL policy-gradient methods are actor-critic methods with a neural network for each part, or one network with two heads. A2C and A3C (Mnih et al., 2016) collect short rollouts from several copies of the environment and update with nn-step advantages. PPO adds the clipped probability ratio, so that the same rollout can be reused for several gradient steps without moving the policy too far. GRPO drops the critic altogether and replaces its baseline with the mean reward of a group of samples, which suits language models whose reward arrives only at the end of a long sequence. Key references: (Sutton & Barto, 2018; Mnih et al., 2016); Schulman et al. (2016), High-dimensional continuous control using generalized advantage estimation.

References

  • Mnih, V., Badia, A., Mirza, M., Graves, A., Lillicrap, T., et al. (2016). Asynchronous Methods for Deep Reinforcement Learning. arXiv [cs.LG]. Link
  • Sutton, R., Barto, A. (2018). Reinforcement Learning: An Introduction. Link

Found an error on this page? Report an issue.