Skip to content

Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection

optionalcorefundamentalpaperrubric 11/122023 · ~40 min

Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, Hannaneh Hajishirzi

Read first: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Status

TL;DR. Self-RAG trains one LM (Llama 2, 7B or 13B) to write four kinds of special reflection tokens alongside its answer:

  • Retrieve: should I fetch passages now?
  • ISREL: is this passage relevant?
  • ISSUP: is my sentence supported by it?
  • ISUSE: how useful is the answer overall?

At inference the model retrieves only when the Retrieve probability passes a threshold. It processes several passages in parallel and keeps the segments its own critique scores highest. The training is supervised fine-tuning on data labelled offline by a critic that was distilled from GPT-4. It is not RL, and the model never writes search queries.

Why it matters now. Self-RAG gives explicit answers to three questions every search agent faces: whether to retrieve, which evidence to trust, and whether the output is grounded. It shows these can be learned as tokens and then controlled at decoding time. It is also the key paper in Akari Asai’s job talk. Its ISSUP signal looks ahead to process-level grounding rewards.

Reflection tokens. One segment is one sentence.

TokenValuesQuestion it answers
Retrieveyes, no, continueShould I retrieve before the next segment?
ISRELrelevant, irrelevantIs passage dd relevant to xx?
ISSUPfully, partially, no supportIs segment yty_t supported by dd?
ISUSE5, 4, 3, 2, 1Is the response useful for xx?

Training, in two offline stages.

  1. Critic. Prompt GPT-4 for each token type, giving 4k–20k examples per type. Train a critic CC (Llama 2 7B) to maximise log⁡pC(r∣x,y)\log p_C(r \mid x, y). It agrees with GPT-4 more than 90% of the time on most categories.
  2. Generator. Run the retriever and CC over 150k instruction–output pairs. This inserts passages and reflection tokens into each target. Train the generator MM with next-token loss, max⁡log⁡pM(y,r∣x)\max \log p_M(y, r \mid x), with the passage tokens masked out and the vocabulary extended with the reflection tokens.

There is no reward model and no PPO; the critic is used only to build the data.

Inference.

  • Retrieval decision. Retrieve when the normalised probability of Retrieve = yes exceeds δ\delta. The paper uses 0.2 for most tasks and 0 for ALCE, so retrieval almost always fires there.
  • Candidates. The retriever is Contriever-MS MARCO, top 5. For each passage dd, generate a candidate segment together with its ISREL, ISSUP and ISUSE tokens.
  • Scoring. Each candidate is scored as f(yt,d)=p(yt∣x,d,y<t)+∑G∈{ISREL,ISSUP,ISUSE}wG sG,f(y_t, d) = p(y_t \mid x, d, y_{\lt t}) + \sum_{G \in \lbrace \text{ISREL}, \text{ISSUP}, \text{ISUSE} \rbrace} w_G\, s_G, where each sGs_G is a normalised probability of the desirable tokens. For ISSUP, “partially” counts half; ISUSE is a weighted sum over its 5 ratings. Defaults are w=(1.0,1.0,0.5)w = (1.0, 1.0, 0.5).
  • Search. A segment-level beam of size 2 keeps the top candidates. Hard constraints, such as dropping segments rated “no support”, are an alternative to soft weights.
Self-RAG: reflection tokens at inference and how they are learned Left, inference for one segment: given the input and earlier segments, the model predicts a Retrieve token. If yes, it retrieves K passages and, for each passage in parallel, predicts a relevance token, a candidate segment, a support token and a utility token. Each candidate is scored by its generation probability plus a weighted sum of the normalised probabilities of the desirable critique tokens, and a segment-level beam keeps the top two. If no, it generates the segment directly and predicts utility. Right, training: GPT-4 labels four to twenty thousand examples per token type; a Llama 2 7B critic is distilled from them; the critic inserts reflection tokens offline into 150 thousand instruction pairs; and the generator is trained with an ordinary next-token loss, with retrieved passage text masked from the loss. Inference, per segment Training (offline) x, y<t Retrieve = ? yes: retrieve K passages d₁ → ISREL · candidate y_t¹ · ISSUP · ISUSE d₂ → ISREL · candidate y_t² · ISSUP · ISUSE d_K → ISREL · candidate y_tᴷ · ISSUP · ISUSE score = p(y_t | x, d, y<t) + Σ_G w_G · s_G s_G = normalised prob. of the best token in group G keep top-B segments (B = 2); w = 1.0, 1.0, 0.5 If Retrieve = no: generate y_t directly, then predict ISUSE. Retrieve fires if its yes-probability > threshold. GPT-4 judgments 4k–20k per token type critic C (Llama 2 7B) distilled from GPT-4 insert tokens offline into 150k instr. pairs generator M (7B, 13B) next-token loss
Original sketch. Offline, a GPT-4-distilled critic labels training data; online, the generator itself emits the reflection tokens and a segment-level beam search ranks candidates from different passages.

A worked segment (illustrative, not from the paper). Question: Who designed the retrieval model ColBERT?

[Retrieve=Yes] p(yes) = 0.7 > δ = 0.2, so retrieve top-5
d1: "ColBERT ... by Khattab and Zaharia ..." [ISREL=Relevant]
candidate: "ColBERT was introduced by Omar Khattab and Matei Zaharia."
[ISSUP=Fully supported] [ISUSE=5]
d2: "Colbert is a French surname ..." [ISREL=Irrelevant]
candidate: "Colbert was a French minister." [ISSUP=No support] [ISUSE=1]
beam keeps the d1 segment; next segment: [Retrieve=No] ... [ISUSE=5]

Retrieval is ordinary dense retrieval. What Self-RAG adds is the model’s own judgment of each passage and each sentence.

What changed vs. prior work, and what didn’t.

RAG (Lewis et al.)Prompted RAG with an LLMSelf-RAG
When to retrievealways, oncealways, onceper segment, by a learned token and a threshold
Passage usemarginalise over top-kconcatenate top-kone candidate per passage, then rank
Groundedness checknonenoneISSUP token per segment
Trainingend to end, answer likelihoodnoneSFT on critic-labelled data
Who writes queriesnonenonenone (input and output so far)
Inference controlnonepromptthreshold, critique weights, hard constraints

Main table (Table 2).

ModelPopQA accTQA accPubHealth accARC accBio FSASQA emASQA rgASQA mauASQA preASQA rec
ChatGPT29.374.370.175.371.835.336.268.8––
Ret-ChatGPT50.865.754.775.3–40.739.979.765.176.6
Llama2-FT 7B (retrieval at test)48.757.364.365.878.231.035.851.25.07.5
Alpaca 13B (retrieval)46.166.951.157.677.734.836.756.62.03.8
Self-RAG 7B54.966.472.467.381.230.035.774.366.967.8
Self-RAG 13B55.869.374.573.180.231.737.071.670.371.3
  • Cleanest comparison: Llama2-FT 7B. It is trained on the same 150k pairs without reflection tokens and retrieves only at test time. Self-RAG 7B beats it on every column except ASQA exact match and rouge, and its citation precision is 66.9 vs 5.0.
  • Against ChatGPT. ChatGPT is still stronger on TriviaQA, ARC and ASQA exact match. Retrieval-augmented ChatGPT has higher citation recall.

Ablations (Figure 3a, 7B trained on 50k, PopQA / PubHealth / ASQA em). The ASQA ablations use 150 sampled instances.

VariantPopQAPubHealthASQA em
Self-RAG (50k)45.573.532.1
No Retriever (trained without passages)43.667.831.0
No Critic (always top-1, no reflection tokens)42.672.018.1
No retrieval at test time24.773.0–
Retrieve only when Retrieve = Yes28.372.6–
Always retrieve top-141.873.128.6
Remove ISSUP from beam score44.173.230.6

Other analysis (§5.2).

  • Customisation: raising the ISSUP weight increases ASQA citation precision and lowers MAUVE.
  • Retrieval frequency: lowering it hurts PopQA much more than PubHealth.
  • Training data: performance generally rises as training data grows from 5k to 150k, most clearly on PopQA and ASQA.
  • Human evaluation: on 50 sampled PopQA and Bio outputs, annotators mostly agree with the predicted ISREL and ISSUP tokens.
  • Teacher ceiling. All critique labels come from GPT-4 through a 7B critic. Errors and biases in GPT-4’s judgments of relevance and support are copied into the generator.
  • The retriever is fixed and query-less. Self-RAG cannot reformulate a query when the top-5 passages are poor. Multi-hop questions that need a new query are out of scope; IRCoT and search agents address them.
  • Inference cost. One candidate per passage, a beam of 2 and critique tokens per segment multiply the decoding work compared with plain RAG.
  • Thresholds and weights are set by hand. δ\delta and wGw_G are chosen per task, and the paper shows the trade-offs are real. A method for setting them from data is open.
  • Support ≠ truth. ISSUP checks entailment by the retrieved passage, not whether the passage is correct.
  • Open question: can the reflection signals, especially ISSUP, serve as process rewards for RL-trained search agents, and do they resist being gamed once optimised against?

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.

  1. Derive / compute

    Two candidate segments compete in Self-RAG's beam. A, from passage d1, has segment probability 0.40, P(ISREL = relevant) = 0.9 of the ISREL mass, ISSUP probabilities fully / partially / no = 0.2 / 0.3 / 0.5, and all ISUSE mass on 4. B, from d2, has probability 0.55, ISREL relevant 0.6, ISSUP 0.8 / 0.1 / 0.1, and all ISUSE mass on 3. Using the paper's scores and default weights (1.0, 1.0, 0.5), which segment wins? Which wins if the ISSUP weight is set to 0?

    What a strong answer covers
    • Scores: s_ISREL = normalised P(relevant). s_ISSUP = P(fully) + 0.5 × P(partially), normalised. s_ISUSE = Σ w_i P(i) with w = −1, −0.5, 0, 0.5, 1 for ratings 1–5.
    • A: 0.40 + 1.0 × 0.9 + 1.0 × (0.2 + 0.15) + 0.5 × 0.5 = 0.40 + 0.9 + 0.35 + 0.25 = 1.90.
    • B: 0.55 + 1.0 × 0.6 + 1.0 × (0.8 + 0.05) + 0.5 × 0 = 0.55 + 0.6 + 0.85 + 0 = 2.00. B wins, because its claim is better supported.
    • With ISSUP weight 0: A = 0.40 + 0.9 + 0.25 = 1.55 and B = 0.55 + 0.6 + 0 = 1.15. A wins.
    • So the weights decide whether support or relevance and usefulness dominate. This is the paper's inference-time control knob: raising the ISSUP weight raises citation precision and lowers fluency (MAUVE).
  2. Mechanism

    Self-RAG trains its generator with ordinary next-token loss, not PPO, yet the model learns to judge its own retrieval and support. Explain the two-stage data pipeline (GPT-4, critic, offline token insertion), what is masked from the loss, and why this is cheaper than RLHF while still giving a controllable policy.

    What a strong answer covers
    • Stage 1: prompt GPT-4 to produce each reflection token type on sampled examples (4k to 20k per type). Distil these into a critic C (Llama 2 7B), which agrees with GPT-4 over 90% of the time on most categories.
    • Stage 2: run the retriever and the critic offline over 150k instruction-output pairs. This inserts Retrieve, ISREL, ISSUP and ISUSE tokens and passages into the targets.
    • Train the generator M (Llama 2 7B or 13B) with next-token loss on the augmented text, after adding the reflection tokens to the vocabulary. Retrieved passage tokens are masked from the loss, because the model should not learn to generate evidence.
    • There is no reward model in the training loop and no on-policy sampling, so the cost is one supervised fine-tuning run. The paper contrasts this with PPO-based RLHF.
    • The critic's judgments become part of the policy's own output. At inference the generator predicts the tokens itself, and decoding can weight them, so behaviour is tunable without retraining.
  3. What if…

    In the 7B ablations (50k training instances), PopQA accuracy is 45.5 for full Self-RAG, 41.8 when always retrieving and using the top-1 passage, 28.3 when retrieving only if Retrieve = Yes is generated rather than using the adaptive threshold, and 24.7 with no retrieval at test time. On PubHealth the same variants score 73.5, 73.1, 72.6 and 73.0. Explain the pattern across the two datasets.

    What a strong answer covers
    • PopQA asks about long-tail entities that the LM does not know, so retrieval is essential: no retrieval drops it to 24.7.
    • Retrieving only when Retrieve = Yes is the most likely token (28.3) retrieves too rarely. A threshold on the normalised probability (0.2 here) triggers retrieval far more often.
    • Top-1 always (41.8): retrieval fires, but there is no choice among passages or critique. Ranking several passages by ISREL, ISSUP and ISUSE adds 3.7 points.
    • PubHealth is a claim-verification task where parametric knowledge suffices; all variants sit within 1 point, so retrieval policy barely matters there.
    • The lesson: how often to retrieve should depend on the task. The paper exposes the threshold as a knob rather than fixing it.
  4. Critique

    Self-RAG is sometimes described either as "the model checks its own answer" or as "an agent trained to search". Using the paper's method and results, argue why both descriptions are wrong, and identify what its comparison against ChatGPT does and does not show.

    What a strong answer covers
    • Not just self-checking: the critique tokens are trained from GPT-4 labels via a critic and are used during decoding to choose among passages and segments, not as a post-hoc verifier.
    • Not a search agent: the model never writes a query. The retriever (Contriever-MS MARCO) is called with the input and the output so far; the model only decides whether to retrieve and which passage to trust.
    • Not RL: training is supervised next-token prediction; there is no reward and no exploration.
    • Against ChatGPT: Self-RAG 13B wins on PopQA, PubHealth, biography FactScore, ASQA ROUGE and MAUVE, and citation precision (70.3 vs 65.1 for retrieval-augmented ChatGPT). ChatGPT wins on TriviaQA, ARC, ASQA exact match and citation recall (76.6 vs 71.3).
    • Confounds: the comparison mixes model sizes and retrieval setups. Gains over Llama2-FT 7B, trained on the same 150k pairs with retrieval only at test time, are the cleaner evidence.
  5. Design

    You run a RAG service over a large enterprise document collection. Latency budgets differ: a chat surface needs fast answers, while a compliance surface needs every sentence cited. Using Self-RAG's inference knobs, specify the settings for each surface and the measurements that would tell you they are right.

    What a strong answer covers
    • Chat: higher retrieval threshold (retrieve less), fewer passages, beam of 1. Weight usefulness (ISUSE) relatively higher for fluent answers. Measure latency, retrieval rate and answer quality.
    • Compliance: low or zero threshold (always retrieve, as the paper does for ALCE), more passages, a higher ISSUP weight or a hard constraint that drops segments rated "no support". Measure citation precision and recall.
    • Expect the trade-off the paper reports: a higher ISSUP weight raises citation precision and lowers MAUVE fluency.
    • Check that the critic transfers to your domain: hand-label a sample of ISREL and ISSUP predictions, as the paper does with 50 sampled outputs.
    • Log the normalised Retrieve probability per query to set the threshold from data rather than by guessing.
  6. Connect

    IRCoT retrieves after every reasoning sentence and lists "deciding dynamically when to retrieve" as future work; Self-RAG learns a Retrieve token for exactly that. Later RL-trained search agents learn when to search from an outcome reward. Compare the three ways of making this decision and what each needs.

    What a strong answer covers
    • IRCoT: a fixed rule (retrieve after every sentence). It needs nothing extra, but every step costs a search.
    • Self-RAG: a learned token from distilled GPT-4 labels, with a threshold set at inference. It needs a critic and 150k labelled examples, and the decision is local to each segment.
    • RL agents (for example Search-R1): the decision is part of the policy, trained by outcome reward. It needs rollouts with a live retriever, but no labels for when to retrieve.
    • Only the RL agents write their own queries. Self-RAG and IRCoT retrieve with the input or generated text.
    • Self-RAG's ISSUP is a precursor to process-level rewards for groundedness. RL search agents mostly use only an answer-level reward.

Done with this page?

Status