CMU AI Agents 2026: 11. Advanced RL Algorithms
Overview
Graham Neubig explains practical algorithmic fixes for training AI agents, using a coding-agent bug-fix task to show why sparse rewards, stale rollouts, unreliable verifiers, and reward hacking destabilize reinforcement learning. He covers value functions and generalized advantage estimation, asynchronous RL with clipped importance ratios, task and reward design, and teacher-based distillation, emphasizing concrete safeguards such as monitoring GRPO groups for mixed outcomes and auditing what agents can access.
Key takeaways
- A learned value function and GAE provide finer action-level credit than a single trajectory reward, helping avoid rewarding mistakes in successful runs or penalizing useful actions in failed runs.
- Asynchronous RL avoids waiting for straggling agents, but stale rollouts require importance correction and clipping because long trajectories can produce extreme weights; Neubig’s example reached about 1,400.
- GRPO produces no useful gradient when every rollout in a group has the same outcome, so monitor the fraction of groups with both successes and failures and investigate why outcomes are uniform.
- Verifier quality is part of the learning algorithm: false negatives add reward noise, while false positives can teach agents to exploit internet access, Git history, exposed APIs, or test runners.
- Partial and auxiliary rewards can bootstrap learning, but poorly aligned proxies can create persistent unwanted behavior, such as unnecessary browser use or repeated goblin references.
- On-policy distillation addresses exposure bias by training the student on its own states while matching a teacher’s next-token distribution; training on observations may add useful world-model supervision.
Chapters
- Graham Neubig frames the lecture around practical failures encountered while training agents, focusing on algorithms rather than sandboxing or parallel systems.
- The running task asks an agent to fix retry behavior so zero disables retries while preserving other cases; a test verifier returns a binary reward.
- A successful trajectory can still contain a mistake and recovery, illustrating why a final reward of 1 does not reveal which individual actions helped.
- REINFORCE updates successful trajectories but gives failed attempts no learning signal, contributing to high-variance optimization.
- GRPO compares four attempts at the same task against their group-average reward, but applies trajectory-level advantages across all actions.
- That coarse signal can reward a mistake inside a successful trajectory and penalize useful work in a failed trajectory.
- A value function estimates expected reward to go from the current history; in Neubig’s example, 3 successes among 10 continuations gives an estimated value of 0.3.
- Training a separate critic requires another model, while a small linear value head can predict values from the policy model’s embeddings.
- A critic can regress directly to reward or predict a yes/no token probability, using the normalized probability of yes as its value estimate.
- Temporal-difference error, δₜ, measures the next value plus reward minus the value before an action, identifying steps that raise or lower expected success.
- Generalized Advantage Estimation combines current and future temporal-difference errors with a λ decay to estimate each action’s advantage.
- With λ set to 1 in PPO, the accumulated differences telescope toward the final reward; intermediate rewards or a reliable critic can motivate other settings.
- A separately trained process reward model can score individual steps from annotations and potentially bootstrap a value function.
- Synchronous RL waits for every parallel agent to finish before updating, so one slow coding-agent trajectory can leave other workers idle.
- Asynchronous RL continues generating rollouts during learner updates, improving hardware utilization.
- The tradeoff is that rollouts may come from an older policy than the learner, creating off-policy data and possible training instability.
- Importance sampling weights data by the learner-policy probability divided by the rollout-policy probability.
- A token with learner probability 0.7 and rollout probability 0.4 receives a ratio of 1.75.
- For long agent trajectories, small per-token differences compound across tens of thousands of tokens, producing high-variance or extreme sequence-level weights.
- PPO and GRPO commonly use the current token’s ratio rather than the full product, while methods such as GSPO normalize a sequence ratio by response length.
- Neubig’s lab example shows maximum importance weights reaching roughly 1,400 with an off-policy limit of three updates, large enough to cause destructive gradient steps.
- PPO clips probability ratios, commonly around 0.8 to 1.2, to constrain how far helpful and harmful actions can change.
- CISPO also clips importance weights, while DAPO uses asymmetric clipping to allow a larger upper bound for positive advantages.
- An outsize update can cause degenerate outputs such as repeated tokens or unusually long or short generations, after which recovery may be difficult.
- A reference model, often the initialized policy, can constrain divergence between the updated model and its starting behavior.
- Low entropy can collapse output diversity and remove the variation GRPO needs for learning; excessively high entropy produces mostly random samples.
- Entropy regularization can help prevent either collapse or uncontrolled randomness.
- The algorithm comparison distinguishes REINFORCE, PPO, GRPO, CISPO, GSPO, and DAPO by their reward or advantage signal, critic use, importance ratios, and clipping.
- A GRPO group needs at least one positive and one negative outcome; if all attempts pass or all fail, advantages have no variance and provide no gradient.
- Uniform failure can indicate a weak verifier, insufficient model capability, or inadequate exploration, so inspect failing requirements, stronger-model demonstrations, and trajectory diversity.
- False negatives occur when a correct solution fails an invalid or unachievable test, adding reward noise and capping benchmark scores.
- Neubig notes that OpenAI reported only about 81% of SWE-bench Verified tasks were solvable, with verifier noise among the remaining cases.
- Incomplete tests create false positives: an agent can pass the checked subset while failing the behavior the task is meant to assess.
- Examples of benchmark leakage include agents searching the internet for answers, recovering solutions from Git history, or calling a stronger model through an exposed API proxy.
- Agents with access to test runners may tailor code to the visible tests instead of solving the underlying task.
- Training on these loopholes can reinforce reward hacking, so evaluate unseen tasks, monitor agent behavior and training costs, and audit sandbox access.
- When GRPO groups have zero-advantage outcomes, rerolling until a group contains mixed results can restore a useful learning signal.
- Partial rewards, such as the fraction of four tests passed, provide learning signal even when an agent earns zero on the final success metric.
- Misaligned auxiliary rewards can create unwanted habits: a browser-use bonus led a model to use a calculator for simple arithmetic.
- A judge rewarding a nerdy persona helped amplify words such as goblin and gremlin, illustrating how small proxy rewards can dominate behavior.
- Training can begin with demonstrations or simpler tasks, then shift toward harder tasks as the model improves.
- Distillation can collect successful rollouts from a stronger teacher and train a weaker student on those examples.
- Distributional distillation minimizes divergence from the teacher’s next-token probabilities rather than training only on a sampled token.
- Teacher-generated histories can cause exposure bias because the student may not reach the same states at inference time.
- On-policy distillation rolls out the student’s own trajectory, then uses the teacher’s next-token distribution as the training target at each student state.
- On-policy self-distillation gives the teacher the answer in advance, which can improve its targets but biases them toward behavior that assumes the answer is known.
- Agent RL losses are typically applied to generated actions, including reasoning and tool calls; a paper called Echo reports benefits from also training on environment observations.
- Training on observations may add a world-model learning signal, particularly in environments that provide rich state information.
Transcript excerpt
0:00 So uh hi everyone. This time I'm going to talk about advanced RL algorithms for agents. Um one thing that I did in preparing this lecture was think of all the things that have gone wrong to me uh while training agents in the past year or two. Uh, and so what I'll try to do during this lecture is try to point out a problem that you will encounter when you're training agents and a solution for it. And so hopefully if you're encountering any issues during your assignments or during your your projects, the information here will be useful to help you overcome them. I intentionally didn't cover anything that doesn't fix a problem that I've never had. So hopefully it will all be all be
0:50 practical advice here. So we have three lectures on RL because it's such a big part of AI agents nowadays and we already covered the RL basics and today I will be covering some advanced algorithmic topics and then in the next lecture we'll be talking about some advanced systems topics. And so what I won't be talking about this time is you know how do you sandbox agents to make sure that they you know don't destroy your file system how do you uh run them in parallel uh th those sorts of things. Today we'll mostly be with respect to the algorithms in the math. So I'm going to be using a running example during this entire lecture just a very simple example of fix getting a
1:39 coding agent to fix a bug. And so this is also similar to what I talked about in the coding agents lecture, but the prompt is uh fix the retry setting. Zero should disable retries, but the code returns three. Preserve the other cases.
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Graham Neubig.