Skip to content

Actor–critic methods and the advantage function

TL;DR. The advantage Aπ(s,a)=Qπ(s,a)−Vπ(s)A^\pi(s,a) = Q^\pi(s,a) - V^\pi(s) measures how much better action aa is than what the policy does on average in state ss. It is the ideal multiplier for ∇log⁡π\nabla \log \pi: positive means “do this more”, negative means “do this less”, and it averages to zero under the policy. An actor–critic method learns two things at once: the actor is the policy, and the critic is a value function used to estimate the advantage, most simply with the TD error δ\delta. The critic lowers variance. An inaccurate critic can bias bootstrapped advantages such as the TD error; used only as an action-independent baseline with full Monte Carlo returns, it changes variance, not the expected policy gradient.

Why it matters now. PPO for RLHF is an actor–critic: the critic is a value head trained alongside the policy. GRPO and RLOO remove the critic and replace it with a Monte Carlo average over samples. VAPO argues for bringing it back for long reasoning. Whether to keep a critic, and at what granularity (token, turn, episode), is one of the main design axes in LLM and agent RL.

The advantage. Spinning Up describes it as how much better a specific action is than picking an action at random according to π\pi, assuming you follow π\pi afterwards:

Aπ(s,a)=Qπ(s,a)−Vπ(s),∑aπ(a∣s) Aπ(s,a)=0.A^\pi(s,a) = Q^\pi(s,a) - V^\pi(s), \qquad \sum_a \pi(a \mid s)\, A^\pi(s,a) = 0 .

Plugging it into the policy-gradient theorem in place of QQ is allowed because Vπ(s)V^\pi(s) is an action-independent baseline (previous page), and it is a good choice because it centres the signal at zero in every state.

Estimating it. We never know QπQ^\pi or VπV^\pi exactly. Three estimators, from high variance to high bias:

Estimator of A(St,At)A(S_t, A_t)UsesBiasVariance
Gt−V(St)G_t - V(S_t) (Monte Carlo)all real rewards to the endonly via V(St)V(S_t), which as a baseline adds nonehigh
Rt+1+γRt+2+⋯+γnV(St+n)−V(St)R_{t+1} + \gamma R_{t+2} + \dots + \gamma^n V(S_{t+n}) - V(S_t) (nn-step)nn real rewards, then the criticmediummedium
δt=Rt+1+γV(St+1)−V(St)\delta_t = R_{t+1} + \gamma V(S_{t+1}) - V(S_t) (TD error)one real reward, then the critichigh if VV is wronglow

Why the TD error works: given ss and aa, the expected value of R+γVπ(S′)R + \gamma V^\pi(S') is Qπ(s,a)Q^\pi(s,a) by the Bellman equation, so E[δ∣s,a]=Qπ(s,a)−Vπ(s)=Aπ(s,a)\mathbb{E}[\delta \mid s, a] = Q^\pi(s,a) - V^\pi(s) = A^\pi(s,a). With an approximate VV, critic errors leak straight into the advantage. GAE (two pages on) is a principled blend of these rows.

One-step actor–critic (S&B Eqs. 13.12–13.14 and the box in §13.5). After every step, with a critic v^(s,w)\hat v(s, w):

δ=R+γ v^(S′,w)−v^(S,w),w←w+αw δ ∇wv^(S,w),θ←θ+αθ δ ∇θlog⁡πθ(A∣S).\delta = R + \gamma\, \hat v(S', w) - \hat v(S, w), \qquad w \leftarrow w + \alpha_w\, \delta\, \nabla_w \hat v(S, w), \qquad \theta \leftarrow \theta + \alpha_\theta\, \delta\, \nabla_\theta \log \pi_\theta(A \mid S).

The same δ trains both: the critic moves its prediction toward the TD target (semi-gradient TD(0)), and the actor moves toward actions that turned out better than the critic expected. (The book’s episodic version also multiplies the actor step by γt\gamma^t; most deep-RL code drops that factor.)

Training the critic. In deep RL the critic minimises a squared error to some target return: Monte Carlo returns, TD targets, or λ-returns (GAE paper, Eq. 28, regresses on discounted returns with a trust region on the value function). It is evaluated on the current policy’s data, so it must keep tracking as the actor changes. This is generalized policy iteration with two networks.

Variants you will meet. A2C and A3C (Mnih et al. 2016, “Asynchronous Methods for Deep Reinforcement Learning”) run many actors in parallel and use nn-step advantages; asynchronous advantage actor–critic was the strongest of the asynchronous methods that paper tested. TRPO and PPO are actor–critic methods with a constrained or clipped actor update.

The actor–critic loop The actor, the policy, sends an action to the environment. The environment returns a reward and next state to the critic, a value function. The critic computes the TD error delta equals r plus gamma V of s prime minus V of s, uses it to update itself toward the TD target, and sends it to the actor, which raises the log probability of the action if delta is positive. In the toy example an exact critic gives delta plus 0.16 for searching, while a poor critic gives minus 0.05 and pushes the wrong way. Actor π_θ(a | s) the policy (LLM / agent) Environment verifier, search engine Critic V_w(s) value head action a r, s′ δ = r + γ·V(s′) − V(s) ≈ advantage A(s, a) actor: θ += α·δ·∇ log π(a | s) critic: move V(s) toward r + γ·V(s′) Toy, search then correct: exact critic δ₀ = +0.16 (search ↑); poor critic δ₀ = −0.05 (search ↓)
Original sketch. The actor–critic loop: the actor acts, the environment returns a reward and next state, the critic turns them into a TD error, and that one number updates both networks.

Search-or-answer MDP, γ = 0.9, policy π₀ (search with probability 0.5 in Q, always answer in E). From the Bellman page: q(Q,search)=0.62q(Q,\text{search}) = 0.62, q(Q,answer)=0.30q(Q,\text{answer}) = 0.30, v(Q)=0.46v(Q) = 0.46, q(E,answer)=v(E)=0.8q(E,\text{answer}) = v(E) = 0.8, q(E,search)=0.62q(E,\text{search}) = 0.62.

StateActionQπQ^\piVπV^\piAπ=Q−VA^\pi = Q - V
Qsearch0.620.46+0.16
Qanswer0.300.46−0.16
Eanswer0.800.800
Esearch0.620.80−0.18

In Q the advantages average to zero under π₀ (0.5 × 0.16 − 0.5 × 0.16). In E the policy never searches, so the advantage of the action it takes is 0, and the advantage of searching tells you that a second search would be a mistake.

One step of actor–critic on “search, then correct” (rewards −0.1, then 1):

  • Exact critic V(Q)=0.46V(Q) = 0.46, V(E)=0.8V(E) = 0.8: δ0=−0.1+0.9×0.8−0.46=+0.16\delta_0 = -0.1 + 0.9 \times 0.8 - 0.46 = +0.16, δ1=1−0.8=+0.2\delta_1 = 1 - 0.8 = +0.2. The actor increases π(search | Q). On average over outcomes in E, δ0\delta_0 would be exactly A(Q,search)=0.16A(Q, \text{search}) = 0.16.
  • Poor critic V(Q)=0.4V(Q) = 0.4, V(E)=0.5V(E) = 0.5: δ0=−0.1+0.45−0.4=−0.05\delta_0 = -0.1 + 0.45 - 0.4 = -0.05 and δ1=+0.5\delta_1 = +0.5. A successful search now makes the actor search less, because the critic thinks E is worth only 0.5. Meanwhile the critic’s own update, driven by δ1=+0.5\delta_1 = +0.5, raises V(E)V(E), and once it is accurate the sign corrects itself. This is why it can pay to train the critic for a while before trusting its advantages, and why the GAE page uses longer returns to dilute critic errors.

LLM token generation. The critic is a value head that reads a prefix and predicts the final reward, usually a scalar head on a copy of the policy or reward model. With a terminal-only reward and γ = 1, the per-token TD error is δt=V(prefixt+1)−V(prefixt)\delta_t = V(\text{prefix}_{t+1}) - V(\text{prefix}_t), plus the final reward on the last token and, in RLHF, a per-token KL penalty to the reference model. A token whose generation raised the predicted chance of success gets positive advantage. GRPO and RLOO skip the critic: their advantage is the completion’s reward minus a group mean for the same prompt. RLOO uses the mean of the other samples, which is independent of the scored sample; GRPO uses the inclusive group mean, which is not, and also divides by the standard deviation. Either is a Monte Carlo estimate of AA that is constant across the completion’s tokens.

A search agent. A natural critic predicts “probability of finishing with a correct answer from this transcript”. Then δ\delta at a tool call says whether the returned documents made success more or less likely than expected, a per-query credit signal an IR researcher can inspect directly. The critic’s input includes retrieved text it did not choose, so it also measures retrieval quality; changing the retriever changes VV.

  • S&B §13.4–13.5: adding a learned state-value baseline can make REINFORCE learn much faster (Figure 13.2, short-corridor gridworld), and one-step actor–critic replaces the full return with the one-step bootstrapped return, making the method fully online.
  • Sutton et al. 1999 argued that learning a value function to reduce gradient variance appears essential for rapid learning (see the REINFORCE page).
  • VAPO (2504.05118): a value-based PPO variant for long chain-of-thought reports 60.4 on AIME 2024 from a Qwen 32B base. It names value-model bias, heterogeneous sequence lengths and sparse reward as the challenges a critic faces in this setting.
  • Critic accuracy on long contexts. Predicting final success from a partial 10k-token reasoning trace or a long agent transcript is hard; a biased critic misdirects the actor.
  • Memory and compute. A separate value model of comparable size to the policy adds substantial memory and compute; the GRPO paper gives this burden as a reason to drop it.
  • Granularity. Token-level values for LLMs, turn-level values for agents, or both (hierarchical, as in ArCHer): there is no settled answer.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    In the search-or-answer MDP under π₀ (γ = 0.9), compute A(Q, search), A(Q, answer), A(E, search) and A(E, answer), and check that the advantage averages to zero under the policy in each state. Then compute the one-step actor–critic TD errors on the trajectory "search, then correct" with the exact critic (V(Q) = 0.46, V(E) = 0.8) and with a poor critic (V(Q) = 0.4, V(E) = 0.5). Which way does each push π(search | Q)?

    What a strong answer covers
    • A(Q, search) = 0.62 − 0.46 = +0.16, A(Q, answer) = 0.30 − 0.46 = −0.16; 0.5·0.16 + 0.5·(−0.16) = 0. In E, π₀ always answers, so A(E, answer) = 0 and A(E, search) = 0.62 − 0.8 = −0.18.
    • Exact critic: δ₀ = −0.1 + 0.9·0.8 − 0.46 = +0.16, δ₁ = 1 − 0.8 = +0.2. The actor raises π(search | Q).
    • Poor critic: δ₀ = −0.1 + 0.9·0.5 − 0.4 = −0.05, δ₁ = 1 − 0.5 = +0.5. The actor lowers π(search | Q) after a successful search, because the critic undervalues E.
    • The critic's error, not the data, flipped the sign. The critic must be trained (here δ₁ = 0.5 would pull V(E) up) before its δ can be trusted.
  2. Mechanism

    Show in words why the TD error δ = r + γV(s′) − V(s) is an unbiased estimate of the advantage A(s, a) when V is the true value function of the current policy, and explain what goes wrong when V is only approximate.

    What a strong answer covers
    • Given s and a, the expected value of r + γV^π(s′) is exactly Q^π(s, a), by the Bellman equation for action values.
    • Subtracting V^π(s), which does not depend on a, gives E[δ | s, a] = Q^π(s, a) − V^π(s) = A^π(s, a).
    • With an approximate V, the expected δ equals A plus the error γ·(V − V^π)(s′) − (V − V^π)(s), so the policy is pushed by critic errors (bias), as in the poor-critic example.
    • Longer returns (n-step, GAE with larger λ) rely less on V and more on real rewards, trading this bias for variance.
  3. What if…

    Compare three ways to get the scalar that multiplies ∇ log π for an LLM trained with a verifier reward: (a) a learned value head with GAE (PPO style), (b) the mean reward of a group of samples for the same prompt (GRPO / RLOO style), (c) no baseline. What does each cost, where does each put credit within a completion, and when would you expect (a) to beat (b)?

    What a strong answer covers
    • (c) Unbiased but highest variance; every token gets the raw reward.
    • (b) A Monte Carlo estimate of V(prompt). No extra network, but several samples per prompt; every token in a completion still gets the same scalar.
    • (a) A second network (or head) to train and store; its errors bias the advantage, but it can give different tokens or turns different advantages.
    • (a) should help most when completions are long and credit assignment inside them matters, and when the critic is accurate; VAPO argues this for long chain-of-thought and lists value-model bias, heterogeneous lengths and sparse reward as the obstacles.
  4. Design

    Design the critic for an RL-trained search agent that makes up to 10 tool calls per question. Decide whether the critic predicts value per token or per turn, what its input and training target are, how it is initialised, and how you would check that its advantages are trustworthy before using them to update the policy.

    What a strong answer covers
    • Per turn (after each tool result) is natural: decisions happen at query and answer boundaries, and tool-output tokens are not actions. Per-token values inside a query add little.
    • Input: question plus transcript so far. Target: λ-returns or Monte Carlo returns of final correctness minus tool cost, computed from current-policy rollouts.
    • Initialise from the policy model or a reward model with a scalar head, and pre-train the critic on rollouts before using its advantages (a poor critic can flip signs, as in the toy example).
    • Checks: calibration of V against observed success at each turn on held-out rollouts; explained variance of returns; and whether advantages agree in sign with Monte Carlo estimates from extra rollouts on a sample of turns.
  5. Critique

    A paper claims that dropping the critic (as GRPO does) is "free" because the group mean is an unbiased baseline. What does this claim get right, and what does it miss for multi-turn search agents?

    What a strong answer covers
    • Right only for the leave-one-out version: RLOO's baseline (the mean of the other samples) does not depend on the scored sample, so subtracting it keeps the policy gradient unbiased, and it avoids training a second network. GRPO's inclusive group mean contains the scored sample's own reward; in plain REINFORCE it scales the expected gradient by (G−1)/G, which RLOO's G/(G−1) factor corrects.
    • Missed: it is a baseline for the prompt only, so every turn in an episode gets the same advantage; the agent cannot learn which query helped.
    • Missed: it needs several full rollouts per question, which is expensive when each rollout makes many tool calls.
    • Missed: GRPO's division by the group standard deviation changes how prompts are weighted, which is not part of the unbiasedness argument.