TL;DR
A language model can invent facts, and standard retrieval-augmented generation (RAG) fetches a fixed number of documents whether or not they help. Self-RAG trains a model to make these decisions itself. It writes special reflection tokens that say whether retrieval is needed, whether a passage is relevant, whether the answer is supported by it, and how useful the answer is. The tokens are learned from a critic whose labels come from GPT-4, so no reinforcement learning loop is needed. On the paper's tasks, the 7B and 13B models outperformed standard RAG systems and several larger models on factuality and citation quality.
Builds on: Retrieval-Augmented Generation, Autoregressive Model, Reward Model, Instruction Tuning · Leads to: models that interleave retrieval and self-critique during generation, rather than retrieving once before answering
Why it mattered
Chatbots built on large models are used for research, health-adjacent questions, law and news, where a wrong answer with a confident tone does harm. Retrieval was the standard fix: put relevant documents in the prompt and ask the model to answer from them. But the standard recipe retrieves a fixed number of passages for every query, including questions the model could answer alone, and it trusts every passage, including irrelevant ones. It also gives no way to check whether the answer follows from the sources.
Self-RAG made retrieval an on-demand step and made the model's own judgement visible in the output. Users can see which claims are supported, and developers can trade retrieval cost against accuracy at inference time.
The problem
Start with RAG as it was used. Given a question , a retriever finds the top passages from a large collection. The language model then reads and and writes an answer . Three things go wrong.
First, retrieval always happens. For a question like "what is the capital of France", the passages add cost and can distract the model. Second, the top passages are not always relevant, and the model cannot tell a good passage from a bad one. Third, the answer may contain claims that no passage supports, yet nothing in the output marks them.
Two existing fixes each solve one part. Reinforcement learning from human feedback, with a reward model and PPO training, can teach a model to prefer good answers, but it is expensive and the critic is hidden. Fine-tuning on retrieved data teaches the model to use passages, but not to judge them. The question for Self-RAG was whether a single language model could retrieve, generate and critique within one left-to-right pass.
How it works
Think of Self-RAG as a generator that writes a sentence, then decides what to do next. Each sentence is called a segment. The generator writes ordinary text and special tokens from one expanded vocabulary, so there is no separate controller.
flowchart TB
Q["Question x and previous segments"] --> R{"Retrieve? token"}
R -- "No" --> G1["Write next segment"]
R -- "Yes" --> RET["Fetch top K passages d"]
RET --> P["For each passage: write segment, then critique it"]
P --> J["Score each candidate: relevance, support, usefulness"]
J --> B["Keep best candidates by segment-level beam search"]
G1 --> NEXT["Next segment, until end"]
B --> NEXT
-
Read the question and what has been written so far. The model has the input and any earlier segments .
-
Decide whether to retrieve. The model predicts a retrieval token with one of three values: Yes, No, or Continue (keep using evidence already retrieved). A No means the next segment needs no outside facts, and the model writes it directly.
-
Retrieve when asked. On Yes, a retriever fetches the top passages, with a small fixed number.
-
Generate once per passage. For each passage , the model writes a candidate continuation, conditioned on , and . This is parallel, one candidate per passage.
-
Critique each candidate. The model writes an IsRel token (relevant or irrelevant to ), an IsSup token (fully, partially or not supported by ), and an IsUse token on a scale of 1 to 5.
-
Score and select. Each candidate gets a segment score that combines its generation probability with the probabilities of the desirable critique tokens, each weighted by a setting chosen at inference. A segment-level beam search keeps the best few candidates.
-
Repeat until the end. The chosen segment is appended and the loop returns to step 2. The final output is a sequence of segments, each with its evidence and its critique.
Worked examples
Setting: the model is asked whether to retrieve before writing the next segment. We use a simple rule for this example: retrieve when the normalised probability of the Yes token is above a threshold of 0.2.
- Compare the probability of Yes with the threshold.
- With probability 0.35: , so retrieval is triggered.
- With probability 0.10: , so the model writes the next segment without retrieval.
- Interpretation: a lower threshold retrieves more often, and a higher threshold retrieves less.
Answer: with 0.35 the model retrieves; with 0.10 it does not.
Setting: for one passage, the critic gives IsSup probabilities of 0.6 for fully supported, 0.3 for partially supported and 0.1 for no support. The support weight in the segment score is 0.5.
- The support score for the desirable value is its probability divided by the sum over all support values: .
- The weighted contribution is .
- A second candidate with IsSup probabilities 0.2, 0.3, 0.5 has and a weighted contribution of .
- The first candidate has the higher support contribution, so it is favoured when the segment-level search compares the two.
- Interpretation: the score rewards candidates whose evidence is clearly strong, and the weight sets how much that matters against the generation probability.
Answer: the first candidate scores 0.30 on support and the second 0.10, so the first is kept.
Setting: a long-form answer task where every claim must carry a citation. The support weight is raised from 0.5 to 1.0 for this run, and the retrieval threshold is set to 0 so the model retrieves for every segment.
- Raising the support weight pushes the search toward candidates whose evidence supports them, which tends to raise citation precision.
- The same change can lower fluency, because the search prefers segments that carry citations even when a plainer sentence would read better.
- Lowering the threshold to 0 forces retrieval for every segment, so every segment has evidence to cite.
- Interpretation: the user chooses a point on the trade-off between precision and fluency, and between retrieval cost and factual coverage, without retraining the model.
Try it: with the support weight at 1.0 and a candidate whose support score is 0.8, what is the weighted support contribution? Answer: .
The math
Self-RAG uses two trained models. The critic predicts reflection tokens given the input and output. The generator predicts the output and the reflection tokens, given the input and retrieved passages.
Special tokens added to the vocabulary of the generator. Four types are used: a retrieval token (Yes, No, Continue), a relevance token (relevant, irrelevant), a support token (fully supported, partially supported, no support), and a usefulness token (1 to 5). A segment is written as text interleaved with these tokens.
Training the critic (offline, before generation)
The critic is initialised from a pretrained language model, here Llama 2 7B, and trained on data labelled by GPT-4. Given input , output and a reflection token , the objective is maximum likelihood on the labels:
Here is an average over the training pairs, and is the log of the probability the critic gives the correct token. Maximising it pushes the critic to predict the GPT-4 label.
Training the generator
The generator learns from a corpus that already contains passages and reflection tokens, produced offline by the retriever and the critic. It is trained with the ordinary next-token objective over the expanded vocabulary:
The retrieved passage text is masked out of the loss, so the model is not trained to reproduce passages; it is trained to write the answer and the tokens around them. Because the critic runs offline, no reward model is needed during generator training, which is the cost saving over PPO.
Scoring a segment (step 6 of the walkthrough)
For a critique type with possible values, the score of the most desirable value at segment is
The segment score combines the generation probability of the segment with these critique scores, each multiplied by its weight . The weights are settings that can be changed at inference time, which is how the model is steered without retraining.
Results
Setup. The generator is Llama 2 at 7B and 13B parameters. Training uses instruction-output data plus knowledge-intensive sources, and the critic is Llama 2 7B. Evaluation is zero-shot.
Tasks. The evaluation covers closed-set fact checking and reasoning, short-form question answering, and long-form generation. Long-form answers are scored on factuality, fluency and citation quality.
Against models without retrieval and against retrieval baselines. The paper reports that the 7B and 13B models outperform standard RAG systems and some larger models on factuality and citation metrics. It also reports that a proprietary retrieval-augmented model is still stronger on some tasks, so the claim is about open models at a smaller size, not a universal win. Read the exact numbers in the paper's tables rather than from this summary.
Ablations. The paper compares training without retrieval, training without critic tokens, and inference choices such as always using the top passages. Removing components lowers results, and using the top passages regardless of relevance hurts. This supports the claim that the critique tokens, not only the retrieval, carry much of the gain.
Limits. The model can still produce text that its citations do not fully support. The critic's labels come from GPT-4, so the critic inherits that model's errors. The evaluation covers a fixed set of tasks with a fixed retriever, so the results may not carry over to other retrievers or to open-ended chat.
Misreadings to avoid
It is tempting to think that Self-RAG is a bigger RAG system. In fact the model decides whether to retrieve at each segment, so a question it can answer alone triggers no retrieval.
It is tempting to think that the reflection tokens are a separate verifier that checks the answer afterwards. In fact the critic runs offline to label the training data, and the generator learns to write the tokens itself. At inference there is one model.
It is tempting to think that a reflection token makes the answer true. In fact the token reports what the model judges about the evidence. The model can still be wrong, as any generator can.
Use Self-RAG-style training when you need citations and control over retrieval cost, and when you can afford to label a training set with a stronger model. Do not use it as a way to avoid retrieval quality problems, because a poor retriever still gives poor evidence. A simpler alternative is standard RAG with a good reranker, which is cheaper to build and easier to debug.
Reading guide
Read the paper in this order, with the lessons it needs at each part:
- Introduction. Needs Retrieval-Augmented Generation for the baseline and Language Model for the setting.
- Related work. Needs Reinforcement Learning from Human Feedback (RLHF) and Proximal Policy Optimization (PPO) for the comparison with critic-based training, and Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks for the original RAG design.
- Method: reflection tokens and training. Needs Autoregressive Model for the next-token view of the reflection tokens, Cross-Entropy Loss for the training objective, and Reward Model for the critic analogy.
- Inference. Needs Beam Search for the segment-level search and Bi-Encoder for the retriever.
- Experiments. Needs Instruction Tuning for the training data and LLaMA: Open and Efficient Foundation Language Models for the base models.
- Results. Read the tables with the task definitions open.
Chain of ideas in this lesson: standard RAG retrieves blindly and cannot show its judgement; Self-RAG adds reflection tokens to the vocabulary; a critic labels a corpus offline; the generator learns to write the tokens; at inference, the model retrieves when it judges it needs to and scores its candidates with weights the user sets.
Check yourself
QuestionA segment's IsSup token has probabilities 0.5 for fully supported, 0.25 for partially and 0.25 for no support. What is the support score for the fully supported value?Show answer
The score is the probability of the desirable value divided by the sum over all values: .
QuestionThe retrieval threshold is 0.2. The normalised probability of the Yes token at some segment is 0.18. Does the model retrieve, and what changes if the threshold is raised to 0.3?Show answer
Since , the model does not retrieve at threshold 0.2. At threshold 0.3 it still does not retrieve, because . Raising the threshold makes retrieval rarer; lowering it makes retrieval more frequent.
QuestionWhy is the retrieved passage text masked out of the generator's training loss?Show answer
The passages are inputs the model should use, not text it should learn to produce. If the loss included them, the model would be trained to reproduce retrieved text, which would teach copying rather than answering and critiquing. Masking keeps the loss on the answer and the reflection tokens.
QuestionApplied scenario: a team wants a chatbot for policy questions that cites its sources. A reviewer notes that the model's citations sometimes do not support the claims. Using the paper's framework, what should the team check first?Show answer
The support token is the component designed to catch this. The team should check how well the critic's support labels agree with their own judgement on a sample, and whether the support weight at inference is high enough to favour supported candidates. They should also check the retriever, because a poor passage cannot support a correct claim. Self-RAG outputs can still be only partly supported, so a human review step is still needed.
Sources
- Asai, Wu, Wang, Sil, Hajishirzi (2023), Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection, arXiv:2310.11511. https://arxiv.org/abs/2310.11511