The Policy Gradient.
Make rewarded samples more likely. Subtract the average reward first, and the same push is far less noisy.
The gradient of expected reward cannot be computed by back-propagating through sampling, but Williams’ REINFORCE (1992) gives an estimate that can: ∇J = E[R(y) ∇ log π(y)]. Sample responses, and push up the log-probability of each in proportion to its reward. The estimate is unbiased — on average it points the right way — but each batch’s estimate scatters widely around that average, because a reward of 1 pushes up every sampled response regardless of whether it was better than usual.
Subtracting a baseline b that does not depend on the sampled response leaves the expectation unchanged, since E[∇ log π] = 0, but reduces the scatter: the push becomes R − b, the advantage — positive for responses better than usual, negative for worse. A good baseline is the expected reward itself. The workshop isolates the effect on one prompt with eight candidate answers, one right, measuring the spread of the gradient estimate over 400 batches and the average learning curve over 40 runs.
Below: left, the probability of the right answer over training, averaged over 40 runs, with and without a baseline. Right, the spread of one batch’s gradient estimate around its mean.
- Derive the REINFORCE estimator.
- Explain why it is unbiased but noisy.
- Show that a baseline reduces variance without bias.
- Define the advantage.
Unbiased, noisy, and less noisy
When the right answer starts at probability 0.2, the true gradient on its logit is p(1 − p) = 0.160. Averaged over 400 batches of 8, REINFORCE without a baseline estimates 0.155 — unbiased — but a single batch’s estimate scatters by 0.107. Subtracting the batch’s mean reward cuts the scatter to 0.076, 29% less, while the average moves to 0.144: the batch mean includes the sample being scored, which biases it by a factor (n − 1)/n — the reason the leave-one-out baseline (RLOO), which averages the other samples only, is preferred.
Variance matters because training follows single batches, not averages. Larger batches reduce it too: with 32 samples the spread without a baseline is 0.056. And it matters most when success is rare: at an initial probability of 0.05, 0.068 without a baseline against 0.065 with one. PPO adds a learned value function as the baseline (plate XIX.4); GRPO uses the mean reward of a group of answers to the same prompt (plate XIX.5). All are this one idea.
Terms
- REINFORCE
- The policy-gradient estimator E[R ∇ log π].
- Baseline
- A quantity subtracted from the reward that does not depend on the sampled action.
- Advantage
- Reward minus baseline: how much better than usual a sample was.
- Variance
- How much a single estimate scatters around its expectation.
Sources
- Williams, “Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning”, Machine Learning 8, 1992.
- Ahmadian et al., “Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs”, ACL 2024 (RLOO).