The Power of Noise: Redefining Retrieval for RAG Systems

Florin Cuconasu, Giovanni Trappolini, Federico Siciliano, Simone Filice, Cesare Campagnano, Yoelle Maarek, Nicola Tonellotto, Fabrizio Silvestri · DOI

TL;DR

Standard Information Retrieval (IR) wisdom says we should provide Large Language Models (LLMs) with the most semantically similar documents possible. This paper flips that script, revealing that "distracting" documents (highly similar but answer-less) tank performance, while adding purely random noise can actually boost LLM accuracy by up to 35%.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) is the industry standard for grounding LLMs in factual, up-to-date information. By fetching relevant passages and stuffing them into the prompt, we hope to reduce hallucinations. However, the authors argue that we don't actually know what "ideal" retrieval looks like for a generator.

Current retrievers are optimized for semantic similarity. But what happens when a retriever finds a document that is contextually perfect but doesn't contain the answer? These "distracting" documents can lead the model astray. The authors set out to systematically examine how the type, number, and position of retrieved documents affect the final answer's accuracy.

Methods

The researchers conducted a comprehensive study using a two-step RAG architecture: a retriever (Contriever or BM25) and a generator (various LLMs). They categorized documents into four types:

  • Gold (⋆): The specific passage containing the answer.
  • Relevant (®): Other passages containing the correct answer.
  • Distracting (a): Semantically similar to the query but lacking the answer.
  • Random (): Completely unrelated "noise" documents.

They tested several popular open-source LLMs, including Llama2-7B, Falcon-7B, Phi-2, and MPT-7B, reducing them to 4-bit representations for efficiency. The core of their methodology involved varying the prompt composition—mixing gold documents with different amounts of distracting or random noise—and shifting the position of the gold document (Near, Mid, or Far relative to the query).

Datasets

The study primarily utilized the Natural Questions (NQ) and NQ-open datasets, which consist of real-world Google search queries paired with Wikipedia passages. To test the limits of "randomness," they also pulled noise documents from the Reddit Webis-TLDR-17 dataset and even generated nonsensical strings of random words.

Key Insights and Ideas

  • Distracting Documents are Poison: The most counter-intuitive finding is that the "best" documents from a traditional IR perspective—those highly similar to the query but without the answer—are the most damaging. Even adding a single distracting document can cause a 25% drop in accuracy.
  • The "Lost in the Middle" Phenomenon: Corroborating previous research, the authors found that LLMs struggle when the relevant information is buried in the middle of a long prompt. Accuracy is highest when the gold document is placed "Near" the query.
  • The Unreasonable Effectiveness of Noise: In a shocking twist, adding purely random, unrelated documents to the prompt often improved performance.
  • Attention Entropy: The authors hypothesize that noise helps prevent "entropy collapse." When a prompt is too focused on semantically similar but irrelevant text, the model's attention becomes overly concentrated on the wrong things. Adding noise increases the entropy of the attention mechanism, potentially allowing the model to "reset" and find the needle in the haystack more effectively.
Figure 3: Heatmap showing how the model's attention is misdirected toward distracting documents (left) instead of the gold document (right).

Key Results

The quantitative impact of prompt composition was stark across all models tested:

  1. Distraction Impact: As shown in Table 1, adding distracting documents led to a progressive degradation of accuracy. For Llama2, accuracy fell from 0.5642 (gold only) to 0.2348 when 18 distracting documents were placed "Far" from the query.
  2. Noise Benefit: Table 2 shows that in the "Near" setting, adding random documents actually improved accuracy for several models. MPT-7B saw a massive jump, with accuracy rising from 0.2148 to 0.2930 (+36%) by adding just 4 random documents.
  3. RAG in Practice: When using a real retriever (not an oracle), adding random documents to the retrieved set consistently helped. For Llama2 using Contriever, adding noise to a set of 4 retrieved documents resulted in a 35% relative gain in accuracy.
  4. Sparse vs. Dense: Interestingly, the "old school" BM25 (sparse retrieval) outperformed the modern Contriever (dense retrieval) in this RAG setup, likely because BM25's lexical matching provided fewer "semantically similar but wrong" distractors.
Table 1: Accuracy results of the LLMs when evaluated with prompts composed of the gold document ⋆and a varying number of distracting a documents. The table illustrates how the inclusion of an increasing number of distracting documents affects LLM’s performance. Scenarios where the prompt exceeded the model’s input limit, leading to potential data truncation, are not included ( - ). All values not marked with an asterisk * denote statistically significant changes from the gold-only document scenario [I, ⋆, Q] (first row), as determined by a Wilcoxon test (p-value < 0.01). Additionally, the closed-book accuracy scores for the models are as follows: Llama2 (0.1123), MPT (0.1205), Phi-2 (0.0488), Falcon (0.1083).

Limitations and Future Work

The authors acknowledge that their evaluation is based on binary accuracy (checking if the exact answer string exists in the output), which might miss nuanced but correct variations. The study also focused on short-answer open-domain QA; it remains to be seen if these findings hold for long-form generation or summarization.

The most significant area for future work is uncovering the precise mechanical reason why noise helps. While "attention entropy" is a compelling theory, more research is needed to design a new generation of retrievers that don't just look for similarity, but specifically avoid "distractors" while perhaps strategically including "noise" to keep the generator sharp.

Summary updated

BibTeX
@inproceedings{cuconasu2024power,
  author = {Florin Cuconasu and Giovanni Trappolini and Federico Siciliano and Simone Filice and Cesare Campagnano and Yoelle Maarek and Nicola Tonellotto and Fabrizio Silvestri},
  title = {{The Power of Noise: Redefining Retrieval for RAG Systems}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2024},
  doi = {10.1145/3626772.3657834},
}
Figure