# RAG survey: three paradigms, four abilities, and a recount of the paper's tables

> Gao et al.'s survey sorts retrieval-augmented generation into Naive, Advanced and Modular RAG. This page recounts its Tables I and II, flags two entries that disagree with the original papers, and reruns RGB's four abilities on 50 fictional companies.

- URL: https://dmxsf.com/en/blog/rag-survey/
- [DMXSF](https://dmxsf.com/en/about/)
- Published: 2023-12-28
- Updated: 2026-11-13
- Paper notes
- Paper: [Retrieval-Augmented Generation for Large Language Models: A Survey](https://arxiv.org/abs/2312.10997) (Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, et al. · arXiv, 2023)

"Retrieval-Augmented Generation for Large Language Models: A Survey" (Yunfan Gao et al., Tongji University and Fudan University, arXiv 2312.10997, the survey below) organizes retrieval-augmented generation (RAG) in the era of large language models. It sorts the field into three paradigms: **Naive RAG** (one pass through indexing, retrieval and generation), **Advanced RAG** (an extra layer of optimization before and after retrieval) and **Modular RAG** (replaceable modules, flows that can loop). It then walks through the techniques by stage (retrieval, generation, augmentation) and closes with evaluation and open problems. This page reads v5 of 27 March 2024; v1 appeared on 18 December 2023.

Two things are done here instead of retelling it. **Recount**: the survey's Table I (71 methods, five attributes each) and Table II (26 sub-tasks, 48 datasets) are copied into code, counted, and compared with claims in the text. Most claims hold: 63 of 71 rows include text as a data type, and 47 rows (66%) retrieve only once. But Figure 1's story, that work started at the inference stage and later combined more with fine-tuning, cannot be seen in Table I; the labels in Table I are not written consistently; and two entries disagree with the original papers: FLARE is labeled Tuning although its paper says it applies at inference time with no extra training, and StrategyQA sits under language modeling although the FLARE paper calls it commonsense reasoning. **Replicate**: following the four abilities the survey takes from the RGB benchmark (noise robustness, negative rejection, information integration, counterfactual robustness), a scaled-down version of RGB's design is run on 50 fictional companies and three small models: Qwen2.5-0.5B-Instruct, Qwen2.5-1.5B-Instruct and Qwen3-4B. None of them can answer a question about these companies closed-book, so every correct answer comes from a document. The most harmful noise is the sibling firm whose name differs by one letter (with only 1 of 5 documents correct, the 0.5B model falls from 100.0% to 68.0%); rejection separates the models most (with sibling-firm noise they refuse 0.0%, 13.0% and 94.0% of the time); splitting two facts over two documents costs 4 to 8 points, and adding three sibling-noise documents on top brings integration down to 18.0%, 75.0% and 90.0%; and in the counterfactual test a one-sentence warning only moves Qwen3-4B (it follows the wrong documents in 100.0% of cases without the warning, 32.0% with it). It is a scaled-down design, not used to confirm or refute RGB's conclusions.

## Why read this survey, and where its limits are

- **It is a map.** Table I files 71 methods under five attributes (retrieval source, data type, granularity, augmentation stage, retrieval process); Table II lists the datasets of 26 sub-tasks; Table IV lists benchmarks and tools (RGB, RECALL, CRUD, and RAGAS, ARES, TruLens). To see where a method sits in the RAG landscape, this is the quickest place to look.
- **It gives you coordinates.** Naive / Advanced / Modular, iterative / recursive / adaptive, retrieval quality versus generation quality, and the four abilities. When you read another RAG paper, these words help to place it.
- **It is a survey with no experiments of its own.** The numbers in it are quoted from other papers, so this page does not repeat its conclusions; it checks its tables and runs a small evaluation of its own.
- **It has a date.** v1 is from December 2023 and v5 from March 2024. On long context it says models can already handle more than 200,000 tokens, and on scaling laws of RAG it says their applicability is uncertain. Later methods are not in its tables.
- **The name is older.** Lewis et al. (2020), [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401), connected a pre-trained seq2seq model (parametric memory) to a dense vector index of Wikipedia (non-parametric memory) through a pre-trained neural retriever, and compared one form that shares the retrieved passages across the whole output with another that can use different passages per token. This survey is about what came after large language models arrived.
- **Next door on this site.** For implementation and code, see [RAG in practice](https://dmxsf.com/en/wiki/applications/rag/); for where the evidence sits in the context, [Lost in the Middle](https://dmxsf.com/en/blog/lost-in-the-middle/); and "the model decides when to retrieve" is of a piece with the tool use in [ReAct](https://dmxsf.com/en/blog/react-reasoning-and-acting/) and [Toolformer](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/).

## Three paradigms

*Figure: The three paradigms side by side (redrawn from Figure 3 and Section II of the survey, not the original figure). Colors: blue = data and index, green = retrieval, amber = optimization around retrieval, purple = generation.*

| Paradigm | Flow | Change from the previous one |
| --- | --- | --- |
| Naive RAG | Indexing (clean, chunk, embed, store) → retrieval (the same encoder fetches the top-k most similar chunks) → generation (query and chunks in one prompt) | The earliest recipe, also called the Retrieve-Read framework |
| Advanced RAG | Still the same chain | Before retrieval: better indexing (sliding windows, finer segmentation, metadata) and better queries (rewriting, expansion); after retrieval: reranking and context compression |
| Modular RAG | Replaceable, re-orderable modules; loops allowed | New modules (search, RAG-Fusion, memory, routing, predict, task adapter) and new patterns (Rewrite-Retrieve-Read, Generate-Read, Recite-Read, DSP, ITER-RETGEN, FLARE, Self-RAG) |

The survey sorts the weaknesses of Naive RAG into three groups. **Retrieval**: precision and recall are limited, so misaligned chunks are fetched and key information is missed. **Generation**: the model can still say things the retrieved content does not support, and its output may be irrelevant, toxic or biased. **Augmentation**: merging retrieved content into the task can be disjointed or repetitive, a single retrieval may not be enough for a complex question, and the model may simply echo what it was given. Advanced and Modular RAG respond to these shortcomings.

The six new modules of Modular RAG:

| Module | What it does | Example in the survey |
| --- | --- | --- |
| Search | Query search engines, databases and knowledge graphs directly, with code and query languages written by the LLM | — |
| RAG-Fusion | Expand the query into several perspectives, search them in parallel, then rerank | RAG-Fusion |
| Memory | Let the model's own memory guide retrieval, improving the fit to the data distribution by iterative self-enhancement | Self-Mem |
| Routing | Pick the data source and path for each query: summarize, query a specific database, or merge several streams | — |
| Predict | Have the LLM generate the context directly, cutting redundancy and noise | Generate-Read |
| Task adapter | Retrieve prompts automatically for zero-shot inputs, and build task-specific retrievers from few-shot query generation | UPRISE, PROMPTAGATOR |

### RAG, fine-tuning and prompt engineering

The survey compares three ways to improve an LLM on a quadrant chart with two axes: how much external knowledge is needed and how much model adaptation. Prompt engineering needs little of either. RAG is like handing the model a tailored textbook, good for precise information retrieval; fine-tuning is like a student internalizing knowledge over time, good for reproducing a specific structure, style or format.

| Aspect | RAG | Fine-tuning |
| --- | --- | --- |
| Knowledge | Real-time updates, makes good use of external sources, highly interpretable | More static, needs retraining to update |
| Cost | Higher latency, ethical considerations around the retrieved data | Heavy compute for data preparation and training; can reduce hallucination, but struggles with unfamiliar data |

Fine-tuning also allows deep customization of the model's behavior and style. The survey cites a comparison by Ovadia et al. (arXiv 2312.05934): unsupervised fine-tuning helps somewhat, but RAG is consistently better, both for knowledge seen in training and for entirely new knowledge, and models find it hard to learn new facts through unsupervised fine-tuning. The conclusion is not either-or: the two complement each other at different levels, sometimes work best together, and may need several rounds of iteration.

## Retrieval: what to fetch and how

| Stage | Problem | Methods (examples from the survey) |
| --- | --- | --- |
| Source and granularity | What to fetch, in what unit | Text, semi-structured data (PDF), knowledge graphs, content generated by the LLM itself; units from token, phrase, sentence, proposition and chunk to whole document, and entity, triplet and sub-graph on knowledge graphs |
| Chunking | Big chunks add noise, small ones lose context | Fixed token counts (for example 100, 256, 512); recursive splits and sliding windows; Small2Big: retrieve by sentence, give the model the neighboring sentences too |
| Metadata and index structure | Narrow the search and keep it fresh | Filtering by page, file name, author, category, timestamp; weighting by time; adding summaries or hypothetical questions to chunks (Reverse HyDE); parent-child hierarchy; knowledge-graph index (KGP) |
| Query optimization | The original query is vague or several questions in one | Expansion (Multi-Query, Sub-Query, CoVe); transformation (rewriting, RRR, Taobao's BEQUE, HyDE, Step-back); routing (metadata router, semantic router) |
| Embedding | Does the representation fit the domain | Sparse (BM25) and dense (BERT-style) retrieval, and their mixture; fine-tuning the embedding model on domain data; supervising the retriever with LLM feedback (LSR, LLM-Embedder, REPLUG) |
| Adapter | How to align when the retriever or model cannot be fine-tuned | UPRISE (prompt retriever), AAR, PRCA, BGM (a bridge Seq2Seq model between a fixed retriever and the LLM), PKG |

There is no standard answer on granularity: coarse units can in theory bring more relevant information but also redundancy that may distract the retriever and the model; fine units add retrieval burden and do not guarantee semantic completeness. The proposition the survey mentions (introduced by DenseX) is an atomic factual statement in the text, self-contained and concise. Embedding models are the same story: the MTEB leaderboard the survey cites covers 8 task types and 58 datasets, the Chinese C-MTEB covers 6 task types and 35 datasets, and the conclusion is that no single model fits every case. The [RAG page](https://dmxsf.com/en/wiki/applications/rag/) of this site runs chunking, hybrid retrieval and reranking on one small corpus, so it can be read side by side with this section.

## Generation: what to do with what was retrieved

The first sentence of this section says that feeding everything retrieved straight to the LLM is not good practice. The survey then adjusts two things: the retrieved content, and the model.

**Adjusting the retrieved content** (context curation):

- **Reranking.** Put the most relevant chunks first; it acts as both enhancer and filter. It can be rule-based (diversity, relevance, MRR), done by BERT-series models (such as SpanBERT) or dedicated rerankers (Cohere rerank, bge-reranker-large), or by a general LLM such as GPT. The survey also cites "lost in the middle": models tend to focus on the beginning and end of a long text, so the most relevant content is moved to the edges of the prompt (see the [Lost in the Middle walkthrough](https://dmxsf.com/en/blog/lost-in-the-middle/)).
- **Selection and compression.** The misconception is that more retrieved material is always better; the more noise in the context, the harder it is for the model to notice what matters. Methods: LLMLingua uses a small model such as GPT-2 Small or LLaMA-7B to delete unimportant tokens, PRCA trains an information extractor, RECOMP trains a condenser with contrastive learning, and Filter-Reranker lets a small model filter and a large model rerank.

**Adjusting the model** (fine-tuning): add domain knowledge; adapt input and output formats and style; use SANTA's three-stage training for structured data; align outputs to human or retriever preferences with reinforcement learning; when a strong model is not available, distill a stronger one (such as GPT-4); coordinate with retriever fine-tuning, as RA-DIT does by aligning the scoring functions of retriever and generator with a KL divergence.

## Augmentation: how many retrievals, and when

The standard practice is to retrieve once and then generate; for questions that need multi-step reasoning the survey notes that one retrieval gives a limited scope of information. It lists three processes beyond "once":

| Process | How | Examples | Problem noted by the survey |
| --- | --- | --- | --- |
| Iterative | Retrieve repeatedly from the initial query and the text generated so far, alternating retrieval and generation | ITER-RETGEN | Semantic discontinuity, accumulating irrelevant information |
| Recursive | Refine the query from the previous round, split it into sub-questions, and converge on the most relevant information | IRCoT (chain of thought guides retrieval, retrieved results refine the chain), ToC (clarification tree) | |
| Adaptive | The model decides whether to retrieve and when to stop | FLARE (retrieve when generation probability falls below a threshold), Self-RAG (two kinds of reflection tokens, "retrieve" and "critic"), WebGPT | |

Recursive retrieval can work with a structured index too: summarize sections of a document, retrieve by the summary, then retrieve again inside the document; multi-hop retrieval targets graph-structured sources. The adaptive methods belong to the same trend as Toolformer and AutoGPT, where the model uses tools on its own initiative.

## Evaluation: three quality scores and four abilities

**Tasks.** The core task of RAG is still question answering (single-hop and multi-hop, multiple choice, domain-specific, long-form), extended to information extraction, dialogue generation, code search and others. Traditional evaluation uses each task's own metrics: EM and F1 for QA, accuracy for fact checking, BLEU and ROUGE for generated text.

**Two targets.** Retrieval quality borrows metrics from search and recommendation (hit rate, MRR, NDCG). Generation quality looks at faithfulness, relevance and non-harmfulness for unlabeled content, and at accuracy for labeled content.

**Three quality scores**: context relevance (is the retrieved content precise, with nothing extra), answer faithfulness (does the answer stay true to the retrieved context, without contradicting it) and answer relevance (does the answer address the question).

**Four abilities** (from the RGB and RECALL benchmarks):

| Ability | Meaning |
| --- | --- |
| Noise robustness | Still answer correctly when the retrieved documents include noise: related to the question but with no answer |
| Negative rejection | Decline to answer when the retrieved documents do not contain the needed knowledge |
| Information integration | Combine an answer that is spread over several documents |
| Counterfactual robustness | Recognize known errors in the documents and not be misled, even when the instruction already warns about them |

Table IV of the survey splits evaluation frameworks into benchmarks and tools. RGB (the four abilities; metrics accuracy and EM), RECALL (counterfactual robustness; metric R-Rate, the reappearance rate) and CRUD (creative generation, knowledge-intensive QA, error correction, summarization; BLEU, ROUGE-L, BertScore, RAGQuestEval) are benchmarks; RAGAS, ARES and TruLens are tools that use an LLM to score the three quality scores. The survey itself adds that the metrics in Table III are traditional ones borrowed from related work and "do not yet represent a mature or standardized approach".

## A few judgments from the discussion section

- **RAG versus long context.** When the survey was written, models could already handle more than 200,000 tokens, which raised the question of whether RAG is still needed. Its answer is that RAG remains irreplaceable, for two reasons. Putting a large context in at once slows inference noticeably, while chunked retrieval and on-demand input make it much more efficient; and RAG-based generation can quickly point to the original references so users can verify the answer, the retrieval and reasoning process is observable, while generation from long context alone is a black box. In the other direction, longer contexts open new opportunities for RAG, such as integrative questions that need a large amount of material. Neither reason depends on how large the window is; the cost side is worked out in [Long context](https://dmxsf.com/en/wiki/architecture/long-context/).
- **Robustness.** The survey quotes "Misinformation can be worse than no information at all" and relays a finding of Cuconasu et al. (The Power of Noise, arXiv 2401.14887): including irrelevant documents can raise accuracy by more than 30%. Checked against the paper, that sentence needs care. The paper separates three kinds of documents: **random** documents (unrelated to the question) raise accuracy by up to 35% when added to the prompt, whereas **distracting** documents (related to the question but without the answer) lower it, and a single one costs up to 0.24 (25%). The survey's "irrelevant" merges the two.
- **Hybrid approaches.** Combining RAG with fine-tuning is a leading trend, and whether to do it sequentially, alternately or with joint end-to-end training is open; another trend adds small models with a specific function to RAG, for example CRAG trains a lightweight retrieval evaluator that triggers different retrieval actions according to confidence.
- **Scaling laws of RAG.** Scaling laws exist for LLMs, but whether they apply to RAG is uncertain; RAG models still lag behind LLMs in parameter count, and the survey lists an inverse scaling law (smaller models doing better) as an intriguing possibility.
- **Production.** Retrieval efficiency, recall in large knowledge bases and data security (for example, a model leaking document sources or metadata) are open engineering problems; LangChain and LlamaIndex became popular first, Flowise AI, HayStack, Meltano and Cohere Coral each have a focus, and traditional software and cloud vendors (Weaviate's Verba, Amazon's Kendra) are offering RAG services.
- **Multimodal.** RAG has spread to images (RA-CM3 and others), audio and video, code and knowledge graphs.

## Recount: Table I and Table II

The script calls no model and only counts. It treats the survey's Table I (71 rows) and Table II (26 rows, one per sub-task, with its datasets and methods) as data copied in following the PDF layout: text first extracted with `pdftotext -layout`, then checked row by row against the rendered PDF pages (Table I is on page 6, Table II on page 13). Five parts, in the order of the output: what Table I is made of, claims in the text against Table I, whether the labels are consistent, Table II and how it cross-checks with Table I, and two entries that disagree with the source papers. Environment: Python 3.14.3, standard library only. Labels are copied as printed, typos included; the "year" is the one printed in the survey's bibliography entry (Table I has no such column; for example the entry for CoG prints 2022).

<details>
<summary>Full code (about 240 lines)</summary>

```python
"""Recheck the RAG survey (arXiv v5, 27 Mar 2024): treat
Tables I and II as data, count them, and compare with the claims in the text"""
import re
import textwrap
from collections import Counter

# Table I (71 rows); fields: method, reference number, year in the
# survey's own bibliography, retrieval source, data type, granularity,
# stage, process. Labels are copied as printed, typos included; the year is
# mine, taken from the survey's bibliography (Table I has no such column).
T1 = """\
CoG|29|2022|Wikipedia|Text|Phrase|Pre-training|Iterative
DenseX|30|2023|FactoidWiki|Text|Proposition|Inference|Once
EAR|31|2023|Dataset-base|Text|Sentence|Tuning|Once
UPRISE|20|2023|Dataset-base|Text|Sentence|Tuning|Once
RAST|32|2023|Dataset-base|Text|Sentence|Tuning|Once
Self-Mem|17|2023|Dataset-base|Text|Sentence|Tuning|Iterative
FLARE|24|2023|Search Engine,Wikipedia|Text|Sentence|Tuning|Adaptive
PGRA|33|2023|Wikipedia|Text|Sentence|Inference|Once
FILCO|34|2023|Wikipedia|Text|Sentence|Inference|Once
RADA|35|2024|Dataset-base|Text|Sentence|Inference|Once
Filter-rerank|36|2023|Synthesized dataset|Text|Sentence|Inference|Once
R-GQA|37|2022|Dataset-base|Text|Sentence Pair|Tuning|Once
LLM-R|38|2023|Dataset-base|Text|Sentence Pair|Inference|Iterative
TIGER|39|2023|Dataset-base|Text|Item-base|Pre-training|Once
LM-Indexer|40|2023|Dataset-base|Text|Item-base|Tuning|Once
BEQUE|9|2023|Dataset-base|Text|Item-base|Tuning|Once
CT-RAG|41|2023|Synthesized dataset|Text|Item-base|Tuning|Once
Atlas|42|2022|Wikipedia, Common Crawl|Text|Chunk|Pre-training|Iterative
RAVEN|43|2023|Wikipedia|Text|Chunk|Pre-training|Once
RETRO++|44|2023|Pre-training Corpus|Text|Chunk|Pre-training|Iterative
INSTRUCTRETRO|45|2023|Pre-training corpus|Text|Chunk|Pre-training|Iterative
RRR|7|2023|Search Engine|Text|Chunk|Tuning|Once
RA-e2e|46|2023|Dataset-base|Text|Chunk|Tuning|Once
PROMPTAGATOR|21|2022|BEIR|Text|Chunk|Tuning|Once
AAR|47|2023|MSMARCO,Wikipedia|Text|Chunk|Tuning|Once
RA-DIT|27|2023|Common Crawl,Wikipedia|Text|Chunk|Tuning|Once
RAG-Robust|48|2023|Wikipedia|Text|Chunk|Tuning|Once
RA-Long-Form|49|2023|Dataset-base|Text|Chunk|Tuning|Once
CoN|50|2023|Wikipedia|Text|Chunk|Tuning|Once
Self-RAG|25|2023|Wikipedia|Text|Chunk|Tuning|Adaptive
BGM|26|2024|Wikipedia|Text|Chunk|Inference|Once
CoQ|51|2023|Wikipedia|Text|Chunk|Inference|Iterative
Token-Elimination|52|2023|Wikipedia|Text|Chunk|Inference|Once
PaperQA|53|2023|Arxiv,Online Database,PubMed|Text|Chunk|Inference|Iterative
NoiseRAG|54|2024|FactoidWiki|Text|Chunk|Inference|Once
IAG|55|2023|Search Engine,Wikipedia|Text|Chunk|Inference|Once
NoMIRACL|56|2023|Wikipedia|Text|Chunk|Inference|Once
ToC|57|2023|Search Engine,Wikipedia|Text|Chunk|Inference|Recursive
SKR|58|2023|Dataset-base,Wikipedia|Text|Chunk|Inference|Adaptive
ITRG|59|2023|Wikipedia|Text|Chunk|Inference|Iterative
RAG-LongContext|60|2023|Dataset-base|Text|Chunk|Inference|Once
ITER-RETGEN|14|2023|Wikipedia|Text|Chunk|Inference|Iterative
IRCoT|61|2022|Wikipedia|Text|Chunk|Inference|Recursive
LLM-Knowledge-Boundary|62|2023|Wikipedia|Text|Chunk|Inference|Once
RAPTOR|63|2024|Dataset-base|Text|Chunk|Inference|Recursive
RECITE|22|2022|LLMs|Text|Chunk|Inference|Once
ICRALM|64|2023|Pile,Wikipedia|Text|Chunk|Inference|Iterative
Retrieve-and-Sample|65|2023|Dataset-base|Text|Doc|Tuning|Once
Zemi|66|2022|C4|Text|Doc|Tuning|Once
CRAG|67|2024|Arxiv|Text|Doc|Inference|Once
1-PAGER|68|2023|Wikipedia|Text|Doc|Inference|Iterative
PRCA|69|2023|Dataset-base|Text|Doc|Inference|Once
QLM-Doc-ranking|70|2023|Dataset-base|Text|Doc|Inference|Once
Recomp|71|2023|Wikipedia|Text|Doc|Inference|Once
DSP|23|2022|Wikipedia|Text|Doc|Inference|Iterative
RePLUG|72|2023|Pile|Text|Doc|Inference|Once
ARM-RAG|73|2023|Dataset-base|Text|Doc|Inference|Iterative
GenRead|13|2022|LLMs|Text|Doc|Inference|Iterative
UniMS-RAG|74|2024|Dataset-base|Text|Multi|Tuning|Once
CREA-ICL|19|2023|Dataset-base|Crosslingual,Text|Sentence|Inference|Once
PKG|75|2023|LLM|Tabular,Text|Chunk|Inference|Once
SANTA|76|2023|Dataset-base|Code,Text|Item|Pre-training|Once
SURGE|77|2023|Freebase|KG|Sub-Graph|Tuning|Once
MK-ToD|78|2023|Dataset-base|KG|Entity|Tuning|Once
Dual-Feedback-ToD|79|2023|Dataset-base|KG|Entity Sequence|Tuning|Once
KnowledGPT|15|2023|Dataset-base|KG|Triplet|Inference|Muti-time
FABULA|80|2023|Dataset-base,Graph|KG|Entity|Inference|Once
HyKGE|81|2023|CMeKG|KG|Entity|Inference|Once
KALMV|82|2023|Wikipedia|KG|Triplet|Inference|Iterative
RoG|83|2023|Freebase|KG|Triplet|Inference|Iterative
G-Retriever|84|2024|Dataset-base|TextGraph|Sub-Graph|Inference|Once
"""
# Table II: task, sub-task, datasets (datasets separated by semicolons)
T2 = """\
QA|Single-hop|NQ;TQA;SQuAD;WebQ;PopQA;MS MARCO
QA|Multi-hop|HotpotQA;2WikiMultiHopQA;MuSiQue
QA|Long-form QA|ELI5;NarrativeQA;ASQA;QMSum
QA|Domain QA|Qasper;COVID-QA;CMB;MMCU Medical
QA|Multi-Choice QA|QuALITY;ARC;CommonsenseQA
QA|Graph QA|GraphQA
Dialog|Dialog Generation|WoW
Dialog|Personal Dialog|KBP;DuleMon
Dialog|Task-oriented Dialog|CamRest
Dialog|Recommendation|Amazon(Toys,Sport,Beauty)
IE|Event Argument Extraction|WikiEvent;RAMS
IE|Relation Extraction|T-REx;ZsRE
Reasoning|Commonsense Reasoning|HellaSwag
Reasoning|CoT Reasoning|CoT Reasoning
Reasoning|Complex Reasoning|CSQA
Others|Language Understanding|MMLU
Others|Language Modeling|WikiText-103;StrategyQA
Others|Fact Checking/Verification|FEVER;PubHealth
Others|Text Generation|Biography
Others|Text Summarization|WikiASP;XSum
Others|Text Classification|VioLens;TREC
Others|Sentiment|SST-2
Others|Code Search|CodeSearchNet
Others|Robustness Evaluation|NoMIRACL
Others|Math|GSM8K
Others|Machine Translation|JRC-Acquis
"""
# every reference number in the Method column of Table II
T2_METHODS = [
    3, 4, 5, 7, 13, 14, 17, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
    32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50,
    51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 71,
    72, 73, 74, 76, 78, 79, 81, 82, 84, 91, 112, 123, 135]

rows = [r.split("|") for r in T1.split("\n") if r]
NAME, REF, YEAR, SRC, KIND, GRAN, STAGE, PROC = range(8)
N = len(rows)
assert N == 71 and all(len(r) == 8 for r in rows)

def pad(s, width):
    """pad to a display width (CJK counts two)"""
    return s + " " * (width - sum(2 if ord(c) > 0x2e80 else 1 for c in s))

def wrap(label, items):
    lines = textwrap.wrap("; ".join(items), width=62)
    head = "   " + pad(label, 13)
    return "\n".join((head if i == 0 else " " * 16) + x
                     for i, x in enumerate(lines))

def count(col, split=False):
    vals = [x.strip() for r in rows for x in
            (r[col].split(",") if split else [r[col]])]
    return Counter(vals)

def show(c, total=N):
    return [f"{k} {v} ({v / total:.0%})" for k, v in c.most_common()]

print(f"1. Table I: {N} methods, five attributes each")
for label, col in (("stage", STAGE), ("process", PROC),
                   ("data type", KIND), ("granularity", GRAN),
                   ("source", SRC)):
    print(wrap(label, show(count(col, split=col in (SRC, KIND)))))

print("\n2. Claims in the text, against Table I")
text = [r for r in rows if "Text" in r[KIND]]
pure = [r for r in rows if r[KIND] == "Text"]
tn, pn = len(text), len(pure)
print(f"   (a) text is the mainstream source -> {tn}/{N} rows "
       f"({tn / N:.0%}) include Text, {pn} are Text only")
pdf = [r[NAME] for r in rows if any(re.search("pdf|semi", x, re.I) for x in r)]
tab = [r[NAME] for r in rows if r[KIND] == "Tabular,Text"]
print(f"   (b) expanded to semi-structured data (PDF) -> {len(pdf)} rows say "
       f"PDF or semi;\n       the closest, Tabular,Text, has {len(tab)} "
       f"({', '.join(tab)})")
g = count(GRAN)
tg = ("Token", "Phrase", "Sentence", "Proposition", "Chunk", "Doc")
print("   (c) text granularities the text lists -> rows in Table I:\n       "
      + ", ".join(f"{k} {g[k]}" for k in tg))
print("       and for knowledge graphs: "
      + ", ".join(f"{k} {g[k]}" for k in ("Entity", "Triplet", "Sub-Graph")))
once = count(PROC)["Once"]
print(f"   (d) the standard practice is a single retrieval -> Once {once} "
       f"rows ({once / N:.0%}), multi-step {N - once} rows")
llm = [(r[NAME], r[YEAR]) for r in rows if re.search(r"\bLLMs?\b", r[SRC])]
print(f"   (e) a growing trend of LLM-generated content -> {len(llm)} rows: "
       + ", ".join(f"{a} ({y})" for a, y in llm))
years = sorted({r[YEAR] for r in rows})
by = {y: [r for r in rows if r[YEAR] == y] for y in years}
print("   (f) Figure 1: first the inference stage, later gradually more "
       "fine-tuning. Table I by year:")
print(" " * 17 + "".join(f"{y} (n={len(by[y])})".rjust(15) for y in years))
for st in ("Inference", "Tuning", "Pre-training"):
    cells = [sum(r[STAGE] == st for r in by[y]) for y in years]
    print("   " + pad(st, 14) + "".join(
        f"{c} ({c / len(by[y]):.0%})".rjust(15) for c, y in zip(cells, years)))

print("\n3. Are the labels consistent")

def norm(s):
    return re.sub(r"[^a-z0-9]", "", s.lower()).rstrip("s")

same, prefix = [], []
for col, name in ((SRC, "source"), (KIND, "data type"),
                  (GRAN, "granularity"), (PROC, "process")):
    c = count(col, split=True)
    labs = sorted(c)
    for i, a in enumerate(labs):
        for b in labs[i + 1:]:
            pair = f"{a} / {b} ({name} {c[a]}+{c[b]})"
            if norm(a) == norm(b):
                same.append(pair)
            elif norm(a).startswith(norm(b)) or norm(b).startswith(norm(a)):
                prefix.append(pair)
single = [f"{k} ({', '.join(r[NAME] for r in rows if r[PROC] == k)})"
          for k, v in count(PROC).items() if v == 1]
print(wrap("same word", same))
print(wrap("prefix pair", prefix))
print(wrap("used once", single))

print("\n4. Table II, and Table II against Table I")
sets = [(t, s, d.split(";")) for t, s, d in (r.split("|") for r in
                                            T2.split("\n") if r)]
data = {x for _, _, ds in sets for x in ds}
print(f"   (a) the text says \"covering 26 tasks, nearly 50 datasets\" -> "
       f"{len(sets)} sub-tasks,\n       {len(data)} datasets ({len(data) + 2} "
       f"if the three Amazon categories are counted apart)")
per = Counter()
for t, _, ds in sets:
    per[t] += len(ds)
print(wrap("per task", show(per, len(data))))
m2 = set(T2_METHODS)
t1 = {int(r[REF]): r[NAME] for r in rows}
both = len(m2 & set(t1))
print(f"   (b) the Method column of Table II cites {len(m2)} references, "
       f"{both} of them methods listed in Table I")
print("       cited by Table II, absent from Table I: "
      + ", ".join(map(str, sorted(m2 - set(t1)))))
print(wrap("only in I", [t1[k] for k in sorted(set(t1) - m2)]))

print("\n5. Two entries that disagree with the source papers")
flare = next(r for r in rows if r[NAME] == "FLARE")
print(f"   FLARE: Table I gives the stage {flare[STAGE]}; its paper says:")
print('     "FLARE is applicable to any existing LMs at inference time')
print('     without additional training."')
lm = next(ds for _, s, ds in sets if s == "Language Modeling")
print(f"   StrategyQA: Table II lists it with {lm[0]} under Language "
       "Modeling;\n   the FLARE paper says:")
print('     "commonsense reasoning (StrategyQA)"')
```

</details>

### What Table I is made of

```text
1. Table I: 71 methods, five attributes each
   stage        Inference 40 (56%); Tuning 24 (34%); Pre-training 7 (10%)
   process      Once 47 (66%); Iterative 17 (24%); Adaptive 3 (4%); Recursive
                3 (4%); Muti-time 1 (1%)
   data type    Text 62 (87%); KG 8 (11%); Crosslingual 1 (1%); Tabular 1
                (1%); Code 1 (1%); TextGraph 1 (1%)
   granularity  Chunk 31 (44%); Doc 11 (15%); Sentence 10 (14%); Item-base 4
                (6%); Entity 3 (4%); Triplet 3 (4%); Sentence Pair 2 (3%);
                Sub-Graph 2 (3%); Phrase 1 (1%); Proposition 1 (1%); Multi 1
                (1%); Item 1 (1%); Entity Sequence 1 (1%)
   source       Wikipedia 27 (38%); Dataset-base 27 (38%); Search Engine 4
                (6%); FactoidWiki 2 (3%); Synthesized dataset 2 (3%); Common
                Crawl 2 (3%); Arxiv 2 (3%); LLMs 2 (3%); Pile 2 (3%); Freebase
                2 (3%); Pre-training Corpus 1 (1%); Pre-training corpus 1
                (1%); BEIR 1 (1%); MSMARCO 1 (1%); Online Database 1 (1%);
                PubMed 1 (1%); C4 1 (1%); LLM 1 (1%); Graph 1 (1%); CMeKG 1
                (1%)
```

Table I is the survey's selection of representative methods, not a census of the literature, but it still draws a clear outline: the augmentation stage is mostly inference (56%), the data type mostly text (87%), the granularity mostly chunks (44%), the retrieval process mostly a single pass (66%), and the source mostly Wikipedia or ready-made datasets (38% each).

### Claims in the text, against Table I

```text
2. Claims in the text, against Table I
   (a) text is the mainstream source -> 63/71 rows (89%) include Text, 59 are Text only
   (b) expanded to semi-structured data (PDF) -> 0 rows say PDF or semi;
       the closest, Tabular,Text, has 1 (PKG)
   (c) text granularities the text lists -> rows in Table I:
       Token 0, Phrase 1, Sentence 10, Proposition 1, Chunk 31, Doc 11
       and for knowledge graphs: Entity 3, Triplet 3, Sub-Graph 2
   (d) the standard practice is a single retrieval -> Once 47 rows (66%), multi-step 24 rows
   (e) a growing trend of LLM-generated content -> 3 rows: RECITE (2022), GenRead (2022), PKG (2023)
   (f) Figure 1: first the inference stage, later gradually more fine-tuning. Table I by year:
                      2022 (n=9)    2023 (n=55)     2024 (n=7)
   Inference             4 (44%)       30 (55%)        6 (86%)
   Tuning                3 (33%)       20 (36%)        1 (14%)
   Pre-training          2 (22%)         5 (9%)         0 (0%)
```

One by one:

| The survey says | What Table I has | Verdict |
| --- | --- | --- |
| Text is the mainstream retrieval source | 63 of 71 rows include text, 59 are text only | Consistent |
| It expanded to semi-structured data (PDF) | No row is marked PDF or semi-structured | No example in the table |
| Text granularities: token, phrase, sentence, proposition, chunk, document | Token 0 rows, the rest all present (phrase 1, proposition 1, sentence 10, chunk 31, document 11) | Mostly consistent, no example for token |
| The standard practice is a single retrieval | Once 47 rows (66%), multi-step 24 rows | Consistent |
| A growing trend of LLM-generated content | 3 rows: RECITE (2022), GenRead (2022), PKG (2023) | "Growing" cannot be seen in the table |
| Figure 1: first the inference stage, later more fine-tuning | By year, the inference share is 44%, 55%, 86% and the tuning share 33%, 36%, 14% | Table I neither supports nor refutes it |

Read the last row with care: Table I has only 9 rows for 2022 and 7 for 2024, a small sample, and the years are my own from the bibliography; the technology tree of Figure 1 draws on a larger body of papers, of which Table I holds 71. All that can be said is that, taken as a sample, Table I does not show a rising share of fine-tuning.

### Whether the labels are consistent

```text
3. Are the labels consistent
   same word    LLM / LLMs (source 1+2); Pre-training Corpus / Pre-training
                corpus (source 1+1)
   prefix pair  Text / TextGraph (data type 62+1); Entity / Entity Sequence
                (granularity 3+1); Item / Item-base (granularity 1+4);
                Sentence / Sentence Pair (granularity 10+2)
   used once    Muti-time (KnowledGPT)
```

Table I was compiled by hand and its labels are not consistent: the same word is written two ways (`LLM` and `LLMs`, `Pre-training Corpus` and `Pre-training corpus`), some labels are another label plus a suffix (`Text` and `TextGraph`, `Entity` and `Entity Sequence`, `Item` and `Item-base`, `Sentence` and `Sentence Pair`), and `Muti-time` appears once (the KnowledGPT row, presumably Multi-time). None of this changes the conclusions above, but counting by the literal label has a small error and synonymous labels must be merged first.

### Table II, and how it cross-checks with Table I

```text
4. Table II, and Table II against Table I
   (a) the text says "covering 26 tasks, nearly 50 datasets" -> 26 sub-tasks,
       48 datasets (50 if the three Amazon categories are counted apart)
   per task     QA 21 (44%); Others 15 (31%); Dialog 5 (10%); IE 4 (8%);
                Reasoning 3 (6%)
   (b) the Method column of Table II cites 68 references, 60 of them methods listed in Table I
       cited by Table II, absent from Table I: 3, 4, 5, 28, 91, 112, 123, 135
   only in I    BEQUE; KnowledGPT; PROMPTAGATOR; CT-RAG; PaperQA; Retrieve-
                and-Sample; QLM-Doc-ranking; PKG; SURGE; FABULA; RoG
```

The survey says "26 tasks, nearly 50 datasets"; the count is 26 sub-tasks and 48 datasets (50 if the three Amazon categories are counted apart), so "26 tasks" means sub-tasks, and QA accounts for 44% of the datasets. The Method column of Table II cites 68 references, 60 of them methods in Table I; 11 methods in Table I (BEQUE, KnowledGPT, PROMPTAGATOR and others) never appear in Table II, and Table II cites 8 references that Table I lacks. The two tables mostly overlap without covering each other, which is reasonable, since they answer different questions: Table I looks at the attributes of methods, Table II at the datasets on which methods were evaluated.

### Two entries that disagree with the source papers

```text
5. Two entries that disagree with the source papers
   FLARE: Table I gives the stage Tuning; its paper says:
     "FLARE is applicable to any existing LMs at inference time
     without additional training."
   StrategyQA: Table II lists it with WikiText-103 under Language Modeling;
   the FLARE paper says:
     "commonsense reasoning (StrategyQA)"
```

Only two entries of the survey were compared with their papers (FLARE and StrategyQA, because the full FLARE paper had been read), and the other 70 rows were not checked line by line, so this is "errors found by sampling", not an error rate.

- **The stage of FLARE.** Table I says Tuning, but the FLARE paper says it can be used at inference time with any existing language model and needs no extra training. The survey itself uses FLARE as an example of adaptive retrieval in Section V: it watches the generation probability and retrieves when it falls below a threshold. The row should say Inference.
- **The category of StrategyQA.** Table II lists it with WikiText-103 under language modeling, while the FLARE paper calls it a commonsense reasoning task.

## Hands-on: a scaled-down RGB evaluation

The survey's evaluation section sorts what RAG needs into four abilities, and its source is the RGB benchmark (Chen, Lin, Han and Sun, Institute of Software, Chinese Academy of Sciences, AAAI 2024, [arXiv 2309.01431](https://arxiv.org/abs/2309.01431)): 1,000 questions, half in Chinese and half in English (600 basic questions plus 200 each for information integration and counterfactual robustness), built from recent news, five documents per question, noise ratios from 0 to 0.8, six models evaluated. Its conclusion is that models have some noise robustness but struggle with rejection, information integration and handling wrong information: ChatGPT's accuracy falls from 96.33% at noise ratio 0 to 76.00% at 0.8, and the best rejection rate is only 45% (English) and 43.33% (Chinese). This section shrinks the four tests and reruns them, to see whether these effects show up on a laptop and what they are sensitive to.

### Design

The world is 50 fictional companies in 10 families of 5, with names that differ by one letter (for example Veshaxax, Veshaxex, Veshaxix). Each company has five attributes: founder, founding year, headquarters, flagship product and headcount. Names and values are generated at random, so a closed-book answer is impossible and every correct answer must come from a document. A question gets at most 5 documents, each a few sentences about one company, with five phrasings per attribute in random order. The four tests:

- **Noise robustness.** $k$ of the 5 documents are noise ($k=0$ to 4, ratio $k/5$) and the rest describe the company asked about. There are three kinds of noise: *a company from another family* (it contains the attribute asked about, but for a different company), *a sibling company* (its name differs by one letter, and it also contains the attribute asked about) and *another attribute of the same company* (it does not contain the attribute asked about).
- **Rejection.** All 4 documents are noise and none has the answer; the right reply is a fixed sentence, "Insufficient information in the documents."
- **Information integration.** A question needs two values (for example founder and founding year), and counts as correct only if both are right and no noise value appears. Three conditions: both facts in one document, the two facts in two documents, and the two documents plus 3 sibling-noise documents.
- **Counterfactual robustness.** Use the capitals of 50 countries, first closed-book, and keep only the ones the model gets right. Then give 3 documents that all state another country's capital, and compare a plain instruction with a warned one (it tells the model the documents may contain factual errors and asks it to first reply "Factual error in the documents." and then give the correct answer).

There are two grading levels. **Strict**: the reply contains the correct value and none of the noise values. **Lenient**: the reply only has to contain the correct value. The two barely differ (see the tables below), so the conclusions do not depend on how tight the grader is. Each cell is 100 trials: 50 questions, each drawn twice with different random seeds, which gives an estimate of the noise.

### How this differs from RGB

This is a scaled-down replication that differs from RGB in many ways, and it is not used to confirm or refute RGB's conclusions. The differences:

| Aspect | RGB | This section |
| --- | --- | --- |
| Data | Real news, retrieved by a search engine | Fictional companies, template sentences (5 phrasings per attribute) |
| Size | 1,000 questions, half Chinese and half English | 50 questions × 2 draws, English only |
| Models | 6, including ChatGPT | 3 small models: Qwen2.5-0.5B-Instruct, Qwen2.5-1.5B-Instruct, Qwen3-4B |
| Noise | Related documents retrieved by search | Three hand-built kinds, with "sibling company" deliberately made easy to confuse |
| Closed book | The model may remember the answer | Fictional companies; closed-book accuracy is 0 for all three models |

One design choice was changed after seeing pilot runs, and it should be disclosed: at first there was only one kind of noise, "a company from another family", and the curves for 1.5B and 4B were almost flat and uninformative. So the "sibling company" and "another attribute of the same company" kinds were added, and the size was fixed at 50 companies with 100 trials per cell. These adjustments were finished before the official run, and nothing was changed afterwards in response to its results.

### How it was run

Environment: Apple M2 Max, Python 3.14.3, PyTorch 2.10.0 (MPS), transformers 5.3.0, NumPy 2.4.2. All three models run in float32 with `eager` attention and greedy decoding (at most 40 new tokens); the models are Apache-2.0 licensed. At the start the script recomputes the next-token probabilities of 8 prompts on the CPU to check the MPS numbers (largest difference 2.7e-05). On another machine or another PyTorch version, individual replies may differ slightly.

<details>
<summary>Full code (about 479 lines)</summary>

```python
"""RGB-style four abilities, scaled down: a synthetic corpus of fictional
companies with one test each for noise robustness, rejection, integration
and counterfactual robustness; both languages share one world, with
per-language sentence templates"""
import random
import re
import sys

import numpy as np
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.utils import logging as hf_logging

hf_logging.set_verbosity_error()
hf_logging.disable_progress_bar()
DEV = sys.argv[1] if len(sys.argv) > 1 else "mps"
N = int(sys.argv[2]) if len(sys.argv) > 2 else 60  # companies = questions
USE = int(sys.argv[3]) if len(sys.argv) > 3 else 3  # models to run
DRAWS, BS, MAXNEW = 2, 16, 40  # draws, batch size, new-token cap
MODELS = (("Qwen/Qwen2.5-0.5B-Instruct", "Qwen2.5-0.5B-Instruct"),
          ("Qwen/Qwen2.5-1.5B-Instruct", "Qwen2.5-1.5B-Instruct"),
          ("Qwen/Qwen3-4B", "Qwen3-4B"))
REL = ("founder", "year", "hq", "product", "staff")
KS = (0, 1, 2, 3, 4)  # noise documents out of 5
KINDS = ("other", "sib", "topic")

# ---- world: fictional companies and five attributes ----
rng = random.Random(7)
SYL = ("bar vel tor mar ken lis dra phi zun cal nor ves tal mir qua sol "
       "bru fen gal hax jor lun pel ryn sev tir ulm wex yar zel").split()
FIRST = ("Elena Marcus Sofia Daniel Lena Victor Irina Tomas Clara Oscar "
         "Nadia Felix Maya Hugo Anya Leo").split()
used = set()

def word():
    while True:
        w = (rng.choice(SYL) + rng.choice(SYL)).capitalize()
        if w not in used:
            used.add(w)
            return w

SUF = ("ax", "ex", "ix", "ox", "ux")
YEARS = rng.sample(range(1950, 2020), N)  # unique: gold never clashes
STAFF = rng.sample(range(2100, 9800, 10), N)
CO, W = [], []
for _ in range(N // 5):  # families of 5, names differ by 1 letter
    stem = word()
    for m in range(5):
        CO.append(stem + SUF[m])
        W.append({"founder": f"{rng.choice(FIRST)} {word()}",
                  "year": str(YEARS[len(CO) - 1]), "hq": word(),
                  "product": f"{word()}-{rng.randint(2, 9)}",
                  "staff": str(STAFF[len(CO) - 1])})

# ---- sentence templates: 5 phrasings per attribute ----
T = {"founder": [
        "{c} was founded by {v}.",
        "{v} is the founder of {c}.",
        "The company {c} was set up by its founder, {v}.",
        "Company records say that {c} was started by {v}.",
        "The founder of {c} is {v}."],
     "year": [
        "{c} was founded in {v}.",
        "{c} began operations in {v}.",
        "The year {v} marks the founding of {c}.",
        "{c} was established in {v}.",
        "Records show that {c} was founded in {v}."],
     "hq": [
        "{c} is headquartered in {v}.",
        "The headquarters of {c} are in {v}.",
        "{c} has its head office in {v}.",
        "{c} runs its business from {v}, where its head office sits.",
        "The head office of {c} can be found in {v}."],
     "product": [
        "The flagship product of {c} is {v}.",
        "The best-known product of {c} is {v}.",
        "{c} is best known for {v}.",
        "{v} is the main product that {c} sells.",
        "{c} built its name on {v}."],
     "staff": [
        "{c} has {v} employees.",
        "{c} employs {v} people.",
        "The workforce of {c} numbers {v} people.",
        "{v} people work at {c}.",
        "{c} reports a headcount of {v}."]}
Q = {"founder": "Who founded {c}?",
     "year": "In which year was {c} founded?",
     "hq": "In which city is {c} headquartered?",
     "product": "What is the flagship product of {c}?",
     "staff": "How many employees does {c} have?"}
PAIRS = (("founder", "year"), ("hq", "product"), ("staff", "founder"),
         ("year", "hq"), ("product", "staff"))
QP = ["Who founded {c}, and in which year?",
      "In which city is {c} headquartered, and what is its flagship product?",
      "How many employees does {c} have, and who founded it?",
      "In which year was {c} founded, and in which city is it headquartered?",
      "What is the flagship product of {c}, and how many staff does it have?"]

# ---- instructions, fixed replies and graders ----
REJ = "Insufficient information in the documents"
DET = "Factual error in the documents"
SYS_CB = "Answer the question as briefly as possible."
SYS_P = (
    "You answer questions from the given documents, as briefly as "
    "possible. If the documents do not contain the answer, "
    f'reply exactly: "{REJ}."')
SYS_W = SYS_P + (
    " The documents may contain factual errors. If a document "
    "contradicts what you know to be true, "
    f'start your reply with "{DET}." and then give the correct answer.')
LENIENT = re.compile("|".join(map(re.escape, (
    "insufficient,cannot answer,can't answer,not mentioned,"
    "not provided,no information,does not contain,unable to"
).split(","))), re.I)

# ---- known facts for the counterfactual test: countries and capitals ----
CAP = (
    ("Australia", "Canberra"),
    ("Canada", "Ottawa"),
    ("Kenya", "Nairobi"),
    ("Vietnam", "Hanoi"),
    ("Peru", "Lima"),
    ("Norway", "Oslo"),
    ("Poland", "Warsaw"),
    ("Portugal", "Lisbon"),
    ("Chile", "Santiago"),
    ("Egypt", "Cairo"),
    ("Turkey", "Ankara"),
    ("Argentina", "Buenos Aires"),
    ("Thailand", "Bangkok"),
    ("Greece", "Athens"),
    ("Sweden", "Stockholm"),
    ("Finland", "Helsinki"),
    ("Austria", "Vienna"),
    ("Hungary", "Budapest"),
    ("Ireland", "Dublin"),
    ("Switzerland", "Bern"),
    ("Cuba", "Havana"),
    ("Morocco", "Rabat"),
    ("Nigeria", "Abuja"),
    ("Ethiopia", "Addis Ababa"),
    ("Iran", "Tehran"),
    ("Iraq", "Baghdad"),
    ("Pakistan", "Islamabad"),
    ("Bangladesh", "Dhaka"),
    ("Indonesia", "Jakarta"),
    ("Malaysia", "Kuala Lumpur"),
    ("Philippines", "Manila"),
    ("South Korea", "Seoul"),
    ("Japan", "Tokyo"),
    ("Mongolia", "Ulaanbaatar"),
    ("Nepal", "Kathmandu"),
    ("Afghanistan", "Kabul"),
    ("Saudi Arabia", "Riyadh"),
    ("Jordan", "Amman"),
    ("Lebanon", "Beirut"),
    ("Venezuela", "Caracas"),
    ("Ecuador", "Quito"),
    ("Uruguay", "Montevideo"),
    ("Mexico", "Mexico City"),
    ("Denmark", "Copenhagen"),
    ("Belgium", "Brussels"),
    ("Czechia", "Prague"),
    ("Romania", "Bucharest"),
    ("Bulgaria", "Sofia"),
    ("Serbia", "Belgrade"),
    ("Croatia", "Zagreb"),
    ("Iceland", "Reykjavik"),
    ("Ghana", "Accra"),
    ("Uganda", "Kampala"),
    ("Zimbabwe", "Harare"),
    ("Zambia", "Lusaka"),
    ("Angola", "Luanda"),
    ("Senegal", "Dakar"),
    ("Algeria", "Algiers"),
    ("Cambodia", "Phnom Penh"),
    ("Laos", "Vientiane"),
)
CT = ("The capital of {c} is {v}.",
      "{v} is the capital city of {c}.",
      "{c} has {v} as its capital.")
CQ = "What is the capital of {c}?"

def has(text, v):
    return re.search(rf"(?<![A-Za-z0-9]){re.escape(v)}(?![A-Za-z0-9])",
                     text, re.I) is not None

def say(text, phrase):
    return phrase.lower() in text.lower()

def fact(i, r, j):
    return T[r][j].format(c=CO[i], v=W[i][r])

def para(sr, i, rels):
    """A short profile of company i: one sentence per attribute in rels,
    phrasing and order random"""
    sents = [fact(i, r, sr.randrange(5)) for r in rels]
    sr.shuffle(sents)
    return " ".join(sents)

def vals(i, rels):
    return [W[i][r] for r in rels]

def rel(i):
    """The attribute asked about company i: the 5 firms of a family
    are each asked a different one"""
    return REL[(i + i // 5) % 5]

def noise_docs(sr, i, r, kind, k):
    """k noise profiles: other = firms of other families, sib = firms of the
    same family (names differ by one letter), both including the asked
    attribute; topic = the same firm, without the asked attribute"""
    docs, dist = [], []
    rest = [x for x in REL if x != r]
    if kind == "topic":
        for _ in range(k):
            rels = sr.sample(rest, 3)
            docs.append(para(sr, i, rels))
            dist += vals(i, rels)
        return docs, dist
    fam = range(i // 5 * 5, i // 5 * 5 + 5)
    pool = [j for j in range(N) if (j in fam) == (kind == "sib") and j != i]
    for j in sr.sample(pool, k):
        rels = [r] + sr.sample(rest, 2)
        docs.append(para(sr, j, rels))
        dist += vals(j, rels)
    return docs, dist

def build():
    """Every model-independent trial:
    (tag, system prompt, docs, question, gold values, distractor values)"""
    out = []
    for d in range(DRAWS):
        for kind in KINDS:
            for k in KS:
                if kind != "other" and k == 0:
                    continue  # the three kinds coincide when k = 0
                sr = random.Random(f"sample-{kind}-{k}-{d}")
                hr = random.Random(f"shuffle-{kind}-{k}-{d}")
                for i in range(N):
                    r = rel(i)
                    rest = [x for x in REL if x != r]
                    docs = [para(sr, i, [r] + sr.sample(rest, 2))
                            for _ in range(5 - k)]
                    extra, dist = noise_docs(sr, i, r, kind, k)
                    docs = docs + extra
                    hr.shuffle(docs)
                    out.append((("noise", kind, k, d), SYS_P, docs,
                                Q[r].format(c=CO[i]), [W[i][r]], dist))
            sr = random.Random(f"reject-{kind}-{d}")
            hr = random.Random(f"shuffle-reject-{kind}-{d}")
            for i in range(N):
                r = rel(i)
                docs, dist = noise_docs(sr, i, r, kind, 4)
                hr.shuffle(docs)
                out.append((("reject", kind, 0, d), SYS_P, docs,
                            Q[r].format(c=CO[i]), [], dist))
        for cond in ("one", "two", "noise"):
            sr = random.Random(f"merge-{cond}-{d}")
            hr = random.Random(f"shuffle-merge-{cond}-{d}")
            for i in range(N):
                r1, r2 = PAIRS[i % 5]
                rest = [x for x in REL if x not in (r1, r2)]
                if cond == "one":
                    docs = [para(sr, i, [r1, r2, sr.choice(rest)])]
                else:
                    docs = [para(sr, i, [r1] + sr.sample(rest, 2)),
                            para(sr, i, [r2] + sr.sample(rest, 2))]
                dist = []
                if cond == "noise":
                    fam = range(i // 5 * 5, i // 5 * 5 + 5)
                    for j in sr.sample([j for j in fam if j != i], 3):
                        rels = [r1, r2, sr.choice(rest)]
                        docs.append(para(sr, j, rels))
                        dist += vals(j, rels)
                hr.shuffle(docs)
                out.append((("merge", cond, 0, d), SYS_P, docs,
                            QP[i % 5].format(c=CO[i]),
                            [W[i][r1], W[i][r2]], dist))
    for i in range(N):
        r = rel(i)
        out.append((("closed", "fict", 0, 0), SYS_CB, [],
                    Q[r].format(c=CO[i]), [W[i][r]], []))
    for t, _, docs, q, gold, dist in out:
        assert not set(gold) & set(dist), (t, gold, dist)
    return out

def chat(tok, system, docs, q):
    body = "".join(f"[{n + 1}] {d}\n" for n, d in enumerate(docs))
    user = (f"Documents:\n{body}\nQuestion: {q}"
            if docs else f"Question: {q}")
    msgs = [{"role": "system", "content": system},
            {"role": "user", "content": user}]
    return tok.apply_chat_template(msgs, tokenize=False, enable_thinking=False,
                                   add_generation_prompt=True)

@torch.no_grad()
def ask(model, tok, texts):
    order = sorted(range(len(texts)), key=lambda i: len(texts[i]))
    out = [""] * len(texts)
    for b in range(0, len(order), BS):
        idx = order[b:b + BS]
        enc = tok([texts[i] for i in idx], return_tensors="pt",
                  padding=True).to(DEV)
        gen = model.generate(**enc, max_new_tokens=MAXNEW, do_sample=False,
                             pad_token_id=tok.pad_token_id)
        for i, g in zip(idx, gen[:, enc.input_ids.shape[1]:]):
            out[i] = tok.decode(g, skip_special_tokens=True).strip()
        if DEV == "mps":
            torch.mps.empty_cache()
    return out

def strict(resp, gold, dist):
    return all(has(resp, g) for g in gold) and not any(
        has(resp, d) for d in dist)

SPECS = build()
FACTS = CAP[:N]
RES, GAP = {}, None
for path, name in MODELS[:USE]:
    tok = AutoTokenizer.from_pretrained(path)
    tok.padding_side = "left"
    model = AutoModelForCausalLM.from_pretrained(
        path, dtype=torch.float32, attn_implementation="eager")
    g = model.generation_config  # switch off shipped sampling and penalty
    g.temperature = g.top_p = g.top_k = g.repetition_penalty = None
    g.do_sample = False
    model = model.to(DEV).eval()
    main = ask(model, tok, [chat(tok, sy, d, q) for _, sy, d, q, _, _ in SPECS])
    cb = ask(model, tok, [chat(tok, SYS_CB, [], CQ.format(c=c))
                          for c, _ in FACTS])
    known = [i for i, (_, cap) in enumerate(FACTS) if has(cb[i], cap)]
    cf = []
    for i in known:
        (c, cap), wrong = FACTS[i], FACTS[(i + 7) % len(FACTS)][1]
        docs = [t.format(c=c, v=wrong) for t in CT]
        random.Random(f"shuffle-cf-{i}").shuffle(docs)
        cf.append((c, cap, wrong, docs))
    ans = {}
    for tag, sy in (("plain", SYS_P), ("warned", SYS_W)):
        ans[tag] = ask(model, tok, [chat(tok, sy, d, CQ.format(c=c))
                                    for c, _, _, d in cf])
    RES[name] = dict(main=main, cb=cb, known=known, cf=cf, ans=ans)
    if GAP is None:  # first model: redo 8 prompts on CPU
        cpu = AutoModelForCausalLM.from_pretrained(
            path, dtype=torch.float32).eval()
        GAP = 0.0
        for sp in SPECS[:8]:
            enc = tok(chat(tok, sp[1], sp[2], sp[3]), return_tensors="pt")
            with torch.no_grad():
                a = cpu(**enc).logits[0, -1].softmax(-1)
                b = model(**enc.to(DEV)).logits[0, -1].softmax(-1).cpu()
            GAP = max(GAP, (a - b).abs().max().item())
        del cpu
    del model
    if DEV == "mps":
        torch.mps.empty_cache()

def pad(s, width):
    """Pad to a display width (a CJK character takes two cells)"""
    return s + " " * (width - sum(2 if ord(c) > 0x2e80 else 1 for c in s))

def pct(xs):
    return 100 * float(np.mean(xs)) if len(xs) else float("nan")

def per_draw(main, tag, scorer):
    """Score (in percent) of one (test, kind, k) in each draw"""
    return [pct([scorer(sp, r) for sp, r in zip(SPECS, main)
                 if sp[0] == (*tag, d)]) for d in range(DRAWS)]

def s_strict(sp, r):
    return strict(r, sp[4], sp[5])

def s_gold(sp, r):
    return all(has(r, g) for g in sp[4])

ROWS = (("other", "firms of other families"),
        ("sib", "sibling firms (one letter off)"),
        ("topic", "other attributes, same firm"))
W1 = 34
print(f"{N} fictional companies ({N // 5} families), at most 5 documents "
      f"per question, {DRAWS} draws; device {DEV}")
print(f"audit: largest next-token probability gap, {DEV} vs CPU, "
      f"{GAP:.1e} (first model, 8 prompts)")
for name, R in RES.items():
    main, known = R["main"], R["known"]
    print(f"\n== {name}")
    closed = [has(r, sp[4][0]) for sp, r in zip(SPECS, main)
              if sp[0][0] == "closed"]
    print("closed book (fictional firms, no documents): "
          f"{sum(closed)}/{len(closed)} correct")
    print(f"\n1 noise robustness: k of 5 documents are noise, "
          f"strict accuracy % ({N * DRAWS} trials per cell)")
    print(pad("noise documents k (ratio k/5)", W1)
          + "".join(f"{f'{k}={k / 5:.1f}':>8}" for k in KS))
    diffs, gaps = [], []
    for kind, label in ROWS:
        vals_ = []
        for k in KS:
            tag = ("noise", "other" if k == 0 else kind, k)
            a, g = per_draw(main, tag, s_strict), per_draw(main, tag, s_gold)
            vals_.append(np.mean(a))
            if not (kind != "other" and k == 0):
                diffs.append(abs(a[0] - a[1]))
                gaps.append(np.mean(g) - np.mean(a))
        print(pad(label, W1) + "".join(f"{v:8.1f}" for v in vals_))
    print(f"mean gap between the two draws {np.mean(diffs):.1f} points; "
          "lenient grading (gold value present) averages "
          f"{np.mean(gaps):.1f} above strict")
    print("\n2 negative rejection: all 4 documents are noise, "
          "so the fixed reply is right")
    print(pad("", W1) + pad("exact %", 12)
          + pad("lenient %", 12) + "quotes noise %")
    for kind, label in ROWS:
        sel = [(sp, r) for sp, r in zip(SPECS, main)
               if sp[0][:2] == ("reject", kind)]
        fixed = pct([say(r, REJ) for _, r in sel])
        loose = pct([say(r, REJ) or bool(LENIENT.search(r)) for _, r in sel])
        quote = pct([any(has(r, d) for d in sp[5]) for sp, r in sel])
        print(pad(label, W1) + f"{fixed:<12.1f}{loose:<12.1f}{quote:.1f}")
    print("\n3 integration: a question needs two values; "
          "correct only if both are right and no noise value appears")
    print(pad("", W1) + pad("strict %", 12) + "lenient %")
    for cond, label in (("one", "both facts in one document"),
                        ("two", "one fact per document"),
                        ("noise", "two documents + 3 sibling noise")):
        tag = ("merge", cond, 0)
        a, g = per_draw(main, tag, s_strict), per_draw(main, tag, s_gold)
        print(pad(label, W1) + f"{np.mean(a):<12.1f}{np.mean(g):.1f}")
    print(f"\n4 counterfactual: {len(known)} of {len(FACTS)} capitals known "
          "closed-book; 3 documents all state a wrong capital")
    for tag, label in (("plain", "plain instruction"),
                       ("warned", "instruction with a warning")):
        rs = [(has(r, cap), has(r, wr), say(r, DET))
              for (_, cap, wr, _), r in zip(R["cf"], R["ans"][tag])]
        follow = pct([w and not t for t, w, _ in rs])
        keep = pct([t and not w for t, w, _ in rs])
        line = (
            f"follows the error {follow:.1f}%, "
            f"keeps the truth {keep:.1f}%")
        if tag == "warned":
            flag = pct([d for _, _, d in rs])
            line += f", flags the error {flag:.1f}%"
        print(pad(label, W1) + line)
    print("\nexamples (replies cut at 70 characters):")
    for sp, r in zip(SPECS, main):
        if sp[0][:3] == ("noise", "sib", 4) and sp[0][3] == 0 and not strict(
                r, sp[4], sp[5]):
            print(f"  {sp[3]} gold={sp[4][0]} -> {r[:70]!r}")
            break
    for sp, r in zip(SPECS, main):
        if sp[0][:3] == ("reject", "sib", 0) and not say(r, REJ):
            print(f"  {sp[3]} (no document names it) -> {r[:70]!r}")
            break
    for (c, cap, wr, _), r in zip(R["cf"], R["ans"]["plain"]):
        if has(r, wr) and not has(r, cap):
            print(f"  {c}: true={cap} documents={wr} -> {r[:70]!r}")
            break
```

</details>

### Noise robustness

```text
== Qwen2.5-0.5B-Instruct
1 noise robustness: k of 5 documents are noise, strict accuracy % (100 trials per cell)
noise documents k (ratio k/5)        0=0.0   1=0.2   2=0.4   3=0.6   4=0.8
firms of other families              100.0    99.0    98.0    94.0    84.0
sibling firms (one letter off)       100.0    98.0    94.0    92.0    68.0
other attributes, same firm          100.0   100.0    99.0    99.0    97.0
mean gap between the two draws 2.2 points; lenient grading (gold value present) averages 0.1 above strict

== Qwen2.5-1.5B-Instruct
1 noise robustness: k of 5 documents are noise, strict accuracy % (100 trials per cell)
noise documents k (ratio k/5)        0=0.0   1=0.2   2=0.4   3=0.6   4=0.8
firms of other families              100.0   100.0   100.0    98.0    98.0
sibling firms (one letter off)       100.0    98.0    99.0   100.0    94.0
other attributes, same firm          100.0   100.0    99.0    97.0    95.0
mean gap between the two draws 0.9 points; lenient grading (gold value present) averages 0.1 above strict

== Qwen3-4B
1 noise robustness: k of 5 documents are noise, strict accuracy % (100 trials per cell)
noise documents k (ratio k/5)        0=0.0   1=0.2   2=0.4   3=0.6   4=0.8
firms of other families              100.0   100.0   100.0    96.0    96.0
sibling firms (one letter off)       100.0   100.0   100.0    99.0    95.0
other attributes, same firm          100.0   100.0    99.0    98.0    92.0
mean gap between the two draws 1.7 points; lenient grading (gold value present) averages 0.2 above strict
```

*Figure: Noise robustness (a scaled-down RGB-style design): each point is the strict accuracy over 100 trials, 50 fictional companies asked once per draw, two draws of documents. The data is the real output of this page's experiment, not illustrative values.*

Each panel is one model. First the noise floor: the mean gap between the two draws is 2.2, 0.9 and 1.7 points for the three models, so differences of 4 points or less are not interpreted.

**Sibling firms (names one letter apart) hurt most, but only the smallest model shows it clearly.** At ratio 0.8, with only 1 of 5 documents correct, Qwen2.5-0.5B falls from 100.0% to 68.0% with sibling noise, to 84.0% with firms from other families, and only to 97.0% with other attributes of the same firm. For Qwen2.5-1.5B and Qwen3-4B the three kinds of noise end within 4 points of each other at 0.8 (94.0% to 98.0% and 92.0% to 96.0%), too close to rank. The sibling case matches the "concept confusion" in RGB's error analysis (a document that is similar to the question but different from it misleads the model).

**The curves bend only at high noise ratios.** Up to ratio 0.4 no cell of any model is below 94.0%. The sibling line of the 0.5B model is the first to bend (92.0% at 0.6), and at 0.8 it and the other-families line (84.0%) fall further; the lines of the larger models only dip a few points at 0.8. RGB also reports that accuracy falls significantly only once the noise ratio passes 80%, a similar shape, but its models and data are different and the two cannot confirm each other.

**Qwen3-4B's 92.0% in the last cell of the "other attributes" row is the lowest value in its panel.** On this row the 0.5B and 1.5B models stay flat (lowest 97.0% and 95.0%), so the drop is worth a look at the replies (see "Qwen3-4B's 92.0%: reading the replies" below).

### Negative rejection

```text
== Qwen2.5-0.5B-Instruct
2 negative rejection: all 4 documents are noise, so the fixed reply is right
                                  exact %     lenient %   quotes noise %
firms of other families           23.0        23.0        74.0
sibling firms (one letter off)    0.0         0.0         98.0
other attributes, same firm       37.0        37.0        23.0

== Qwen2.5-1.5B-Instruct
2 negative rejection: all 4 documents are noise, so the fixed reply is right
                                  exact %     lenient %   quotes noise %
firms of other families           91.0        91.0        9.0
sibling firms (one letter off)    13.0        13.0        87.0
other attributes, same firm       78.0        78.0        20.0

== Qwen3-4B
2 negative rejection: all 4 documents are noise, so the fixed reply is right
                                  exact %     lenient %   quotes noise %
firms of other families           100.0       100.0       0.0
sibling firms (one letter off)    94.0        94.0        6.0
other attributes, same firm       90.0        90.0        19.0
```

Rejection separates the three models best. With 4 noise documents the right reply is the fixed sentence.

**Sibling firms are hardest.** Qwen2.5-0.5B refuses 0.0% of the time and Qwen2.5-1.5B 13.0%; 98.0% and 87.0% of their replies quote a noise value, that is, they give the value of a firm one letter away as if it belonged to the firm asked about. Qwen3-4B refuses 94.0% of the time, and 6.0% of its replies quote a noise value. Firms from other families are easier to tell apart: 23.0%, 91.0% and 100.0%. For other attributes of the same firm: 37.0%, 78.0% and 90.0%. The third column is not 100 minus the first, because a reply can refuse and still mention a value from the documents (Qwen3-4B on the last row: 90.0% refuse, 19.0% quote a noise value).

The "exact" and "lenient" columns are identical in every cell: a model either replies with the fixed sentence verbatim or does not refuse at all, so there is none of the gap between Rej and Rej* in RGB (it says models often fail to follow the instruction strictly). That is probably because the instruction sits in the system message and the sentence is short; do not generalize it. RGB reports a best rejection rate of only 45% (English) and 43.33% (Chinese). Here Qwen3-4B reaches 100.0%, 94.0% and 90.0%, but it faces templated fictional documents, which does not make it better than the models in RGB.

### Information integration

```text
== Qwen2.5-0.5B-Instruct
3 integration: a question needs two values; correct only if both are right and no noise value appears
                                  strict %    lenient %
both facts in one document        67.0        67.0
one fact per document             59.0        59.0
two documents + 3 sibling noise   18.0        18.0

== Qwen2.5-1.5B-Instruct
3 integration: a question needs two values; correct only if both are right and no noise value appears
                                  strict %    lenient %
both facts in one document        97.0        97.0
one fact per document             93.0        93.0
two documents + 3 sibling noise   75.0        75.0

== Qwen3-4B
3 integration: a question needs two values; correct only if both are right and no noise value appears
                                  strict %    lenient %
both facts in one document        99.0        99.0
one fact per document             93.0        93.0
two documents + 3 sibling noise   90.0        90.0
```

**Splitting the two facts over two documents costs a little**: 67.0% to 59.0%, 97.0% to 93.0% and 99.0% to 93.0%, a small but consistent drop of 8, 4 and 6 points in all three models. With 100 trials per cell I would not push the reading further. The third condition costs far more: adding 3 sibling-noise documents (names one letter apart, each also containing both attributes) brings the accuracy down to 18.0%, 75.0% and 90.0%. So in this simplified world, integration itself is not hard; telling similar entities apart is. In RGB's integration test, the errors of ChatGLM2-6B are split into merging errors (the answers to the two sub-questions are blended), ignoring errors and misalignment errors; those come from the messier wording and context of real articles and are not measured here.

### Counterfactual robustness

```text
== Qwen2.5-0.5B-Instruct
4 counterfactual: 50 of 50 capitals known closed-book; 3 documents all state a wrong capital
plain instruction                 follows the error 82.0%, keeps the truth 0.0%
instruction with a warning        follows the error 90.0%, keeps the truth 0.0%, flags the error 0.0%

== Qwen2.5-1.5B-Instruct
4 counterfactual: 49 of 50 capitals known closed-book; 3 documents all state a wrong capital
plain instruction                 follows the error 85.7%, keeps the truth 0.0%
instruction with a warning        follows the error 77.6%, keeps the truth 0.0%, flags the error 0.0%

== Qwen3-4B
4 counterfactual: 50 of 50 capitals known closed-book; 3 documents all state a wrong capital
plain instruction                 follows the error 100.0%, keeps the truth 0.0%
instruction with a warning        follows the error 32.0%, keeps the truth 68.0%, flags the error 54.0%
```

In the closed-book pass Qwen2.5-0.5B knows 50 of the 50 capitals, Qwen2.5-1.5B knows 49 and Qwen3-4B knows 50; only the known ones are scored. Then 3 documents all state a wrong capital. With the plain instruction, the replies follow the documents' error in 82.0%, 85.7% and 100.0% of cases, and none of the three models keeps the closed-book answer (0.0%); the rest of the replies for the first two models mention neither capital or both. With the warning, the first two models barely react: they still follow the error in 90.0% and 77.6% of cases and flag it in none. Qwen3-4B changes: following the error falls to 32.0%, keeping the truth rises to 68.0%, and 54.0% of its replies start with the fixed sentence that flags the error.

This agrees with RGB's conclusion that without a warning, models trust the documents over what they know, even when they answered correctly closed-book. But there are only 49 to 50 questions (one question is about 2 points), and the three models differ in more than size (Qwen3-4B is Qwen3, the other two are Qwen2.5), so all I can say is that the two smaller models show no reaction to the warning and Qwen3-4B reacts clearly, not that scale lets a model detect errors.

### Reading some replies

```text
== Qwen2.5-0.5B-Instruct
examples (replies cut at 70 characters):
  In which year was Veshaxex founded? gold=1969 -> '1956'
  Who founded Veshaxax? (no document names it) -> 'Leo Pellun'
  Australia: true=Canberra documents=Lisbon -> 'Lisbon'

== Qwen2.5-1.5B-Instruct
examples (replies cut at 70 characters):
  What is the flagship product of Veshaxox? gold=Solvel-5 -> 'Talzel-9'
  Who founded Veshaxax? (no document names it) -> 'Anya Veslis'
  Australia: true=Canberra documents=Lisbon -> 'Australia has Lisbon as its capital.'

== Qwen3-4B
examples (replies cut at 70 characters):
  What is the flagship product of Quayarex? gold=Lismar-7 -> 'The flagship product of Quayarex is Talken-6.'
  Who founded Veshaxax? (no document names it) -> 'Anya Calpel.'
  Australia: true=Canberra documents=Lisbon -> 'Lisbon.'
```

Each model's three examples are the first failures in its own tables: the first miss in the noise cell where all 4 noise documents are siblings ($k=4$), the first sibling-firm question that was not refused, and the first counterfactual question where the reply followed the wrong document. They are anecdotes; the proportions are in the tables above. None of the wrong values is made up: in this world (`CO` and `W` in the script) each one has an owner. Qwen2.5-0.5B answered 1956 for Veshaxex's founding year (true: 1969), which is Veshaxox's year, and Leo Pellun for the founder of Veshaxax, who is Veshaxex's founder. Qwen2.5-1.5B answered Talzel-9 for Veshaxox's flagship product, which is Veshaxux's, and Anya Veslis for Veshaxax's founder, who is Veshaxox's founder. Qwen3-4B answered Talken-6 for Quayarex's flagship product, which is Quayarox's, and Anya Calpel for Veshaxax's founder, who is Veshaxix's founder. So these failures are not invention: the model read a sentence about a firm whose name is one letter away. The three counterfactual examples simply repeat the wrong capital from the documents.

### Qwen3-4B's 92.0%: reading the replies

In the noise table, the last cell of the "other attributes" row is the lowest in Qwen3-4B's panel: 92.0%, against 98.0% or more in the other four cells of that row. So I read this cell's replies. The diagnosis script below runs the noise script up to `SPECS = build()`, which yields the same questions, reruns this cell's 100 prompts with Qwen3-4B on the CPU and counts the failure types.

<details>
<summary>Diagnosis script (about 50 lines)</summary>

```python
"""Reading the replies: why does Qwen3-4B lose
points in the "other attributes, same firm", k=4 cell? Run the experiment
script up to SPECS = build() to get the same questions, rerun those 100
prompts on the CPU, and count the failure types"""
import sys

src = open("exp_rag_rgb_en.py", encoding="utf-8").read()
sys.argv = ["x", "cpu", "50", "3"]
exec(compile(src[:src.index("SPECS = build()")], "exp", "exec"))

SPECS = build()
sel = [sp for sp in SPECS if sp[0][:3] == ("noise", "topic", 4)]
tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B")
tok.padding_side = "left"
model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3-4B", dtype=torch.float32, attn_implementation="eager")
g = model.generation_config
g.temperature = g.top_p = g.top_k = g.repetition_penalty = None
g.do_sample = False
model.eval()
resp = ask(model, tok, [chat(tok, sy, d, q) for _, sy, d, q, _, _ in sel])
ok = [strict(r, sp[4], sp[5]) for sp, r in zip(sel, resp)]
gold = [all(has(r, x) for x in sp[4]) for sp, r in zip(sel, resp)]
bad = [i for i, o in enumerate(ok) if not o]
refuse = [i for i in bad if say(resp[i], REJ)]
cited = [i for i in bad if i not in refuse
         and any(has(resp[i], d) for d in sel[i][5])]
print(f"Qwen3-4B, CPU, 'other attributes of the same firm', k=4: "
      f"{len(sel)} prompts")
print(f"strict correct {sum(ok)}/{len(sel)}, reply contains the "
      f"right value {sum(gold)}/{len(sel)}")
print(f"{len(bad)} failures: the refusal sentence {len(refuse)}, quoted a "
      f"noise value {len(cited)}, other "
      f"{len(bad) - len(refuse) - len(cited)}")
names = {"founder": "founder", "year": "year", "hq": "headquarters",
         "product": "flagship product", "staff": "staff count"}
count = {r: [0, 0] for r in REL}
for i, o in enumerate(ok):
    r = rel(i % N)
    count[r][1] += 1
    count[r][0] += not o
print("failures by attribute: "
      + ", ".join(f"{names[r]} {a}/{b}" for r, (a, b) in count.items()))
if bad:
    sp = sel[bad[0]]
    print("\nThe first failure, prompt and reply:")
    print("  question: " + sp[3])
    for n, d in enumerate(sp[2]):
        print(f"  [{n + 1}] {d}")
    print("  reply: " + repr(resp[bad[0]]))
```

</details>

```text
Qwen3-4B, CPU, 'other attributes of the same firm', k=4: 100 prompts
strict correct 92/100, reply contains the right value 94/100
8 failures: the refusal sentence 5, quoted a noise value 3, other 0
failures by attribute: founder 0/20, year 4/20, headquarters 0/20, flagship product 4/20, staff count 0/20

The first failure, prompt and reply:
  question: In which year was Quasolox founded?
  [1] The workforce of Quasolox numbers 5800 people. The headquarters of Quasolox are in Veszel. The company Quasolox was set up by its founder, Sofia Zunbru.
  [2] Quasolox has 5800 employees. Quasolox has its head office in Veszel. The flagship product of Quasolox is Lisves-5.
  [3] 5800 people work at Quasolox. Quasolox is headquartered in Veszel. Quasolox is best known for Lisves-5.
  [4] Quasolox has 5800 employees. Sofia Zunbru is the founder of Quasolox. Quasolox is headquartered in Veszel.
  [5] Quasolox runs its business from Veszel, where its head office sits. Quasolox is best known for Lisves-5. Quasolox began operations in 2006.
  reply: 'Insufficient information in the documents.'
```

The CPU rerun gives 92 of 100 strictly correct, the same as the 92.0% on MPS. Of the 8 failures, 5 are the fixed refusal sentence even though one document states the answer, and 3 quote a noise value. The failures sit in two attributes: founding year 4/20 and flagship product 4/20, with none in the other three. In the first failure printed, document 5 says "Quasolox began operations in 2006", and the model still replied that the documents do not contain the information. I did not look into why these two attributes, so I draw no conclusion about the cause. What is certain is that this cell is lower mostly because of refusals when the answer is in the documents, not because of wrong values taken from noise.

### What this experiment can and cannot tell

- **Small samples.** Each cell is 100 trials, the two draws differ by 0.9 to 2.2 points, and the counterfactual test has only 49 to 50 questions. On the 0.5B model the ranking of the noise kinds is clear (sibling 68.0%, other families 84.0%, other attributes 97.0% at ratio 0.8); on the larger models most differences are within 4 points and are not interpreted.
- **The models differ in more than size.** Qwen3-4B is Qwen3 and the other two are Qwen2.5, with different training data and post-training, so differences cannot be put down to scale alone.
- **The data is invented and templated.** Fictional names, five phrasings per attribute, short documents; real documents are longer and their noise subtler, so do not carry the absolute numbers over (for example, firms from other families hardly affect the 1.5B and 4B models here, 98.0% and 96.0% at ratio 0.8, which would not hold on real news).
- **The grader only checks which values appear.** Strict and lenient grading differ by 0.1, 0.1 and 0.2 points on average in the noise tables, but neither looks at extra content in the reply; a refusal is recognized only by the fixed sentence or a few fixed keywords.
- **The prompts were not tuned, and there is only one version.** A different system instruction could change the rejection and counterfactual results (the warning for Qwen3-4B is itself an instruction).
- **One run.** Greedy decoding and fixed seeds; the script starts by comparing next-token probabilities on MPS and the CPU (largest gap 2.7e-05), and the CPU rerun in the section above gives the same 92 of 100 correct as MPS for that cell, but there was no second full run to estimate the variation between runs.

## Limits and next steps

- **It is a survey, and it dates.** The methods in Table I stop in early 2024; Agentic RAG, graph RAG and the later mixes of long context and RAG are not in it. Read it for the coordinate system, not the list of methods.
- **Claims quoted in the survey need the original.** I spot-checked three places, FLARE, StrategyQA and The Power of Noise, and each had one point that does not match the original exactly. The survey's tables and paraphrases are good for finding leads, not for quoting.
- **RAG evaluation had no standard practice when the survey was written.** The survey itself says the metrics in its Table III are traditional measures and not yet a mature or standardized approach; the scaled-down experiment here only covers the simplest case, where the answer is in the documents or it is not, and does not touch the quality of the retriever.
- **Companion code.** To build one yourself and see the numbers of every stage, see [RAG in Practice](https://dmxsf.com/en/wiki/applications/rag/).

## What to take away from this survey

1. **The three paradigms are one line of making retrieval a controllable module.** Naive is a single chain, Advanced adds optimization before and after retrieval, Modular makes modules replaceable and lets the flow loop.
2. **Retrieval, generation and augmentation are three stages that can be tuned separately.** For retrieval: source, granularity and optimization (query rewriting, embedding fine-tuning, reranking); for generation: post-processing and fine-tuning; for augmentation: how often and when to retrieve (iterative, recursive, adaptive).
3. **Evaluate the parts separately.** Retrieval quality, generation quality, and the four abilities (noise robustness, rejection, integration, counterfactual robustness) fail in different ways; a single average blends them.
4. **Check the survey's tables.** The trend claims about Table I cannot be seen in the sample, and FLARE and StrategyQA each have one wrong label; knowing what to trust and what to take back to the original is worth more than remembering method names.
5. **Rejection and confusion are the weak spots of small models, and both size and one instruction matter.** In this page's scaled-down run, rejection under sibling noise ranges from 0.0% to 94.0%, and the counterfactual warning only works for the largest model (see above).

## Further reading

- The survey: [Retrieval-Augmented Generation for Large Language Models: A Survey](https://arxiv.org/abs/2312.10997).
- Where RAG started, and benchmarks: [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020)](https://arxiv.org/abs/2005.11401); [Benchmarking Large Language Models in Retrieval-Augmented Generation (RGB)](https://arxiv.org/abs/2309.01431); [The Power of Noise](https://arxiv.org/abs/2401.14887); [Active Retrieval Augmented Generation (FLARE)](https://arxiv.org/abs/2305.06983).
- On this site: [RAG in Practice](https://dmxsf.com/en/wiki/applications/rag/), [Lost in the Middle](https://dmxsf.com/en/blog/lost-in-the-middle/), [ReAct](https://dmxsf.com/en/blog/react-reasoning-and-acting/), [Toolformer](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/), [Long Context](https://dmxsf.com/en/wiki/architecture/long-context/), [Prompt Engineering](https://dmxsf.com/en/wiki/applications/prompt-engineering/).

## FAQ

### What is RAG, and how do Naive RAG, Advanced RAG and Modular RAG differ?

RAG (retrieval-augmented generation) has a language model fetch relevant content from an external knowledge base before it answers, and generate the answer from what it fetched. Gao et al.'s survey splits its development into three paradigms: Naive RAG is a single chain of indexing, retrieval and generation; Advanced RAG adds optimization before and after retrieval, such as query rewriting, reranking and context compression; Modular RAG turns retrieval, memory, routing and so on into replaceable modules, lets the flow loop, and allows retrieval to be iterative, recursive or adaptive.

### Which abilities should you test when evaluating a RAG system?

The survey separates two objects and three quality scores. The objects are retrieval quality (hit rate, MRR, NDCG) and generation quality; the quality scores are context relevance, answer faithfulness and answer relevance. Benchmarks such as RGB and RECALL also test four abilities: noise robustness (still answering correctly when the documents contain related content without the answer), negative rejection (declining when no document has the answer), information integration (the answer is spread across several documents) and counterfactual robustness (not being misled by a known error in the documents).

### Can the tables in the RAG survey be trusted?

Mostly as a map, but check them. This page copies Table I (71 methods) and Table II (26 sub-tasks, 48 datasets) into code and recounts: 63 of 71 rows include text as a data type and 47 rows (66%) retrieve only once, so those claims hold. But the survey's story of increasingly combining retrieval with fine-tuning cannot be seen in Table I; the labels in Table I are not consistent; FLARE's augmentation stage is labeled fine-tuning although the FLARE paper says it is used at inference time with no extra training; and StrategyQA is filed under language modeling although the FLARE paper calls it commonsense reasoning.

### How much do noisy retrieved documents hurt RAG?

It depends on what the noise looks like. In the RGB benchmark (real news, six models) ChatGPT's accuracy falls from 96.33% at noise ratio 0 to 76.00% at 0.8. This page reruns a scaled-down version with 50 fictional companies: noise from other families, easy to tell apart, barely matters for the 1.5B and 4B models (98.0% and 96.0% at ratio 0.8). When the noise is a sibling company whose name differs by one letter and only 1 of 5 documents is correct, the 0.5B model falls from 100.0% to 68.0%, while the 1.5B and 4B models stay at 94.0% and 95.0%. This is a scaled-down design and does not extrapolate to real retrieval.

### Will a model refuse to answer when the documents do not contain the answer?

Not necessarily, and it depends on size. In RGB the best rejection rate was only 45% (English) and 43.33% (Chinese). In this page's scaled-down run, with 4 documents that are all sibling firms (names one letter apart), Qwen2.5-0.5B and 1.5B refuse 0.0% and 13.0% of the time and most replies give the value of a sibling firm as if it were the answer; Qwen3-4B refuses 94.0%. With documents that all come from other families the rates are 23.0%, 91.0% and 100.0%.
