MAIN-RAG: Multi-Agent Filtering Retrieval-Augmented Generation

Chia-Yuan Chang, Zhimeng Jiang, Vineeth Rakesh, Menghai Pan, Chin-Chia Michael Yeh, Guanchu Wang, Mingzhi Hu, Zhichao Xu, Yan Zheng, Mahashweta Das, Na Zou

Abstract

Retrieval-Augmented Generation (RAG) has become a cornerstone for grounding Large Language Models (LLMs) in external knowledge. However, the performance of these systems is often degraded by the inclusion of irrelevant or noisy documents during the retrieval phase. We present MAIN-RAG, a training-free, multi-agent framework designed to filter noise and improve generation quality. By utilizing a collaborative pipeline of LLM agents and a dynamic, adaptive filtering threshold, MAIN-RAG improves answer accuracy by up to 11% across multiple benchmarks without the need for computationally expensive fine-tuning.

Introduction

While RAG systems are effective at providing context to LLMs, they are frequently victim to the "garbage in, garbage out" problem. Retrievers often return a mixture of highly relevant documents and irrelevant noise. When an LLM processes this noise, it is prone to hallucination, increased computational costs, and reduced reliability.

Existing solutions often involve fine-tuning models to be more "noise-robust," but these methods are difficult to scale and expensive to implement. MAIN-RAG proposes an alternative: a robust filtering layer built using off-the-shelf LLMs. The core question addressed is whether the inherent reasoning capabilities of existing models can be harnessed to perform high-quality filtering through a structured, multi-agent approach.

Methodology

MAIN-RAG implements a three-agent collaborative framework that serves as a post-retrieval quality control layer. The process is divided into three distinct stages:

  1. Agent-1 (The Predictor): For every retrieved document, this agent generates a candidate answer to the user's query, creating a "Document-Query-Answer Triplet."
  2. Agent-2 (The Judge): This agent evaluates the triplet to determine if the document supports the generated answer. Rather than a binary output, the system extracts the log probabilities of the "Yes" and "No" tokens to produce a continuous relevance score.
  3. Agent-3 (The Final-Predictor): Once the noise is filtered and the remaining documents are ranked by their relevance scores, this agent synthesizes the final response for the user.

The Adaptive Judge Bar

A critical innovation in MAIN-RAG is the Adaptive Judge Bar ($\tau_q$). Instead of using a static threshold for filtering, MAIN-RAG calculates a dynamic threshold for each specific query based on the distribution (mean and standard deviation) of the scores within that document batch. This flexibility allows the system to lower the threshold for difficult queries where all documents might have lower scores, ensuring that potential information is not prematurely discarded.

Experimental Evaluation

The framework was evaluated using Mistral-7B and Llama-3-8B across four diverse benchmarks:

  • TriviaQA-unfiltered: Large-scale reading comprehension.
  • PopQA: Focusing on "long-tail" entities where LLMs lack internal knowledge.
  • ARC-Challenge: Difficult scientific exam questions.
  • ASQA: Long-form generation and factoid accuracy.

Key Insights

  • The Confidence Gap: Analysis revealed that LLMs are significantly more confident when scoring relevant documents, exhibiting high scores with low variance. Conversely, noisy documents result in a wider, more uncertain distribution of scores.
  • The Importance of Ranking: The study confirmed the "lost in the middle" phenomenon, where the position of information in the context window affects performance. By ranking documents according to the Judge's relevance score, MAIN-RAG ensures the most critical information is prioritized for the final generator.
  • Training-Free Superiority: MAIN-RAG's multi-agent approach outperformed specialized, fine-tuned models such as Self-RAG. This suggests that the reasoning capabilities of off-the-shelf LLMs are sufficient for filtering when prompted correctly.

Results

MAIN-RAG consistently outperformed traditional RAG baselines, yielding a 2–11% improvement in answer accuracy. The system proved to be model-agnostic, showing strong results with both Mistral and Llama architectures. Notably, on the PopQA dataset—which targets obscure facts—MAIN-RAG achieved a 6.1% boost with Mistral and an 11.3% boost with Llama-3 compared to standard RAG implementations.

Limitations and Conclusion

Despite its performance gains, MAIN-RAG introduces higher inference overhead and latency due to the multiple agent steps required for each document. This increased token usage also results in a higher carbon footprint compared to single-pass systems.

In conclusion, MAIN-RAG provides a powerful, training-free method for cleaning the noise in RAG pipelines. Future research will focus on refining the adaptive thresholds and exploring the integration of human feedback (RLHF) to further improve the judging process.

Summary updated

BibTeX
@inproceedings{chang2025main,
  author = {Chia-Yuan Chang and Zhimeng Jiang and Vineeth Rakesh and Menghai Pan and Chin-Chia Michael Yeh and Guanchu Wang and Mingzhi Hu and Zhichao Xu and Yan Zheng and Mahashweta Das and Na Zou},
  title = {{MAIN-RAG: Multi-Agent Filtering Retrieval-Augmented Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure