TL;DR
Retrieval-Augmented Generation (RAG) models can be slowed down and made less accurate by noisy retrieved documents. This paper introduces AdaComp, a novel method that adaptively determines how many retrieved documents are truly necessary for a given query, balancing accuracy and efficiency. AdaComp significantly reduces inference costs while maintaining performance comparable to uncompressed RAG systems.
What Problem Does This Paper Address?
Retrieval-Augmented Generation (RAG) models are powerful for knowledge-intensive tasks, but their performance hinges on the quality of retrieved documents. When these documents contain irrelevant information (noise), RAG models struggle to find the correct answers, leading to slower and more expensive inference. Existing context compression techniques, like extractive or generative methods, often over-compress (losing crucial information) or are computationally expensive. The core challenge is that the optimal number of documents needed for a RAG system to answer a query isn't fixed; it depends on factors like query complexity (e.g., multi-hop questions needing more context) and retrieval quality (poor retrieval might require more documents to compensate). This paper aims to solve the problem of adaptively determining this "compression rate" to maximize RAG efficiency without sacrificing accuracy.
Methods
AdaComp introduces a three-component architecture: a retriever, a compression module ($C_o$), and a generation module ($G$). The novelty lies in the compression module, which uses an adaptive context compression architecture.
- Compression Rate Annotation: The authors first establish a method to determine the "ground truth" compression rate. For a given query ($q$), retrieved documents ($D$), and target answer ($y$), they test subsets of the top-$k$ documents ($D_k$) to find the smallest $k$ for which the RAG system can produce the correct answer. This minimum $k$ becomes the target compression rate.
- Compression-Rate Predictor: They then train a predictor model (based on Llama2-7b) using these $(q, D, \hat{k})$ triplets. This predictor learns to estimate the optimal compression rate ($\hat{k}$) based on the query and retrieved documents. The predictor is trained to minimize a classification loss between its predicted rate and the annotated true rate.
- Adaptive Inference: During inference, the trained predictor takes the query and retrieved documents as input and outputs an estimated compression rate. The system then selects the top-$k$ documents corresponding to this predicted rate as the context for the generation module. This allows AdaComp to dynamically adjust the amount of context based on the perceived query complexity and retrieval quality.
Datasets
The paper evaluates AdaComp on four datasets:
- NQ (Natural Questions)
- TriviaQA
- HotpotQA
- Conversational Multi-doc QA (a newly introduced benchmark for conversational settings)
For retrieval, they use the adversarial Dense Passage Retriever (DPR) to fetch the top-5 passages from Wikipedia for each QA dataset.
Key Insights and Ideas
- Query Complexity and Retrieval Quality are Key: The paper's central insight is that the optimal amount of context for RAG is not static. It's a dynamic interplay between how complex the question is and how good the initial retrieved documents are.
- Adaptive Compression is Crucial: Unlike fixed compression methods, AdaComp's ability to adapt its compression rate based on these factors is what allows it to achieve both efficiency and high performance.
- Over-compression is a Real Problem: The results show that aggressive compression (like RECOMP) can significantly reduce token count but also lead to a noticeable drop in accuracy, highlighting the trade-off that AdaComp aims to balance.
- Predictor Accuracy Matters: The confusion matrix for the predictor shows reasonable accuracy (around 65%), with most prediction errors being within a margin of 2, indicating a good grasp of the required compression range.
Key Results
- Efficiency Gains: AdaComp significantly reduces the number of tokens used for inference compared to uncompressed RAG (e.g., Top-5 documents). For instance, on NQ, it uses 441 tokens compared to 802 for Top-5 documents, while maintaining similar performance.
- Performance Maintenance: AdaComp achieves performance (EM/F1 scores) nearly identical to or slightly better than uncompressed Top-5 document baselines across the tested QA datasets.
- Superiority over Other Compression Methods: AdaComp outperforms other compression baselines like RECOMP and FILCO in terms of both accuracy and efficiency.
- Effectiveness on Complex Queries: The paper highlights that AdaComp shows a more pronounced advantage on open-ended questions in the conversational dataset, demonstrating its ability to recognize and adapt to query complexity.
Limitations and Future Work
- Predictor Accuracy: While AdaComp's predictor is effective, its overall accuracy is around 65%, and it doesn't always predict the exact compression rate, though it stays close.
- Future Work: The authors suggest investigating the impact of retrieved document length on LLM answering capabilities and exploring new methods for more finely distinguishing situations where required document counts are very close, aiming to improve predictor accuracy.
Summary updated