Editor’s introduction
The TRIO framework evaluates retrieval-augmented generation by introducing three agents that iteratively refine queries, assess context adequacy, and generate answers. Each agent is trained on task-specific data using reinforcement learning or supervised fine-tuning, with rewards derived from improved answer quality and context sufficiency. However, the evidence is limited to short-answer QA tasks and does not include validation on live web search or long-form content generation. The framework may struggle with extended retrieval chains due to potential error accumulation and lack of robustness in dynamic environments where document availability or structure varies over time.
Introduction
Large language models (LLMs) have achieved remarkable success in natural language understanding and reasoning. By pre-training on a series of high-quality instruction datasets, LLMs can acquire a wide range of factual knowledge. These pre-trained models have enabled a wide range of applications beyond conventional language tasks. Nevertheless, pre-trained models may fail to capture the most up-to-date information in highly specialized domains, particularly those involving private or sensitive knowledge, such as healthcare and law. This issue limits LLMs’ capabilities on some knowledge-intensive tasks, even leading to hallucinations.
To enhance the response quality, RAG has been employed as a framework that leverages external knowledge to reduce reliance on the pre-trained LLMs’ parametric knowledge. Typical RAG systems include two main steps: retrieval and generation. In the retrieval step, the key point is to locate the lacking knowledge and define a retrieval query to retrieve the knowledge from an external corpus. And then, in the generation stage, the retrieved contents are integrated with the original question and fed into the LLM. The augmented input provides the LLM with relevant knowledge and the latest information, thereby enhancing the quality of responses and reducing hallucinations. The main advantage of RAG is that it provides external contextual information to answer questions when combined with the model’s parametric knowledge. However, this advantage is constrained by two challenges. First, the system may not be able to accurately identify the missing knowledge and generate an effective query for retrieval. An inefficient query formulation may lead to the retrieval of numerous irrelevant or even biased documents, thereby increasing the model’s reasoning burden. Second, even when relevant documents are retrieved, the model may be unable to appropriately utilize the provided context, which may lead to further hallucinations.
Existing approaches to optimizing the pipeline of RAG include the branching method, context ranking, and iterative retrieval. These approaches merely adjust the pipeline of RAG, remaining insufficient to counteract the noise or bias introduced by retrieved knowledge. Furthermore, many recent works fine-tune specific LLMs for the RAG pipeline to improve robustness and factual consistency in the generation stage. Such efforts include supervised fine-tuning with human-annotated datasets and utilizing reinforcement learning to integrate reasoning ability with retrieval. However, by placing the burden of generating retrieval queries and answering on the same backbone model, these approaches inherit the models’ intrinsic biases, limiting their robustness and ability to generate effective queries.
Recently, a growing trend in LLMs is to break complex processes into multiple specialized agents or modules that work collaboratively. Instead of uniform models handling everything, each agent is responsible for a specific subtask in multi-agent systems. This paradigm has also been introduced into the RAG framework, resulting in a remarkable improvement in removing hallucinations and effectively utilizing external knowledge. However, existing multi-agent RAG frameworks still share the same backbone without adaptive adjustment, which potentially undermines response reliability.
To address these challenges, we propose a multi-agent system with Task Refinement and Individual Optimization (TRIO), an innovative multi-agent collaborative RAG system that tightly couples the retrieval and generation stages to improve retrieval and answer quality. Unlike existing multi-agent RAG approaches that utilize uniform backbones, TRIO assigns task-adaptive agents to distinct subtasks, allowing each agent to specialize in its role. This targeted specialization enables the system to pinpoint missing knowledge and utilize retrieved knowledge more effectively, yielding higher answer quality. Because each agent operates on a narrow slice of the pipeline, TRIO also lowers training cost and improves reliability.
Related Work
Retrieval-Augmented Generation. Large language models have achieved strong performance across diverse tasks. However, they remain susceptible to hallucinations and insufficient context. Retrieval augmented generation addresses this limitation by retrieving external evidence and conditioning the model’s output on the retrieved context. Early RAG pipelines use the original input as a query to search on an external corpus, and then integrate the retrieval context into the model’s input as supplementary knowledge. To meet more complex retrieval needs, many methods introduce iterative retrieval generation branching or loops, letting the model adapt its retrieval strategy when evidence is insufficient. With the rise of chain-of-thought prompting, reasoning traces have also been used to improve retrieval efficiency and recall. Some multi-agent methods have also been explored in RAG to enhance retrieval quality. Despite these advances, most existing methods still share a single backbone model across all roles in the RAG pipeline and lack targeted fine-tuning, which limits further performance gains. Multi-Agent System. Recent work shows that several agents’ interactions can substantially enhance LLM capabilities across three main regimes. First, debate-based frameworks run adversarial dialogues or critiques in which agents challenge each other to refine reasoning and factuality. Second, ensemble coordination runs multiple agents in parallel with minimal communication and aggregates their outputs via voting, validation, or game-theoretic consensus. Third, role-specialized collaboration assigns complementary roles to decompose problems and iteratively refine solutions. However, the multi-agent setting for RAG remains underexplored. Contemporary RAG pipelines typically rely on a single LLM to both retrieve and generate, with limited support for collaboration among specialized agents.
Answer Agent Optimization with Matching-based Reinforcement Learning
The answer agent is responsible for using the retrieved content to answer questions with high accuracy. The primary goal for training the answer agent is to enhance the utilization of retrieval content and avoid hallucinations. To train the agent, we build a training corpus that spans different numbers of retrieval steps and various chunk set sizes, enabling the agent to learn to ignore biases in the context and focus on the key evidence.
We sample training questions for the answer agent from multi-hop QA datasets, assigning difficulty labels (easy/medium/hard) and retaining medium and hard questions following. We then construct a retrieval-only debate pipeline that iteratively refines retrieval queries and retrieved contents, capping the debate at three rounds. We store the query pool and retrieved chunks at the end of each debate round, treating each snapshot as a training sample. For each question, we generate multiple training samples per question by varying the number of collected queries and chunks. This setup trains the agent to filter noise and focus on key evidence across different context sizes. Further details on the debate pipeline are provided in Appendix C.
Query Extension Agent Optimization with Outcome-based Reward
The goal of retrieval-query generation in RAG is to identify gaps in the current context and generate new retrieval queries, reducing whole-context bias and thereby providing the key evidence needed by the answer agent. Existing methods struggle with a lack of a clear signal to judge the quality of a single query. In TRIO, we train an adaptive query extension agent to improve retrieval quality based on the answer agent’s generation quality.
Judge Agent Optimization with Inductive Supervised Fine-tuning
To decide whether the query extension agent has retrieved sufficient evidence and when to stop retrieval and begin answering, thereby limiting hallucinations from long contexts. The judge agent estimates whether the retrieved context is sufficient for the current answer agent to answer correctly.
As with the query extension agent, we use the answer agent’s response quality as the sole supervision signal for judging context quality. Unlike the query extension agent, the judge is trained via supervised fine-tuning. For training data generation, we also sample questions from multi-hop QA datasets and use the same Debate-RAG method with Section 3.2 to generate judge training samples. In order to get the supervised signal for the judge agent, we follow the test-time labeling method in, run the answer agent on each sample, and draw 16 stochastic predicted answers. If all 16 are correct, we label the sample as ‘Sufficient Information’; if all 16 are incorrect, we label it ‘Insufficient Information’. This procedure yields reliable supervised signals, helping the judge learn to assess context sufficiency across various domains and context lengths. Finally, we combine these labeled samples to form the judge enhancement dataset, used to train the judge agent via supervised fine-tuning.
Inference Pipeline
With well-designed training, each agent within TRIO coordinates closely to generate concise outputs. At inference time, the three agents collaborate to acquire external knowledge through two main steps: the retrieval step and the answer step. Standard RAG methods often suffer from insufficient or irrelevant retrieval chunks in the retrieval process. To address this, TRIO tightly couples the agents to ensure precise cooperation in an iterative retrieval process. Starting from an initial retrieval, the query agent uses the current context to identify knowledge gaps and generate targeted new queries, while the judge agent dynamically judges whether the accumulated information is sufficient to halt the iteration. This precise cooperation ensures the finalized query pool and retrieved chunks are highly concise. Once sufficient information is gathered, we switch to the answer step in which the answer agent generates the final answer based exclusively on the current context.
As the query and judge agents collaborate effectively to supply only the strictly necessary evidence, the answer agent is relieved from processing massively irrelevant contexts. Consequently, TRIO can generate highly concise output tokens to reach an accurate conclusion, mitigating hallucination risks and significantly improving overall inference efficiency. The detailed inference loop and agent prompts are provided in Appendix B.
Experimental Settings
Baselines. We implement base RAG with different generation models, which represents the basic RAG method without optimization. Moreover, we compare TRIO with several recent RAG methods, including branching method SuRE, loop method Self-RAG, IRCoT, and Iter-RetGen, R1 style reasoning RAG method Search-R1, R1-Searcher, and multi-agent debate method DRAG. Datasets & Evaluation metrics. Evaluation experiments are conducted on the dev or test datasets of five benchmarks: Hotpotqa, 2Wiki, NQ, Musique, and Bamboogle. Hotpotqa and 2Wiki are in-domain datasets because parts of their training sets are used to train our agents and other training-based baselines. NQ, Musique, and Bamboogle are out-of-domain datasets used solely for evaluation. For evaluation metrics, we report the exact match score in the results. Implementation Details. All compared models are reproduced and evaluated using FlashRAG. We employed E5-base-v2 as the retriever, and the retrieval corpus using the Wikipedia dump 2018. For each question, the external evidence is capped at 20 retrieved chunks. In the training processes of our TRIO, the backbone models are Llama3.1-8B-Instruct for TRIO-8B and Qwen3-4B-Instruct for TRIO-4B. We select questions from the training sets of Hotpotqa and 2Wiki to generate training samples. The trained models for the three agents are available in our code. More details are provided in Appendix B.
Efficiency Analysis
In contrast, TRIO-4B achieves 98% of the performance of reasoning-based methods while requiring only half the inference time. Furthermore, TRIO-8B outperforms these reasoning baselines while using slightly less inference time. As further analyzed in Appendix D, TRIO’s efficiency stems from generating a highly compact number of output tokens during inference. This minimal token generation makes it highly suitable for large-scale real-world deployment while maintaining interpretability.
Conclusion
We present TRIO, a framework that enhances RAG by coordinating three individually optimized agents for query extension, context sufficiency judgment, and answer generation. Starting from question-answer supervision only, we design distinct data generation methods for each subtask and optimize agents using reinforcement learning or supervised fine-tuning with their specific corpora. Experiments demonstrate that TRIO-8B achieves the best average score and the best result on four of the five main benchmarks. Our analysis reveals that subtask-specific training corpora and mixed reward functions enhance each agent’s specialization, while effective coordination improves answer quality. TRIO can be readily extended to various scenarios and provides a new direction for incorporating multi-agent cooperation into RAG systems.
Limitations
TRIO demonstrates strong effectiveness in improving retrieval efficiency and answer quality in different benchmarks. However, TRIO is evaluated primarily on short-answer QA and has not yet been validated for live web search or long-form generation. Its adaptive loop may fail when on tasks requiring very long-form responses or extended retrieval chains, as errors and irrelevant evidence may accumulate across retrieval rounds and hinder effective answer generation. Live web search may introduce additional challenges, including changing document availability and heterogeneous webpage structures. Future work should calibrate retrieval-stopping decisions and evaluate these failure modes in dynamic, real-world corpora.
Prompts of Inference
The prompt below is for the query extension agent to generate exactly one new retrieval query in a multi-step retrieval process. Given the question, the existing query pool, and retrieved documents, the agent identifies missing information and proposes a keyword-based query. The output is strictly limited to at most eight keywords, with no sentences or stopwords, and must differ from all existing queries to encourage diversity and reduce redundant retrieval.
The prompt below instructs the answer agent to produce a final answer using the retrieval context associated with the current query pool. The agent is required to output only the final answer, without explanations or additional text, ensuring a clean, comparable output format. This design supports consistent evaluation of answer correctness across different inference settings.
The prompt below guides the judge agent in deciding whether the existing queries and retrieved documents provide sufficient information to answer the question correctly. The agent outputs only a binary decision: “Sufficient Information” or “Insufficient Information”, with no further explanation. This minimal output enables the system to control whether additional query expansion and retrieval rounds are needed.
Prompts in Training
The prompt below is used to train the Judge Agent to output a binary sufficiency label indicating whether the current queries and retrieved documents contain sufficient evidence to answer the question correctly. It enforces a strict output format (“Sufficient Information”/“Insufficient Information”) to enable consistent supervision.
The prompt below is used to train the Query Extension Agent to produce one additional keyword query based on the question and the current retrieval results. The output is constrained to a short, non-overlapping query to encourage informative and diverse retrieval during training.
The prompt below is used to train the Answer Agent to produce the final answer from the provided multi-query retrieval context. It presents the question along with the existing queries and their retrieved documents, and enforces an answer-only output without explanations to maintain consistency in supervision and evaluation.
Comparison with Existing Adaptive RAG Methods
Existing adaptive RAG methods differ in where adaptation is introduced. RQ-RAG trains a query-refinement model. IRCoT interleaves prompting-based reasoning and retrieval. Self-RAG trains a single generator to emit reflection tokens. Search-R1 and R1-Searcher optimize a single retrieval-reasoning policy. DRAG and MA-RAG coordinate role-specialized agents mainly through debate or collaborative prompting without task-specific training. In contrast, TRIO sequentially optimizes separate query-extension, stopping, and answer agents, with answer agent outcomes providing supervision for query extension and sufficiency judgment.


