Abstract
Retrieval-Augmented Generation (RAG) has become a cornerstone for providing Large Language Models (LLMs) with external, up-to-date knowledge. However, as retrieval depth increases, systems often encounter significant performance bottlenecks due to noise and redundancy. We introduce $EDC^2$-RAG (Efficient Dynamic Clustering-based document Compression), a novel framework that addresses these challenges through dynamic semantic clustering and parallel query-aware compression. By grouping similar documents and distilling relevant evidence, $EDC^2$-RAG enhances generation accuracy and reduces token costs, even in highly cluttered retrieval environments.
Introduction
While RAG systems effectively mitigate model hallucinations by providing factual context, the common practice of retrieving a high number of documents (e.g., $k=20$ to $k=100$) introduces a "more data, more problems" scenario. Standard RAG pipelines often treat retrieved documents as isolated units, ignoring the semantic relationships between them. This oversight leads to two primary quality flaws:
- Noise: Irrelevant documents that distract the LLM, potentially leading to incorrect or hallucinated answers.
- Redundancy: Multiple documents repeating the same information, which consumes the context window and inflates inference costs without adding value.
$EDC^2$-RAG proposes a shift from treating documents as a flat list to treating them as a structured semantic landscape, using clustering to identify consensus and filter out outliers.
The $EDC^2$-RAG Framework
The $EDC^2$-RAG pipeline operates as a post-retrieval optimization layer designed to maximize information density before the final generation phase. The process consists of four primary stages:
1. Dynamic Semantic Clustering
Rather than passing raw documents directly to the generator, the system first encodes them into dense vectors using SimCSE-BERT. A graph-based algorithm then groups these vectors into clusters based on semantic similarity. This step effectively identifies which documents are discussing the same concepts, allowing the system to recognize both consensus and unique outliers.
2. Query-Aware Compression
For each identified cluster, a smaller, high-speed LLM (such as GPT-4o-mini) performs a targeted distillation. The model is tasked with extracting only the information that is verifiable and directly relevant to the user's specific query. This removes "fluff" and ensures that only the most potent evidence remains.
3. Parallel Processing
To mitigate the latency typically associated with multi-step LLM pipelines, $EDC^2$-RAG processes these clusters in parallel. Because each cluster is independent, the summarization tasks can be executed simultaneously, keeping the total "wall-clock" latency low enough for real-time applications.
4. Final Generation
The distilled summaries from all clusters are concatenated into a single, information-dense prompt. This refined context is then fed into the primary LLM to produce the final response.
Experimental Evaluation
The researchers evaluated $EDC^2$-RAG across several benchmarks to test its versatility in synthesis and fact-checking:
- Knowledge-QA (KQA): Evaluated using WebQ (single-hop), 2WikiMultiHopQA, and Musique (multi-hop) to test the ability to synthesize answers from disparate sources.
- Hallucination Detection: Tested via FELM, WikiBio GPT-3, and HaluEval to determine if the framework helps models correctly identify factual errors.
- Redundancy Stress Testing: A custom version of the WebQ dataset was created with varying levels of document repetition (up to 95%) to test the system's robustness against redundant noise.
Key Insights and Results
Superior Accuracy and Robustness
$EDC^2$-RAG consistently outperformed standard RAG baselines. On the Musique dataset, it achieved the highest average F1-scores compared to other methods like "Long Agent" or standard chunk compression. Notably, in high-redundancy settings (95% repetition), the method showed a peak gain of +6.18 F1 points over vanilla RAG on the WebQ dataset.
The "Noise-Gate" Effect
One of the most significant findings was the framework's ability to handle "trash" documents. In experiments where 100% of the retrieved documents were distractors, $EDC^2$-RAG significantly outperformed vanilla RAG. The clustering mechanism acts as a natural filter; outlier documents that do not fit the semantic consensus of the clusters are more easily identified and discarded during the compression phase.
Efficiency at Scale
While adding a compression step introduces an initial cost, the reduction in the final prompt size leads to a net gain in efficiency for large retrieval depths. For $k=100$, the total API cost was lower than standard RAG methods because the final generation—the most expensive part of the process—was performed on a much smaller, more relevant set of tokens.
Limitations and Future Work
The authors noted that the effectiveness of the compression step is dependent on the intelligence of the summarization model; smaller open-source models (e.g., Qwen-3-8B) struggled more with distillation than GPT-4o-mini. Additionally, the quality of the initial clusters is tied to the performance of the embedding model (SimCSE-BERT).
Future research will focus on testing the framework with a broader range of base models and exploring more sophisticated methods for resolving conflicting information that may arise between different document clusters.
Conclusion
$EDC^2$-RAG demonstrates that by exploiting inter-document relationships through dynamic clustering, RAG systems can become both more accurate and more cost-effective. By transforming a cluttered retrieval set into a concise, query-relevant summary, the framework allows LLMs to focus on what matters most: generating high-quality, factually grounded answers.
Summary updated