TL;DR
Search-R1 teaches a language model to search while it reasons. The model writes its own search queries in the middle of a thought, reads the results, keeps reasoning, and finally gives an answer. Training uses reinforcement learning with one simple reward: 1 if the final answer exactly matches the gold answer, 0 otherwise. On seven question-answering benchmarks, the authors report that this beats retrieval-augmented baselines by 41% with a 7B model and 20% with a 3B model, using the same retriever, data and base model.
Builds on: Group Relative Policy Optimization (GRPO), Retrieval-Augmented Generation, Tool Use · Leads to: the search-augmented reinforcement learning line of work that follows it
Why it mattered
Search-R1 showed that a language model can learn search behaviour from outcome rewards alone, with no hand-written search script and no large set of human-labelled search trajectories. Before it, search was usually either a fixed pipeline (retrieve once, then answer) or a behaviour taught by imitating labelled examples. The paper's ablations give recipes that later work reuses: mask the retrieved text out of the loss, keep the retrieval budget small, and choose between PPO and GRPO by stability versus speed. Its open code and checkpoints made the method easy to try, which is part of why the paper has been cited about 1,800 times by the time of its metrics snapshot.
The problem
A language model answers from what it memorised during pretraining. Two common fixes each fall short.
Retrieval-augmented generation (RAG) fetches passages once, using the question as the query, and pastes them into the prompt. The model never learns to search well: it cannot ask a second question when the first result is missing a fact. Prompting a model to search several times (for example with IRCoT or ReAct) depends on the model already knowing how to use the tool, and it does not improve from its own mistakes. Training the model on labelled search trajectories works better but needs many expert examples, and search itself is not differentiable, so the usual gradient descent cannot pass through the search call.
The authors ask a narrower question: can reinforcement learning, which needs only a reward and not labelled trajectories, teach the model when and how to search? Three things make this hard. The retrieved text enters the training sequence and could be optimised by mistake. The model has to search several times, deciding each time whether to continue. And it is not obvious that an outcome-only reward, which says nothing about the intermediate searches, is enough to produce useful search behaviour.
How it works
The pipeline runs as a loop of generation and retrieval, with reinforcement learning applied to the whole trajectory.
flowchart LR Q[Question] --> G[Model writes a thought] G -->|search tags| S[Search engine returns passages] S -->|information tags| G G -->|answer tags| A[Final answer] A --> R[Reward: exact match 0 or 1] R --> U[RL update on model tokens only]
- Input. A question, for example "Curious is a women's fragrance by a singer born in what city and state?". A fixed
instruction tells the model to put its reasoning in
<think>tags, a search query in<search>tags, and the final answer in<answer>tags. - First thought and search. The model writes a short thought and then a query, such as "Curious fragrance
information". The rollout stops at the closing
</search>tag, so the model has not yet seen any result. - Retrieval. The system takes the text between the search tags, sends it to the retriever, and gets the top
passages. In these experiments the retriever is E5 over the 2018 Wikipedia dump, and 3 passages are returned. The
passages are wrapped in
<information>tags and appended to the sequence. - Continue. The model reads the appended information and writes its next thought. It may search again (the paper allows up to 4 actions in total) or stop. In the case study, the second query is "Britney Spears birthplace", which comes from the first result naming the singer.
- Answer. When the model writes
<answer>...</answer>, the rollout ends. The reward checks whether the text inside the answer tags exactly matches the gold answer. Here the gold answer is "McComb, Mississippi", so a correct answer gets reward 1 and any other answer gets 0. - Learning signal. The reward is shared across the whole trajectory. The policy gradient then pushes up the probability of the model's own tokens in trajectories that scored well and pushes them down in trajectories that scored badly. The retrieved passages are skipped in this step (step 3's text is never trained on), which the authors call retrieved-token loss masking.
- Repeat. The loop is run over many questions for 500 training steps.
A two-line check for the loss mask. Suppose a rollout has 12 tokens and 4 of them are retrieved text. With masking, the update uses the 8 model-written tokens only. Without masking, all 12 would receive gradient, including 4 tokens the model did not write and cannot control.
The math
The paper writes the training objective as an expected reward of a trajectory that includes search results, with a KL penalty that keeps the trained model near a reference model.
Here is a question drawn from the dataset , is the whole trajectory (model text interleaved with retrieved text), is the search engine, is the model being trained, is the reference model, is the reward, and sets how strongly the KL divergence is penalised.
Step 2 in symbols: the mask
Each token gets an indicator : 1 if the model wrote it, 0 if it came from the retriever. In the PPO form of the update, only tokens with contribute, and the average is taken over those tokens only.
where is the probability ratio between the new and the old model, is the clip range (0.2 in the paper), and is an advantage estimate. For the 12-token example above, the sum over equals 8, so the average divides by 8.
Step 4 in symbols: the group baseline
GRPO replaces the learned value function with a group average. For each question it samples responses and uses their relative rewards as the advantage. The paper's GRPO objective has the same clipped ratio, with in place of , averaged over the group, and with the KL term added directly to the loss.
The paper samples 5 responses per prompt for GRPO. The text does not spell out the exact advantage normalisation, so the lesson does not give one; the idea is that an answer is scored against its group, not against a critic.
Worked examples
The paper's results are the test-set averages, so the examples below use the paper's own reward and mask rules on small trajectories.
- The question is "Who wrote the play Hamlet?" and the gold answer is "William Shakespeare".
- The model writes
<answer>William Shakespeare</answer>with no search. The text inside the tags matches the gold answer exactly. - Reward: EM = 1.
- Next the model writes
<answer>Christopher Marlowe</answer>in a second sample. It does not match, so reward 0. - Interpretation: an outcome reward is all-or-nothing and does not look at the reasoning. The model gets the same signal whether it searched or not, because the reward is rule-based and looks only at the final answer.
- A rollout has 12 tokens. The model wrote 8 of them and 4 came from
<information>passages. - Indicator values: for the 8 model tokens, for the 4 retrieved tokens.
- Count the tokens that take part in the update: .
- Without masking the denominator would be 12, and the 4 retrieved tokens would push the model to imitate text it did not write.
- Interpretation: masking changes which tokens receive gradient, not the reward. The paper's Table 4 shows what this does on its seven benchmarks. For Qwen2.5-7B base with PPO the average exact match is 0.431 with masking and 0.343 without.
- Question: "Curious is a women's fragrance by a singer born in what city and state?" Gold answer: McComb, Mississippi.
- A plain reasoning model with no search answers "Houston" (the paper's example for the R1 baseline). The answer does not match the gold answer, so reward 0.
- Search-R1 first writes the query "Curious fragrance information". The passage it gets says the fragrance is by Britney Spears.
- The second query is "Britney Spears birthplace". The passage says she was born in McComb, Mississippi.
- The third query, "McComb, Mississippi location", returns the city's description, but the model already has the state
from the second passage. It writes
<answer>McComb, Mississippi</answer>. - The answer matches the gold string, so reward 1. Over training, trajectories like this one are reinforced and trajectories that stop too early or answer from memory are discouraged.
- Try it: if the model had stopped after step 3 and answered "McComb" alone, would the reward still be 1? Answer: no. Exact match requires the whole gold string, so "McComb" alone scores 0 under this reward. The paper does not describe partial credit.
Results
All numbers below are copied from the paper's tables, with the exact match (EM) metric.
- Main comparison (Table 2, Qwen2.5-7B base, average over seven datasets): Search-R1 with PPO reaches 0.431. The best retrieval baseline, standard RAG, reaches 0.304. Plain reasoning with RL and no search (R1-base) reaches 0.276.
- Natural Questions (in-domain, Qwen2.5-7B base): Search-R1 0.480, RAG 0.349.
- Qwen2.5-3B instruct (average): Search-R1 0.325, RAG 0.270. Search-R1 on the 3B base model is 0.303.
- Larger model (Table 5, Qwen2.5-14B base, average): Search-R1 0.479, RAG 0.281.
- PPO vs GRPO (Table 3): on the 7B base model, PPO gives 0.431 and GRPO gives 0.350. On the 7B instruct model the order flips: PPO 0.385, GRPO 0.396. The authors' summary is that GRPO converges faster but may become unstable after some steps, while PPO is more stable but converges more slowly (Figure 2a).
- Number of retrieved passages (Table 7): top-1 gives 0.375, top-3 gives 0.431, top-5 gives 0.400.
- Group size for GRPO (Table 8): size 1 gives 0.410, size 3 gives 0.363, size 5 gives 0.350. Size 1 is plain REINFORCE and scores highest here (0.410); the paper notes that larger groups converge faster but risk collapse.
The abstract summarises the main claim as relative gains of 41% for the 7B model and 20% for the 3B model over RAG baselines under the same setting. The paper's own text gives 24% for 7B in one place, so readers should compare the averages in the tables rather than the single headline percentage.
Limits. The evaluation uses exact match, which penalises correct answers worded differently. Training merges two datasets (Natural Questions and HotpotQA), and the evaluation covers seven datasets in total. The appendix case studies show failures: a model can be led astray by misleading retrieved text (Table 14 in the paper) or fail to decompose a complex question (Table 11). The retriever is fixed and the experiments use a single corpus, so the results do not show how the method behaves with a web search engine.
Reading guide
- Section 1 (Introduction): the three challenges (stability, multi-turn interleaving, reward design) that the rest of the paper answers. Needs Retrieval-Augmented Generation and Reinforcement Learning.
- Section 2 (Related Works): RAG, search as a tool and RLHF compared. Needs Tool Use and Reward Model.
- Section 3.1 (RL with a search engine): the objective and the mask, the PPO and GRPO forms. Needs Kullback–Leibler Divergence, Proximal Policy Optimization (PPO) and Group Relative Policy Optimization (GRPO).
- Section 3.2 (Multi-turn calls) and Algorithm 1: the rollout loop, the action budget B. Needs only the walkthrough above.
- Section 3.3 and 3.4 (Template and reward): the instruction template in Table 1 and the exact-match reward.
- Section 4 (Main results): Table 2 and the baselines. Needs Open-Domain Question Answering for the benchmark setting.
- Section 5 (Analysis): PPO vs GRPO, base vs instruct, response length and the mask study.
- Appendices B to J: settings, the 14B model, case studies. The case studies are the easiest way to see the search behaviour.
Check yourself
QuestionSearch-R1 uses an outcome-only reward. What does the reward look at, and what does it ignore?Show answer
It looks at the final answer inside the <answer> tags and gives 1 if it exactly matches the gold answer, 0 otherwise.
It ignores the search queries, the retrieved passages and the reasoning text. The authors chose this minimal design
on purpose and do not add format rewards or a learned reward model.
QuestionA rollout has 20 tokens, of which 5 are retrieved text. With retrieved-token masking, how many tokens are in the denominator of the per-sequence average, and why does this matter?Show answer
15 tokens. The denominator is , and only the 15 model-written tokens have . This matters because the 5 retrieved tokens would otherwise receive policy gradient and push the model to imitate text it did not write.
QuestionWhy does the paper's GRPO variant not need a value model, and what is the cost?Show answer
GRPO samples a group of responses for each question and uses their relative rewards as the baseline, so no separate critic network has to be learned. The cost, as the paper's Figure 2 notes, is that GRPO may become unstable after a number of training steps, whereas PPO is more stable but converges more slowly.
QuestionOn the Qwen2.5-7B base model, the average exact match is 0.431 with Search-R1 and 0.304 with RAG. What is the absolute gain in points, and what is the relative gain as a percentage?Show answer
The absolute gain is 0.431 minus 0.304, which is 0.127, or 12.7 points. The relative gain is 0.127 divided by 0.304, which is about 0.418, so about 42%. The abstract reports 41%, so the reader should check the table rather than rely on the headline figure.
QuestionGive one reason, from the paper's experiments, why top-k = 5 retrieved passages may be worse than top-k = 3 during training.Show answer
Retrieval precision drops as k grows, so more noisy or irrelevant passages enter the context. The paper argues this can also teach the model to ignore retrieved content when it learns that the extra passages are often unhelpful. The top-5 average is 0.400 against 0.431 for top-3.
Sources
- Jin, B., Zeng, H., Yue, Z., Yoon, J., Arik, S., Wang, D., Zamani, H., Han, J. (2025). Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning. arXiv:2503.09516. https://arxiv.org/abs/2503.09516
- Code and checkpoints: https://github.com/PeterGriffinJin/Search-R1