Retrieval-augmented language models (RALMs) are a powerful way to give language models access to external knowledge by retrieving relevant documents and prepending them to a user's prompt. However, this naive "retrieve-and-prepend" approach has major drawbacks. Prepending hundreds or thousands of tokens makes inference substantially more expensive and slower. Furthermore, LMs struggle to effectively process long contexts, often missing information buried in the middle of retrieved documents, and irrelevant information can confuse the LM, causing it to hallucinate or copy incorrect answers.
To address this, researchers introduce RECOMP, a framework that compresses retrieved documents into concise, helpful summaries—or an empty string if unhelpful—before passing them to the LM. This approach achieves up to a 94% reduction in context length while maintaining downstream task performance and significantly reducing LM distraction.
The RECOMP Methodology
The core idea behind RECOMP (Retrieve, Compress, Prepend) is to insert a compression step between the retrieval of documents and the final generation by the language model.
The authors propose two types of lightweight compressors. Unlike standard summarization models that optimize for human readability, both RECOMP compressors are uniquely trained to optimize the end-task performance of the target LM:
- Extractive Compressor: A dual-encoder model (initialized from Contriever) that scores individual sentences from the retrieved documents. It is trained using contrastive learning, where a "positive" sentence is one that maximizes the target LM's probability of generating the correct answer.
- Abstractive Compressor: An encoder-decoder model (T5) trained via knowledge distillation from a large teacher model (GPT-3.5). The researchers generate candidate summaries using the teacher, but crucially, they use the target LM as a "critic."
If prepending the summary doesn't improve the target LM's performance over using no documents at all, the target summary is set to an empty string. This empty string mechanism enables selective augmentation—the model learns to provide zero context when the retrieved documents are useless, saving compute and preventing distraction.
Key Insights and Results
The researchers evaluated RECOMP on Language Modeling (WikiText-103) and Open-Domain Question Answering (Natural Questions, TriviaQA, and HotpotQA) using a December 2018 Wikipedia dump as the retrieval corpus.
Massive Compression and Speedup
Standard summarization models often fail in RALM settings because they merely summarize text without considering what the LM actually needs. RECOMP succeeds by evaluating summaries based on a pragmatic metric: Does this text actually help the LM get the right answer?
On QA tasks, the abstractive compressor reduced the context from 660 tokens (top 5 documents) down to just ~36 tokens (a ~5% compression rate) while losing less than 10% relative Exact Match (EM) performance. This massive compression enabled a 2x throughput increase during inference compared to prepending full documents, even when accounting for the time it takes to run the compressor.
Reduced Distraction and Hallucination
Feeding LMs raw documents often causes them to blindly copy incorrect information that "looks" like an answer. By compressing the text, RECOMP drastically reduces this erroneous copying behavior. When prepending 5 full documents, the LM incorrectly copied text from the context 81% of the time when the gold answer wasn't present. RECOMP reduced this erroneous copying to just 39%.
Furthermore, the abstractive compressor learns to output empty strings for 4-24% of the training data. This proves that LMs are often better off relying on their own parametric knowledge than being forced to read irrelevant retrieved documents.
Transferability Across Models
As shown in the language modeling results above, compressors trained to help a smaller model (GPT-2) successfully transferred to larger models like GPT-2-XL and GPT-J. The compressed contexts maintained low perplexity (PPL) while drastically reducing the number of in-context tokens compared to raw retrieval.
Extractive vs. Abstractive Trade-offs
While abstractive compression is highly efficient for straightforward QA, the extractive approach actually performs better for complex, multi-hop reasoning (like HotpotQA). Even massive teacher models struggle to synthesize accurate multi-hop summaries, making extractive sentence selection more reliable in those edge cases.
Limitations and Future Work
While the compressors transferred well across models for language modeling, they struggled to transfer across different model families for QA (e.g., a compressor trained for Flan-UL2 did not work well for LLaMA-13B). This is likely because different LMs have different internal knowledge gaps.
Additionally, the abstractive teacher model (GPT-3.5) struggled to generate faithful summaries for the multi-hop HotpotQA dataset, bottlenecking the student compressor's performance. Future directions include exploring dynamic-length extractive compression (which currently selects a fixed number of sentences) and developing universally transferable QA compressors that aren't over-fitted to a single LM's parametric knowledge.
Summary updated