RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement Learning
Read first: Proximal Policy Optimization (PPO) · High-Dimensional Continuous Control Using Generalized Advantage Estimation (GAE) · DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
TL;DR. RAGEN is a verl-based system for multi-turn agent RL. Its objective, StarPO, treats a whole interaction trajectory as the unit of optimisation. Running small Qwen2.5 models on stylised environments (Bandit, Sokoban, FrozenLake, WebShop), the paper finds a recurring collapse mode it calls the Echo Trap, a stabilised variant (StarPO-S), and a set of rollout-design findings. This page reads it as an agent builder: what goes into an update, which rollout knobs mattered, and how far the evidence reaches. This is the canonical tracked note for the paper (questions, diagram, and the environment, rollout and trajectory-design findings). The RL track cross-lists it as RAGEN (StarPO, Echo Trap), which owns the policy-optimisation and stability story (collapse signals, StarPO-S) and links back here for rollout-design results rather than repeating them.
Why it matters now. A search agent trained with RL is exactly this kind of multi-turn loop: think, issue a query, read results, repeat, and get a reward at the end. Before scaling to BrowseComp-Plus-style tasks you need to decide how many questions and samples go into each batch, how many tool calls to allow, how stale rollouts may be, and what to monitor. RAGEN is one of the few papers that ablates these choices directly, even if only on toy environments.
Key idea
Section titled “Key idea”The trajectory is the unit. At each step the model emits a structured output: a <think> block followed by an <answer> block that holds one or more environment actions. The environment returns the next state and a reward. A rollout is the full sequence , and StarPO maximises the expected trajectory reward (Eq. 2):
The trajectory is flattened into tokens and optimised with PPO or GRPO, with token-level likelihoods. (PPO trains a critic to estimate each state’s value; GRPO drops the critic and uses the mean reward of several trajectories from the same start as the baseline.) Each training loop takes initial states and samples trajectories from each, then updates with batch size . Over loops this gives
gradient steps. The defaults are , , and up to 200 loops, with at most 5 turns per episode and 5 actions per turn (App. C).
Credit assignment with γ = λ = 1. PPO uses generalised advantage estimation (GAE), which sums TD errors with weights . RAGEN sets γ = λ = 1, so the sum telescopes:
With only a terminal reward R this is . Every token sees the same return, and only the critic’s value estimate distinguishes good turns from bad ones. GRPO, which has no critic, gives every token of a trajectory the same group-normalised advantage. Appendix D evaluates two turn-aware additions taken from Wang et al. (2025):
- Response masking restricts the loss to model-generated tokens rather than environment-induced state text.
- Bi-level GAE estimates advantages at the turn level and then within each turn’s tokens.
Both improved Sokoban (Fig. 12).
Collapse and StarPO-S. In vanilla StarPO the policy tends to settle into repetitive reasoning templates. The reward standard deviation across rollouts falls, entropy drops, and gradient norms spike: the Echo Trap. Reward std is the earliest alarm: in FrozenLake-PPO it drops sharply at step 40, while the mean reward collapses only at step 90. Gradient-norm spikes (step 170 Bandit, 110 Sokoban, 90 FrozenLake) are late, and after them recovery is unlikely (§4). StarPO-S adds three fixes:
- Uncertainty filtering: keep only the prompts whose rollouts have the highest reward variance.
- Critic baselining: PPO with a critic was more stable than GRPO here.
- Gradient shaping borrowed from DAPO: remove the KL term and clip asymmetrically (ε_low = 0.2, ε_high = 0.28; Fig. 11).
Rollout shaping (§4.3). All three studies train on Sokoban and evaluate on related tasks.
- Task diversity vs responses per prompt (Table 1). With the batch size fixed, more responses per prompt means fewer distinct prompts. Four responses per prompt was best (25.39% SokobanNewVocab, 21.48% FrozenLake). One or two responses per prompt hurt FrozenLake badly (12.50%), because there is little to compare.
- Actions per turn (Table 2). Performance rose up to 5–6 actions per turn (Sokoban 33.59% at 6) and fell at 7 (22.27%).
- Freshness (Fig. 7). Reusing each rollout batch for k updates (Online-k) was worse than collecting fresh rollouts every update (Online-1).
Reasoning fades. Under outcome-only reward, think blocks shrank (Table 4: Sokoban from 307.1 to 104.6 to 89.5 tokens at steps 0, 100 and 200). Removing reasoning entirely hurt single-turn Bandit but had mixed effects on multi-turn Sokoban (Table 3).
Key results
Section titled “Key results”All numbers are paper-reported, mostly from Qwen2.5-0.5B-Instruct on stylised tasks.
- StarPO-S vs vanilla StarPO (Fig. 6). StarPO-S delays or prevents collapse on all four tasks. Under PPO on FrozenLake, keeping 75% of prompts by reward std extends stable training from about 100 to 140 steps, and keeping 50% avoids collapse (Fig. 5).
- Against much larger models (Table 5). The trained 0.5B model reaches 20.70% Sokoban and 21.48% FrozenLake, against zero-shot GPT-4o at 27.73% and 26.56% and Qwen2.5-72B-Instruct at 19.53% and 23.83%.
- Against supervised imitation (App. G). SFT on breadth-first-search solutions reaches 74.6% Sokoban and 23% FrozenLake, against 20.3% and 21.8% for StarPO-S.
- Scaling to 3B and 7B (App. D, Fig. 10). Larger models clearly helped Bandit and WebShop and gave marginal gains on Sokoban and FrozenLake, which the authors attribute to those grid tasks overlapping little with pretraining text. The 7B WebShop run ran out of memory on 4×H100, so only 3B is reported there.
Limitations & open questions
Section titled “Limitations & open questions”- Toy environments and small models. Grid puzzles and a bandit are far from open-web search; WebShop is the closest to a real agent task, and it was trained for only 100 steps because of its long context.
- RL is not the strongest baseline here. Imitation of a solver beats StarPO-S on Sokoban by a wide margin (App. G), so read the paper as a study of RL dynamics.
- Weak per-turn credit. With γ = λ = 1 and terminal reward, turn-level credit relies entirely on the critic, and the turn-aware methods are only briefly ablated.
- Reasoning quality is not rewarded. The authors note that agents can be rewarded despite hallucinated reasoning, and call for finer-grained, reasoning-aware rewards.
- No replay buffer or asynchronous setting. These are not studied, so the freshness finding does not directly inform asynchronous systems such as AReaL or ASearcher.
Connections
Section titled “Connections”- Same paper, RL-track cross-list: RAGEN (StarPO, Echo Trap), a short untracked summary of reward-std filtering and collapse signals.
- Algorithms: PPO, GRPO, and DAPO (the source of the KL removal and clip-higher fixes). ArCHer is a hierarchical turn-level critic.
- Infrastructure: RAGEN runs on HybridFlow / verl. ASearcher takes the opposite freshness trade-off with fully asynchronous rollouts.
- Realistic follow-up: long-horizon tool agents.
- Map: the agentic RL survey.
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.
- Derive / compute
RAGEN's default run uses P = 8 initial states, N = 16 trajectories per state, update batch size E = 32 and L = 200 rollout-update loops. Compute the total number of gradient steps S, and the number of distinct prompts per batch when the 128-trajectory batch is spent as 4 responses per prompt versus 32. Which setting did Table 1 favour, and why does 1 response per prompt break GRPO-style comparison?
What a strong answer covers
- S = L·P·N/E = 200 × 8 × 16 / 32 = 800 gradient steps.
- With 128 trajectories per batch: 4 responses per prompt gives 32 distinct prompts; 32 responses per prompt gives 4 prompts.
- Table 1 favoured 4 responses per prompt (25.39% SokobanNewVocab, 21.48% FrozenLake). More distinct prompts means more task diversity per update.
- With 1 response per prompt there is nothing to compare: a group baseline from one sample equals that sample's reward, so the advantage is zero. The paper notes the diversity benefit only holds when each prompt still has several rollouts.
- Mechanism
StarPO uses PPO with GAE and sets γ = λ = 1. Show what the token-level advantage reduces to when the only reward arrives at the end of a trajectory, and explain what this implies for credit assignment across turns. Then explain what response masking and bi-level GAE (Appendix D) are meant to change.
What a strong answer covers
- GAE sums TD errors δ_t = r_t + γV(s_t+1) − V(s_t) with weights (γλ)^l. With γ = λ = 1 the sum telescopes to (reward from t to the end) − V(s_t), with V = 0 at the terminal state.
- With a single terminal reward R this is R − V(s_t): every token sees the same return, and only the critic's value estimate makes the advantage differ between early and late turns.
- GRPO, without a critic, gives every token in a trajectory the same group-normalised advantage, so it has no per-turn credit at all.
- Response masking restricts the loss to tokens the model generated (not environment-induced state text); bi-level GAE estimates advantages at turn level and then inside each turn. RAGEN reports both improve Sokoban (Fig. 12) and cites Wang et al. (2025) for the method details.
- What if…
Table 2 varies the maximum actions per turn from 1 to 7, and Figure 7 varies rollout reuse (Online-1, Online-5, Online-10). What does each ablation hold fixed, what did it find, and what confounds stop you from reading the action-budget optimum as a general rule?
What a strong answer covers
- Table 2: training on Sokoban and evaluating on Sokoban variants and FrozenLake. Performance rises up to 5–6 actions per turn (33.59% Sokoban at 6) and drops at 7 (22.27%); the paper blames noisy transitions and diluted reward feedback.
- Figure 7: Online-k reuses each rollout batch for k updates. Online-1 (fresh rollouts every update) converged faster and generalised better than Online-5 or Online-10.
- Confounds: more actions per turn also changes episode length, the total actions allowed per episode and the token budget, so the optimum mixes several factors; results are single small-model runs on grid puzzles.
- The freshness result compares heavy reuse of stale batches; it does not test bounded-staleness asynchronous systems, which trade a little freshness for much higher throughput.
- Critique
Table 5 says the RL-trained 0.5B model is comparable to zero-shot GPT-4o and Qwen2.5-72B on Sokoban and FrozenLake, while Appendix G reports that supervised fine-tuning on search-generated trajectories reaches 74.6% on Sokoban. Critique how the paper's results should be read by someone deciding whether to use RL for an agent.
What a strong answer covers
- Table 5 compares a model trained on the task with models that saw only instructions and format examples: 20.70% vs 27.73% (GPT-4o) and 19.53% (Qwen2.5-72B) on Sokoban. It shows that the 0.5B model learned the task, not that it reasons better than frontier models.
- Appendix G: SFT on breadth-first-search solutions gives 74.6% Sokoban and 23% FrozenLake vs 20.3% and 21.8% for StarPO-S. When a cheap optimal solver exists, imitation beats RL by a wide margin on Sokoban.
- So the paper is a study of training dynamics and failure modes, not evidence that RL is the best way to build these agents.
- For search agents no optimal solver exists, which is one reason RL is attractive there; but strong teacher trajectories, as used by many search-agent papers, play the role that BFS plays here.
- Design
You are setting up multi-turn RL for a retrieval agent on a local corpus, with an outcome reward from an answer judge. Using RAGEN's findings, choose responses per prompt, a per-turn tool budget, a rollout freshness policy, a monitoring plan and a reward for reasoning. For each choice say whether it transfers directly or must be re-tuned.
What a strong answer covers
- Responses per prompt: several per question (around 4–8) so groups can disagree, with as many distinct questions as the batch allows. The principle transfers; the exact number must be re-tuned.
- Tool budget: allow enough calls per turn to issue and refine queries, but cap it. The 5–6 optimum is specific to grid moves and must be re-tuned on search tasks.
- Freshness: avoid reusing a rollout batch for many updates; if throughput forces asynchronous rollouts, bound policy staleness and correct with importance ratios.
- Monitoring: track reward std across groups, entropy and gradient norm, and drop zero-variance groups (StarPO-S filtering). This transfers directly.
- Reasoning reward: outcome-only reward let thinking shrink in RAGEN; consider small rewards for verifiable intermediate progress (for example retrieving a judged-relevant document), kept small enough to prevent gaming.
- Research idea
Table 4 shows think-block length falling during training (Sokoban 307.1 → 104.6 → 89.5 tokens at steps 0, 100, 200), and the paper reports shallow or hallucinated reasoning under outcome-only reward. Propose a study that tests whether a search agent's reasoning carries real information about its actions, and how you would reward it without inviting reward hacking.
What a strong answer covers
- Test faithfulness: intervene on the think text (truncate, shuffle or replace it) and measure how much the next query or answer changes. If actions do not depend on the reasoning, it is decoration.
- Compare against a NoThink ablation as RAGEN does (Table 3): in multi-turn Sokoban removing reasoning had mixed effects, while in single-turn Bandit it hurt clearly.
- Reward options: a judge that checks whether the stated plan matches the next action, or rewards for predictions that can be verified (for example stating which document should contain the answer and checking it).
- Hacking risk: a judge that rewards reasoning text can be gamed by fluent but irrelevant text, so keep reasoning rewards small relative to the outcome reward and audit samples.