A single-turn problem asks the model for one response and scores it.
An agent works over many turns: it acts, the world answers, it acts again, and the reward may arrive only at the end. Three things change. The gradient must be derived for a process in which part of the context is written by the environment. The credit for a final outcome must be spread over many decisions, at the granularity of the turn or of the token. And the variance of the gradient estimate grows with the number of decisions, so a method that works at six turns may fail at sixty. this article proves the multi-turn policy gradient and shows that observations contribute no score term, compares turn-level and token-level credit assignment, defines turn-level critics and generalized advantage estimation for turns, derives the growth of variance with horizon in an exactly solvable model, and treats hindsight relabeling for sparse-reward goal tasks, including the importance weights that keep it unbiased and the variance they cost.
- Write the multi-turn policy gradient, and explain why environment-written tokens carry no gradient and must be masked.
- Choose between turn-level and token-level advantages and state what each estimates.
- Compute the variance of outcome, reward-to-go and per-turn estimators as functions of the horizon in a solvable model.
- Train a turn-level policy with and without a learned critic, and judge when a critic helps.
- Apply hindsight relabeling with importance weights, and quantify the variance it introduces.
Continue with the book
Explore the full treatment, worked examples, and exercises in RL for LLM Agents and Reasoning Models.
Companion article for RL for LLM Agents and Reasoning Models, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
