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

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

17 Oct 2023arXiv:2310.11511archive 2025-07-28

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

Despite their remarkable capabilities, large language models (LLMs) often produce responses containing factual inaccuracies due to their sole reliance on the parametric knowledge they encapsulate. Retrieval-Augmented Generation (RAG), an ad hoc approach that augments LMs with retrieval of relevant knowledge, decreases such issues. However, indiscriminately retrieving and incorporating a fixed number of retrieved passages, regardless of whether retrieval is necessary, or passages are relevant, diminishes LM versatility or can lead to unhelpful response generation. We introduce a new framework called Self-Reflective Retrieval-Augmented Generation (Self-RAG) that enhances an LM's quality and factuality through retrieval and self-reflection. Our framework trains a single arbitrary LM that adaptively retrieves passages on-demand, and generates and reflects on retrieved passages and its own generations using special tokens, called reflection tokens. Generating reflection tokens makes the LM controllable during the inference phase, enabling it to tailor its behavior to diverse task requirements. Experiments show that Self-RAG (7B and 13B parameters) significantly outperforms state-of-the-art LLMs and retrieval-augmented models on a diverse set of tasks. Specifically, Self-RAG outperforms ChatGPT and retrieval-augmented Llama2-chat on Open-domain QA, reasoning and fact verification tasks, and it shows significant gains in improving factuality and citation accuracy for long-form generations relative to these models.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 14 code samples: 12 from 3 repositories linked to this paper, 2 identical to code harvested from another paper's repository. Across all 14: 11 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 1 violated, 2 with no contract checked; 8 where Syntology's instrument failed) · 3 unverified. Where Syntology's instrument failed: 6 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 10 samples from 1 repository, 8 ran (3 with no instrument failure; 5 where Syntology's instrument failed); community (archive-listed): 2 samples from 2 repositories, 1 ran (0 with no instrument failure; 1 where Syntology's instrument failed); 2 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 1 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 2 of the 11 samples that ran have no recorded date.

AkariAsai/self-rag officialmentioned on GitHubpytorchMITSyntology: 10 samples, 8 ran (5 instrument-failed) · 2 unverified report
ShayekhBinIslam/openrag mentioned on GitHubpytorchSyntology: 1 sample, 0 ran · 1 unverified report
fate-ubw/raglab mentioned on GitHubpytorchSyntology: 1 sample, 1 ran (1 instrument-failed) · 0 unverified report
kaistai/semiparametric_token-sequence_co-supervision mentioned on GitHubpytorchSyntology: not harvested report
llm-lab-org/CLASP mentioned on GitHubMITSyntology: not harvested report
ruc-nlpir/flashrag mentioned on GitHubpytorchMITSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Augmentation-Adapted Retriever Improves Generalization of Language Models as Generic Plug-In (arXiv:2305.17331; that paper's own run record: 9 ran (of which 1 constructed an object rather than computing a result; 8 with no instrument failure: 0 honoured, 1 violated, 7 with no contract checked; 1 where Syntology's instrument failed) · 2 unverified); nothing checks that they implement this paper's method. report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

14 samples harvested: 11 ran (of which 0 constructed an object rather than computing a result; 3 with no instrument failure: 0 honoured, 1 violated, 2 with no contract checked; 8 where Syntology's instrument failed) · 3 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · violated contract
6ran · our draft was wrong
2ran; the contract check could not run
2ran
3unverified

Licence: 6 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. For 3 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. 2 samples are listed last, in a group without a repository. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

AkariAsai/self-rag official repository 10 samples, 8 ran (5 instrument-failed) · 2 unverified
accuracy in 872 papers
census: 8 implementations from 7 papers, 7 distinct outputs across 6 buckets, one shared input per bucket
retrieval_lm/metrics.py ran; the contract check could not run (RAISES) MIT (permissive) here; the stored copy is pointer only · e76cf27d36723be3 · report fixture: signature preds:list/1/int, labels:list/1/list · returned float · level recorded 2026-09-25
encode_with_messages_format in 21 papers retrieval_lm/finetune.py ran · our draft was wrong MIT (permissive) · 1cb0eeb16cf04ee3 · report fixture: signature example:dict/0/?, tokenizer:callable/0/?, max_seq_length:int/0/int · returned dict · level recorded 2026-09-22
exact_match_score in 82 papers retrieval_lm/metrics.py ran · violated contract fingerprinted MIT (permissive) here; the stored copy is pointer only · d97ab73d08dfa3b9 · report fixture: signature prediction:str/0/str, ground_truth:str/0/str · returned bool · level recorded 2026-09-25
jload in 59 papers data_creation/train_special_tokens.py ran MIT (permissive) · 3ca38f9acc00194b · report fixture: signature f:str/0/str, mode:str/0/str · returned dict · level recorded 2026-09-24
load_data in 700 papers retrieval_lm/passage_retrieval.py ran · our draft was wrong MIT (permissive) · 0c3de3890cd0b382 · report fixture: signature data_path:str/0/str · returned list · level recorded 2026-09-22
metric_max_over_ground_truths in 12 papers retrieval_lm/metrics.py ran · our draft was wrong MIT (permissive) · 6829ceb72569fa12 · report fixture: signature metric_fn:callable/0/?, prediction:Tensor/1/float, ground_truths:list/1/Tensor · returned float · level recorded 2026-09-22
preprocess in 284 papers
census: 11 implementations from 13 papers, 10 distinct outputs across 5 buckets, one shared input per bucket
data_creation/train_special_tokens.py ran MIT (permissive) · 342f5e0ec01b9ed8 · report fixture: signature sources:list/1/str, targets:list/1/str, tokenizer:callable/0/?, skip_tokens:list/1/int, context_markups:list/1/int · returned dict · level recorded 2026-09-24
randomcrop in 8 papers retrieval_lm/src/data.py ran · our draft was wrong fingerprinted MIT (permissive) here; the stored copy is pointer only · e037474365501512 · report fixture: signature x:Tensor/2/float, ratio_min:float/0/float, ratio_max:float/0/float · returned Tensor · level recorded 2026-09-25
encode_with_prompt_completion_format in 25 papers retrieval_lm/finetune.py unverified MIT (permissive) · aac14d7de4178849 · report
make_supervised_data_module in 15 papers data_creation/train_special_tokens.py unverified MIT (permissive) · c22fc64f9f9730e4 · report
ShayekhBinIslam/openrag community (archive-listed) 1 sample, 0 ran · 1 unverified
load_balancing_loss_func in 24 papers openrag/modeling_openrag.py unverified CC-BY-4.0 · pointer only · d9308d9bf18cd072 · report
fate-ubw/raglab community (archive-listed) 1 sample, 1 ran (1 instrument-failed) · 0 unverified
read_jsonl in 136 papers raglab/rag/train_alg/finetune.py ran · our draft was wrong MIT (permissive) · 6242dd60b264c96f · report fixture: signature file_path:str/0/str · returned list · level recorded 2026-09-22
Repository not located 2 samples, 2 ran (2 instrument-failed) · 0 unverified
2 samples are identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
apply_rotary_pos_emb in 393 papers
census: 14 implementations from 15 papers, 8 distinct outputs across 7 buckets, one shared input per bucket
repository not located ran; the contract check could not run (RAISES) · metamorphic tier: invariant licence of this copy not recorded · f725bc2d76076485 · report fixture: signature q:Tensor/3/float, k:Tensor/3/float, cos:Tensor/4/float, sin:Tensor/4/float, position_ids:Tensor/2/int · returned tuple · level recorded, date not recorded
rotate_half in 424 papers
census: 24 implementations from 96 papers, 4 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 1 of 2, arg 1: rank 2, kind float, dtype float32
repository not located ran · our draft was wrong fingerprinted licence of this copy not recorded · b99eea6376d1e212 · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded, date not recorded

Tasks

Fact VerificationQuestion AnsweringRAGResponse GenerationRetrievalRetrieval-augmented Generation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Question Answering PopQA SelfRAG-7b Accuracy 54.9 #1 of 2 Archive leaderboard report
Question Answering PopQA SelfRAG-13b Accuracy 55.8 #2 of 2 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

HOCSET

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections