Demystifying Reinforcement Learning for Long-Horizon Tool-Using Agents: A Comprehensive Recipe
TL;DR. This paper is a controlled study of RL for multi-turn tool agents. On TravelPlanner, the authors build STAR (data synthesis → SFT → RL) and vary one design choice at a time. Their recipe is scale-dependent: small models need denser or staged rewards and more exploration, while a 7B model does best with plain GRPO. About 1K mixed-difficulty prompts is a sweet spot, and dense task rewards can hurt transfer.
Why it matters now. A search agent is the same loop with a different tool: reason, call search, read results, repeat, answer. STAR’s out-of-domain test is exactly that setting: Search-R1’s seven QA benchmarks with an E5 retriever over Wikipedia (top-5, budget of 60 tool calls). The design questions it measures are the ones an IR team faces when it trains a deep-research agent: how dense the reward should be, how many queries to use, how hard they should be, and what happens when the search API fails.
Key idea
Section titled “Key idea”The trajectory. Under ReAct, the agent produces H = (q, τ₁, a₁, o₁, …, τ_T, a_T): reasoning τ, tool action a, observation o, and finally a free-text itinerary a_T. Only τ and a are policy outputs. The query and observations are context.
The reward. A formatter LLM parses the itinerary into JSON, and rule checks produce five scores: commonsense micro (fraction of checks passed) and macro (all passed), the same pair for hard constraints, and success (both macros pass). Four rewards differ in density:
Curriculum moves from r^sum to r^success during training.
The optimiser. GRPO with group size 8, no KL penalty and a raised upper clip (from DAPO). Format errors get reward 0. Over-length rollouts are excluded from the loss but kept for advantage normalisation. The context limit is 30K tokens with a budget of 60 tool calls.
The data. The official TravelPlanner split has only 45 training queries, 180 for validation and 1,000 for test. STAR therefore synthesises feasible queries with controlled difficulty. SFT uses 1,198 successful teacher trajectories from DeepSeek-V3.2-Exp (on average 9.2 tool calls and 10.3K tokens). RL uses 1K different queries (easy:medium:hard = 4:3:3), and models are selected on the validation split.
Concepts to carry to any tool agent.
- Observation vs action tokens. Tool output sits in the context but is not something the policy chose. The standard practice is a loss mask that zeroes its tokens. STAR does not spell out its masking, but RAGEN’s appendix shows response masking helps.
- Delayed reward. Credit arrives once at the end, so all turns share one advantage. Dense partial scores are the cheapest way to tell good turns from bad ones.
- Truncation. Decide whether a cut-off trajectory is a failure or an unknown; STAR treats it as unknown for the gradient but not for the baseline.
- Environment noise. The authors inject “tool not available” errors during training only, and evaluate in a clean environment.
- Splits. Synthetic RL data must be disjoint from SFT data and from test, and checkpoint selection must use a held-out split.
Key results
Section titled “Key results”All numbers are paper-reported TravelPlanner test success unless stated. No seeds are reported.
- Reward and scale (Table 1). Success at 1.5B: Sum 33.1, Macro 30.1, Success 33.8, Curriculum 34.9. At 3B: 47.0, 48.2, 46.6, 49.9. At 7B: 62.8, 58.9, 60.9, 57.0. The 7B SFT starting point was 19.7.
- Alignment tax (Table 2, OOD QA average). At 7B: SFT 41.9, Search-R1 38.5 (cited from prior work), Sum 36.7, Macro 42.9, Curriculum 41.1.
- Data (Takeaways 4–5, Table 3). For 3B with Curriculum, success goes 37.5 → 49.9 → 50.8 for 100 → 1K → 2K prompts, while OOD goes 35.0 → 32.2 from 1K to 2K. Difficulty mixes give Easy 45.3, Medium 41.1, Hard 25.9 and Mixed 49.9.
- Algorithms (Table 4). At 1.5B, GRPO 30.1, DAPO 36.9, ARPO 37.5. At 7B, GRPO 62.8, DAPO 58.4, ARPO 58.3, with ARPO costing 547 vs 368 GPU-hours (16×A100).
- Tool noise (Figure 6, 3B). With injected failure rates of 0–10% during training, test success is stable up to 5% and drops clearly at 10%.
Limitations & open questions
Section titled “Limitations & open questions”- One simulated environment. The paper states that its recipe comes from TravelPlanner and that real-world dynamics may differ.
- OOD means knowledge-intensive QA only. Cross-domain transfer, for example to coding or web navigation, is untested.
- One factor at a time. Interactions (for example reward × data difficulty × scale) are not explored, and models stop at 7B.
- No seeds or confidence intervals, so many 1–3 point differences may be within noise.
- The reward depends on an LLM formatter, so parser mistakes become reward noise. The authors validated it offline on a sample.
- Failure analysis shows no global re-planning: agents rarely go back and change an early decision (such as the destination city) when later tool results make it infeasible.
Connections
Section titled “Connections”- Before: ArCHer and RAGEN on multi-turn agent RL; GRPO and DAPO for the optimiser.
- Rewards: Outcome vs process rewards frames the Sum vs Success choice; the rewards map covers rule checks vs LLM judges.
- Search agents: Deep research is a retrieval problem for why the search loop matters to IR.
- After: Agentic data scaling asks which data axis to grow; Missing Old Logits covers async training when tool calls are slow.
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
A 3B agent's plan passes 90% of commonsense checks, all hard-constraint checks, and therefore fails overall. Compute its Sum, Macro and Success rewards. Then take a GRPO group of 8 plans that all fail: explain which reward gives non-zero advantages and why that matters most for small models.
What a strong answer covers
- Scores: cs-micro 0.9, cs-macro 0, hard-micro 1, hard-macro 1, success 0.
- Sum = 0.9 + 0 + 1 + 1 + 0 = 2.9; Macro = 0 + 1 + 0 = 1; Success = 0.
- If all 8 plans fail, Success gives identical rewards (all 0), so every group-normalised advantage is 0 and the prompt contributes no gradient. Sum and Macro still differ across plans, so they rank partial progress.
- Small models fail most prompts early on, so a sparse reward leaves them with very few informative groups. This is consistent with the paper's finding that Success-only never wins at any scale, and that the Curriculum reward (Sum moving to Success) is best at 1.5B and 3B.
- Mechanism
A ReAct trajectory interleaves the query, the agent's reasoning and tool calls, and tool observations. Explain which tokens should receive policy-gradient updates, why observation tokens are usually masked, and why STAR keeps over-length rollouts in advantage normalisation but drops them from the loss.
What a strong answer covers
- Only tokens the policy generated (reasoning traces and actions, including the final plan) are actions. The query and tool observations are produced by the user or environment.
- Putting observations in the loss would train the model to predict tool output, i.e. to imitate or hallucinate observations, and would mix environment text into the credit signal. Masking them is standard practice (e.g. Search-R1's retrieved-token masking; RAGEN reports response masking helps). STAR does not describe its own masking.
- The trajectory reward arrives only after the final plan is parsed and checked, so under GRPO every policy token in every turn shares the same trajectory-level advantage.
- A truncated rollout's low reward may reflect the length cap, not its decisions, so it gets no gradient. Keeping it in the group mean and std avoids biasing the baseline by silently dropping (mostly failing) samples.
- What if…
Using the paper's data experiments (3B, Curriculum reward), describe how in-domain success and OOD QA accuracy respond to data quantity (100, 1K, 2K prompts) and difficulty mix (easy, medium, hard, mixed 1K). What does this say about when to stop adding RL data?
What a strong answer covers
- Quantity: success rises from 37.5% (100 prompts) to 49.9% (1K) and only to 50.8% (2K). OOD average peaks at 35.0 with 1K and drops to 32.2 with 2K.
- Difficulty (Table 3): Easy-1K 45.3%, Medium-1K 41.1%, Hard-1K 25.9%, Mixed-1K (4:3:3) 49.9%. Hard-only data gives few successes, so the reward is effectively sparse.
- The in-domain metric keeps creeping up while transfer falls, so model selection on in-domain validation alone would pick the over-trained 2K model.
- These are single runs per setting with no reported seeds, so differences of 1 point (49.9 vs 50.8) are within plausible noise.
- Critique
At 7B the dense Sum reward gives the best TravelPlanner success (62.8%) but an OOD QA average of 36.7, below the SFT model's 41.9. Critique the claim that Macro "achieves an optimal balance", and list what else limits how far these recipes generalise.
What a strong answer covers
- The OOD drop is an alignment tax: a dense, task-specific reward overfits the agent to TravelPlanner's format. Macro at 7B keeps OOD at 42.9 with 58.9% success, which is a trade-off, not a free win.
- OOD is measured only on 7 knowledge-intensive QA sets with one Wikipedia search tool, so "generalisation" means one other domain.
- Rewards depend on an LLM formatter (DeepSeek-V3.2-Exp) that parses the free-text plan into JSON; parser errors become reward noise.
- Single-factor sweeps, models up to 7B, a simulated environment and no reported seeds: the paper itself flags these as limitations.
- Design
You are training a 3B search agent with RL over a live web-search API that sometimes times out. Using STAR's findings, specify the reward schedule, data mix and size, RL algorithm, and how you will handle tool failures in training and evaluation.
What a strong answer covers
- Reward: start dense (partial credit such as evidence recall or format checks) and anneal to the final-answer reward, while monitoring an OOD set for alignment tax.
- Data: about 1K prompts with mixed difficulty, disjoint from SFT data, with early stopping chosen on a held-out set that includes OOD questions.
- Algorithm: at 3B, plain GRPO matched DAPO and ARPO at lower cost (176 vs 184 vs 273 GPU-hours), so start with GRPO plus clip-higher and no KL.
- Tool failures: return an explicit error observation so the agent can retry; keep failure rates around 5% or below, or filter failed calls, since 10% noise clearly hurt; evaluate in a clean environment and separately under realistic failure rates.
- Research idea
STAR finds that exploration-heavy algorithms (DAPO, ARPO) help at 1.5B but not at 7B. Propose an experiment that tests whether this is about model capability or about reward sparsity, and say what result would distinguish the two.
What a strong answer covers
- Hypothesis A: small models need extra exploration because they rarely succeed. Hypothesis B: the benefit comes from sparse groups, which happen to be common for small models.
- Hold model size fixed and vary sparsity: run 7B on Hard-only data (sparse) and 1.5B on Easy-only data (dense), comparing GRPO with DAPO/ARPO in each.
- If DAPO/ARPO help 7B on hard data and not 1.5B on easy data, sparsity is the driver; if the 1.5B gap persists on easy data, capability is.
- Track the fraction of zero-variance groups and per-step cost (ARPO is 13.3 vs 9.0 min/step at 7B), and use several seeds so a 1–4 point gap is interpretable.