先说结论
Chain of Agents用顺序阅读接力处理长文本,最后由管理代理整合通信结果。实验支持管理环节,但自然阅读顺序并非所有任务最优,信息传递也并非无损。 (原文:PDF p.3, Section 3;PDF p.4, Section 3; framework;PDF p.8, experimental setup;PDF p.8, Table 7;PDF p.8, Lost-in-the-middle analysis;PDF p.9, Limitations)
指标:Chain of Agents处理单个模型上下文装不下或难以利用的长文本。它把文档分块,让工作代理按顺序阅读并传递压缩后的相关信息,最后由管理代理作答。重点是信息如何接力,而不是让一群代理同时给独立答案再投票。
条件:仅限本地原始PDF的 Section 3;不同表格与实验不合并
PDF p.3, Section 3 · PDF p.3
information to feed into the LLM and (ii) Full-Context (Vanilla), which feeds all input into the LLM until reaching the window limit. Our results show that on all nine datasets, CoA obtains significant improvement over all baselines by up to 10%. Noting that there is not enough research on multi-agent for long context tasks, we carefully create two multi-agent baselines, including a hierarchical structure and result merging approach to further demonstrate that CoA is superior among other possible multi-agent frameworks. 2 Related work Multi-agent LLMs. Multi-agent LLMs has become a popular topic [19]. A large proportion of works focus on social simulation. “Generative agents” is a sandbox environment allowing 25 agents to communicate with each other [47], while “Social simulacra” extends to 1000 agents [48]. Based on the success of them, some works explore the game settings [35, 68, 75, 76, 42], world wars [21], economy markets [32, 70], recommendation systems [81], and pandemics [17]. Others advance problem solving, focusing on reasoning of short text via multi-agent debating [16, 73, 10, 60] and discussing [11, 53] for different tasks in reasoning [16, 60], mechanics problems [44], paper review [77], knowledge graph construction [79], and code intelligence [64, 22]. Different from the above works, we improve problem solving on long context tasks. To the best of our knowledge, the closest work utilizes a tree structure to do single-hop QA over long context [9]. However, it is not designed for multi-hop reasoning or other tasks without communication between sibling agents. Long Context Modeling for LLMs. Input Reduction: RAG is broadly leveraged to solve long context query-based tasks [74, 2]. Combined with a strong retriever [72, 37, 67], LLMs are expected to handle long context questions in open domains. Previous studies have augmented LLMs during pretraining [24, 66], finetuning [31], inference [80], or directly integrating [26, 55]. Moreover, some token-level retrieval approaches are proposed [34]. Longllmlingua [25] removes tokens from long prompt to compress long context prompt to a desired budget. Window Extension: The context windows of LLMs are getting longer and longer thanks to the development of GPUs. For instance, the context window increases from 1024 (GPT-2 [51]), 2048 (GPT-3 [7]), to 128k (GPT-4 [45]). Moreover, the newest version of Claude-3 [5] supports 200k context windows. To save the cost of LLM training, some continue learning or finetuning approaches are proposed to extend the context window of pretrained LLMs [41, 50, 40, 43]. For instance, position interpolation [13] modifies rotary position encoding [58] and extends the context length of LLaMA [62] to 32k. Different from the above works, CoA does not reduce the input length or extend the window length of LLMs, but rather leverages multi-agent collaboration and communication to obtain the full receptive field. Complex Task Reasoning. Previous works on complex reasoning have focused on decomposing the complex question into sub-questions to solve them step-by-step. [49] decompose the questions with an unsupervised model and answer them separately with another model. Decomposed Prompt- ing [27] leverages some predefined modules to classify each decomposed sub-question, then further decompose if needed. Additionally, decomposing is used for human-computer interaction [71], and prompter training [65]. Recently, many work has been proposed for LLMs, such as Chain- of-thought [69] Least-to-most prompting [85] and Pearl [59]. However, the length of the prompt does not exceed the context limit of a single agent. By contrast, our Chain of Agents framework is proposed to effectively reason across multiple agents to support the unlimited length of source text. 3 Method Figure 1 shows the overview of our Chain-of-Agents (CoA) framework, containing two stages. In stage 1, long context is split into chunks where each chunk can be processed by a worker agent. Then, the worker agents communicate sequentially to produce evidence over the entire context. In stage 2, a manager agent consumes the knowledge from the chain of workers to generate the final answer. To formulate the task, we denote a long-context sample as (x, y, q), where x is the input of n tokens, y is the output of m tokens, q is an optional query. Given a LLM with k tokens (usually k ≪ n) as the context window limit, the target is to generate y with the limited input context window. Therefore, we divide each source text x into chunks x = {c1 , c2 ...cl }, so that each chunk can be completely fed into the LLM agent backbone model. 3
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:工作代理接收任务、当前文本块和前一棒的通信内容,提取与问题相关的证据并更新通信单元,传给下一棒。管理代理根据接力得到的信息组织最终答案。这样每个工作代理只需要有限窗口,但早期证据能否到达终点,仍取决于中间代理是否正确保留和整合。
条件:仅限本地原始PDF的 Section 3; framework;不同表格与实验不合并
PDF p.4, Section 3; framework · PDF p.4
3.1 Stage 1: Worker Agent: Segment Comprehension and Chain-Communication In Stage 1, CoA contains a sequence of l number Algorithm 1 Chain of Agents (CoA). of worker agents. Each worker Wi inputs the concatenation of a chunk ci from source text Input: Source input x, query q, agent window size k, x, a query q, instruction for a specific task for large language model LLM(∗). Output: Answer to the query. worker agent IW , and the message passed from Split x into l chunks {c1 , c2 , · · · , cl } the previous agent, denoted as “communication where ci is shorter than k unit” CUi−1 . The worker agents process them Initialize CU0 ← empty string. and output the message CUi for next worker, for i in 1, 2, · · · , l do expressed as: CUi ← LLMWi (IW , CUi−1 , ci , q) end for CUi = LLMWi (IW , CUi−1 , ci , q), (1) return LLMM (IM , CUl , q) CUs produced by worker agents vary across dif- ferent tasks. For question answering, CU contains the evidence for the manager to answer the question. For summarization, CU contains the summary of the previous texts. For code completion, CU contains the code summary with function/class names and explanation. Effectiveness on diverse tasks demonstrates the flexibility of CoA (Appendix C). The multi-step worker communication in CoA expands the model context to the full receptive field, meaning that the last worker can read the full input no matter how long the input is. Therefore, CoA is extensible to inputs with different lengths by adjusting the number of worker agents. The left side of Figure 1 underscores the necessity of collaborative communication among workers to effectively address complex, long-context reasoning tasks. We observe that 1) Although the question is unanswerable given c1 , W1 generates related evidence that is useful for answering the question; 2) with the partial answer from the previous worker, W2 further reasons with the current source to complete the full reasoning chain across agents and generate the interpretative reasoning chain; 3) W3 finds no related information in the chunk 3, it directly rewrites CU2 by putting the correct answer as the first token of CU3 without adding any unrelated information. This shows that if workers are independent (such as tree structure communication), it is impossible to answer hop two while the answer of hop one is held by another worker. 3.2 Stage 2: Manager Agent: Information Integration and Response Generation In Stage 2, after multiple steps of information extraction and comprehension by worker agents, the manager agent produces the final solution. While worker agents extract relevant information in a long-context source, the manager agent synthesizes relevant information accumulated by the end of “worker-agent-chain” to generate the final answer. Specifically, given the instruction for manager IM and query q, the manager agent consumes accumulated knowledge from last worker CUl and generates the final answer Response: Response = LLMM (IM , CUl , q) (2) The benefit of using a separate LLM as the manager agent is to decompose the duty of analyzing chunks in the long-context source (“worker agents”) and producing the final answer (“manager agent”), so that every agent can fulfill its duty to the most3 . 3.3 Time Complexity Analysis Table 2: Time complexity. We compare the time cost of full-context input and Chain-of- Agents theoretically in a decoder-only setting. We assume Encode Decode the response generated by LLMs contains r tokens on aver- Full-Context O(n2 ) O(nr) age, the input has n tokens, and the context limit of LLM is CoA O(nk) O(nr) k. The time complexity is shown in Table 2 (Appendix A). As can be seen, the encoding time of CoA is less than Full- Context because k ≪ n in long context tasks, while they have the same decoding time. This demonstrates the efficiency of CoA compared with the Full-Context baseline. 3 Other design choices: Our experiments show that using the last worker Wl to directly generate the final result leads to a performance drop. Besides, feeding the manager with all CUi or some CU that is related to the answer (decided by Wi ) also hurts the performance because of confusion led by conflicting CUi . 4
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:作者通过删除管理代理、改变工作代理数量和文本顺序等消融,检验接力式信息整合。多跳问答数据集对不同组件的敏感性不同,因此主要观察应逐任务陈述。
条件:仅限本地原始PDF的 experimental setup;不同表格与实验不合并
PDF p.8, experimental setup · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:MuSiQue上完整CoA为37.09,去掉Manager后为26.79,支持最终整合环节的作用。但HotpotQA中Permutation为56.05,Left to Right为53.62,不能宣称从左到右在所有任务都是最佳顺序。不同任务对顺序与信息整合的敏感程度不同。
条件:仅限本地原始PDF的 Table 7;不同表格与实验不合并
PDF p.8, Table 7 · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:作者分析重要信息处于不同位置时的表现变化。读这组结果应关注位置变化后的波动是否缩小,而不是把某种平均改进解释为完全不再丢失中间证据。顺序接力与最终管理降低了直接塞入超长上下文的压力,但仍存在信息选择和传递环节。
条件:仅限本地原始PDF的 Lost-in-the-middle analysis;不同表格与实验不合并
PDF p.8, Lost-in-the-middle analysis · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:框架不要求把完整原文都交给最后的管理代理,因此压缩与整合错误仍值得检查。论文的基准改进不等于对所有长文问题都无损读取,也没有证明增加任意数量的工作代理都能继续提高效果。是否保留了问题所需证据,比代理数量本身更重要。
条件:仅限本地原始PDF的 Limitations;不同表格与实验不合并
PDF p.9, Limitations · PDF p.9
Table 8: Comparison of three multi-path augmentation through judge or voting. Multi-path CoA furthers enhance the performance. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P Bi-direction: left-to-right and right-to-left paths (2-way) w/ judge 54.11 36.97 24.47 39.23 65.00 16.41 49.69 w/ vote 51.46 34.16 21.59 37.42 64.60 9.51 38.70 oracle 62.12 48.02 32.84 46.37 71.80 18.83 59.67 Self-Consistency: five left-to-right reasoning paths (5-way) w/ judge 57.17 38.82 21.58 36.24 62.80 17.06 46.97 w/ vote 57.49 40.78 25.56 39.15 68.60 8.35 35.56 oracle 67.07 55.74 39.89 52.74 80.40 20.81 63.52 Permutation: five random order reasoning paths (5-way) w/ judge 59.17 42.37 25.47 37.65 63.40 17.81 52.45 w/ vote 58.29 39.17 26.58 38.09 67.60 8.31 35.44 oracle 75.73 60.16 39.58 52.22 79.80 20.88 67.80 5.5 Ablation Study: Effectiveness of Manager and Alternative Design Choices To demonstrate the effect of the manager, we conduct an ablation study that uses the last worker to generate results directly. As shown in Table 7, “w/o Manager” hurts the performance significantly, dropping more than 10% on MuSiQue. This demonstrates the important role of the manager. Next, to empirically verify that left-to-right yields the best performance, we evaluate other orders of reading, including Right-to-Left by reading from the last chunk to the first one and Permutation which reads in random order. As shown in Table 7, on most of the datasets, left-to-right yields the highest score, demonstrating the advantages of natural reading order. 5.6 Multi-path Chain-of-Agents Further Enhances Performance We manually investigated the results over these three orders (left-to-right, right-to-left, permutation), and we found that other orders sometimes can produce better answers than left-to-right. Inspired by this observation, we explore two approaches to select the best result among multiple paths. w/ vote applies majority voting over the final results while w/ judge uses an LLM to judge the most reliable CUl of diverse paths and generate the final answer. Oracle picks the best path by evaluating score of each path, yielding the upper bound performance. Table 8 compares three multi-path augmentation approaches. Surprisingly, results show that 1) all ensemble approaches (Bi-direction, Self-consistency, and Permutation) can further enhance the performance of CoA and 5-way Permutation yields the best improvement, 2) majority voting (w/ vote) of final answer is better than using an LLM as judge (w/ judge) in Self-consistency, but worse in Bi-direction, 3) using LLM judge (w/ judge) works well on long result generation tasks (QMSum, RepoBench-P), and 4) there is large space to improve because oracle (choose as answer the one with highest performance) is much higher than either w/ judge or w/ vote. We leave the direction of multi-path reasoning to future study. 6 Conclusion In this paper, we propose Chain-of-Agents, a multi-agent LLM collaboration framework for solving long context tasks. It is a training free, task/length agnostic, interpretable, and cost-effective frame- work. Experiments show that Chain-of-Agents outperforms RAG and Long Context LLMs by a large margin despite of its simple design. Analysis shows that by integrating information aggregation and context reasoning, CoA mitigates lost-in-the-middle and performs better on longer samples. Limitations. While CoA features with a simple and effective design, future directions can address the following limitations to further improve its prowess and efficiency. First, communication effec- tiveness can be further improved via finetuning or in-context learning because current LLMs are aligned with human norms which is not optimal for communication between LLMs. Second, CoA does not explore other forms of communication approaches, such as debating or complex discussions. Third, the cost and latency of running CoA can be further reduced, such as replacing some LLMs with more effective models via model routing [56]. 9
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
论文为什么要做这件事
Chain of Agents处理单个模型上下文装不下或难以利用的长文本。它把文档分块,让工作代理按顺序阅读并传递压缩后的相关信息,最后由管理代理作答。重点是信息如何接力,而不是让一群代理同时给独立答案再投票。 (原文:PDF p.3, Section 3)
指标:Chain of Agents处理单个模型上下文装不下或难以利用的长文本。它把文档分块,让工作代理按顺序阅读并传递压缩后的相关信息,最后由管理代理作答。重点是信息如何接力,而不是让一群代理同时给独立答案再投票。
条件:仅限本地原始PDF的 Section 3;不同表格与实验不合并
PDF p.3, Section 3 · PDF p.3
information to feed into the LLM and (ii) Full-Context (Vanilla), which feeds all input into the LLM until reaching the window limit. Our results show that on all nine datasets, CoA obtains significant improvement over all baselines by up to 10%. Noting that there is not enough research on multi-agent for long context tasks, we carefully create two multi-agent baselines, including a hierarchical structure and result merging approach to further demonstrate that CoA is superior among other possible multi-agent frameworks. 2 Related work Multi-agent LLMs. Multi-agent LLMs has become a popular topic [19]. A large proportion of works focus on social simulation. “Generative agents” is a sandbox environment allowing 25 agents to communicate with each other [47], while “Social simulacra” extends to 1000 agents [48]. Based on the success of them, some works explore the game settings [35, 68, 75, 76, 42], world wars [21], economy markets [32, 70], recommendation systems [81], and pandemics [17]. Others advance problem solving, focusing on reasoning of short text via multi-agent debating [16, 73, 10, 60] and discussing [11, 53] for different tasks in reasoning [16, 60], mechanics problems [44], paper review [77], knowledge graph construction [79], and code intelligence [64, 22]. Different from the above works, we improve problem solving on long context tasks. To the best of our knowledge, the closest work utilizes a tree structure to do single-hop QA over long context [9]. However, it is not designed for multi-hop reasoning or other tasks without communication between sibling agents. Long Context Modeling for LLMs. Input Reduction: RAG is broadly leveraged to solve long context query-based tasks [74, 2]. Combined with a strong retriever [72, 37, 67], LLMs are expected to handle long context questions in open domains. Previous studies have augmented LLMs during pretraining [24, 66], finetuning [31], inference [80], or directly integrating [26, 55]. Moreover, some token-level retrieval approaches are proposed [34]. Longllmlingua [25] removes tokens from long prompt to compress long context prompt to a desired budget. Window Extension: The context windows of LLMs are getting longer and longer thanks to the development of GPUs. For instance, the context window increases from 1024 (GPT-2 [51]), 2048 (GPT-3 [7]), to 128k (GPT-4 [45]). Moreover, the newest version of Claude-3 [5] supports 200k context windows. To save the cost of LLM training, some continue learning or finetuning approaches are proposed to extend the context window of pretrained LLMs [41, 50, 40, 43]. For instance, position interpolation [13] modifies rotary position encoding [58] and extends the context length of LLaMA [62] to 32k. Different from the above works, CoA does not reduce the input length or extend the window length of LLMs, but rather leverages multi-agent collaboration and communication to obtain the full receptive field. Complex Task Reasoning. Previous works on complex reasoning have focused on decomposing the complex question into sub-questions to solve them step-by-step. [49] decompose the questions with an unsupervised model and answer them separately with another model. Decomposed Prompt- ing [27] leverages some predefined modules to classify each decomposed sub-question, then further decompose if needed. Additionally, decomposing is used for human-computer interaction [71], and prompter training [65]. Recently, many work has been proposed for LLMs, such as Chain- of-thought [69] Least-to-most prompting [85] and Pearl [59]. However, the length of the prompt does not exceed the context limit of a single agent. By contrast, our Chain of Agents framework is proposed to effectively reason across multiple agents to support the unlimited length of source text. 3 Method Figure 1 shows the overview of our Chain-of-Agents (CoA) framework, containing two stages. In stage 1, long context is split into chunks where each chunk can be processed by a worker agent. Then, the worker agents communicate sequentially to produce evidence over the entire context. In stage 2, a manager agent consumes the knowledge from the chain of workers to generate the final answer. To formulate the task, we denote a long-context sample as (x, y, q), where x is the input of n tokens, y is the output of m tokens, q is an optional query. Given a LLM with k tokens (usually k ≪ n) as the context window limit, the target is to generate y with the limited input context window. Therefore, we divide each source text x into chunks x = {c1 , c2 ...cl }, so that each chunk can be completely fed into the LLM agent backbone model. 3
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
核心方法到底怎么运转
工作代理接收任务、当前文本块和前一棒的通信内容,提取与问题相关的证据并更新通信单元,传给下一棒。管理代理根据接力得到的信息组织最终答案。这样每个工作代理只需要有限窗口,但早期证据能否到达终点,仍取决于中间代理是否正确保留和整合。 (原文:PDF p.4, Section 3; framework)
指标:工作代理接收任务、当前文本块和前一棒的通信内容,提取与问题相关的证据并更新通信单元,传给下一棒。管理代理根据接力得到的信息组织最终答案。这样每个工作代理只需要有限窗口,但早期证据能否到达终点,仍取决于中间代理是否正确保留和整合。
条件:仅限本地原始PDF的 Section 3; framework;不同表格与实验不合并
PDF p.4, Section 3; framework · PDF p.4
3.1 Stage 1: Worker Agent: Segment Comprehension and Chain-Communication In Stage 1, CoA contains a sequence of l number Algorithm 1 Chain of Agents (CoA). of worker agents. Each worker Wi inputs the concatenation of a chunk ci from source text Input: Source input x, query q, agent window size k, x, a query q, instruction for a specific task for large language model LLM(∗). Output: Answer to the query. worker agent IW , and the message passed from Split x into l chunks {c1 , c2 , · · · , cl } the previous agent, denoted as “communication where ci is shorter than k unit” CUi−1 . The worker agents process them Initialize CU0 ← empty string. and output the message CUi for next worker, for i in 1, 2, · · · , l do expressed as: CUi ← LLMWi (IW , CUi−1 , ci , q) end for CUi = LLMWi (IW , CUi−1 , ci , q), (1) return LLMM (IM , CUl , q) CUs produced by worker agents vary across dif- ferent tasks. For question answering, CU contains the evidence for the manager to answer the question. For summarization, CU contains the summary of the previous texts. For code completion, CU contains the code summary with function/class names and explanation. Effectiveness on diverse tasks demonstrates the flexibility of CoA (Appendix C). The multi-step worker communication in CoA expands the model context to the full receptive field, meaning that the last worker can read the full input no matter how long the input is. Therefore, CoA is extensible to inputs with different lengths by adjusting the number of worker agents. The left side of Figure 1 underscores the necessity of collaborative communication among workers to effectively address complex, long-context reasoning tasks. We observe that 1) Although the question is unanswerable given c1 , W1 generates related evidence that is useful for answering the question; 2) with the partial answer from the previous worker, W2 further reasons with the current source to complete the full reasoning chain across agents and generate the interpretative reasoning chain; 3) W3 finds no related information in the chunk 3, it directly rewrites CU2 by putting the correct answer as the first token of CU3 without adding any unrelated information. This shows that if workers are independent (such as tree structure communication), it is impossible to answer hop two while the answer of hop one is held by another worker. 3.2 Stage 2: Manager Agent: Information Integration and Response Generation In Stage 2, after multiple steps of information extraction and comprehension by worker agents, the manager agent produces the final solution. While worker agents extract relevant information in a long-context source, the manager agent synthesizes relevant information accumulated by the end of “worker-agent-chain” to generate the final answer. Specifically, given the instruction for manager IM and query q, the manager agent consumes accumulated knowledge from last worker CUl and generates the final answer Response: Response = LLMM (IM , CUl , q) (2) The benefit of using a separate LLM as the manager agent is to decompose the duty of analyzing chunks in the long-context source (“worker agents”) and producing the final answer (“manager agent”), so that every agent can fulfill its duty to the most3 . 3.3 Time Complexity Analysis Table 2: Time complexity. We compare the time cost of full-context input and Chain-of- Agents theoretically in a decoder-only setting. We assume Encode Decode the response generated by LLMs contains r tokens on aver- Full-Context O(n2 ) O(nr) age, the input has n tokens, and the context limit of LLM is CoA O(nk) O(nr) k. The time complexity is shown in Table 2 (Appendix A). As can be seen, the encoding time of CoA is less than Full- Context because k ≪ n in long context tasks, while they have the same decoding time. This demonstrates the efficiency of CoA compared with the Full-Context baseline. 3 Other design choices: Our experiments show that using the last worker Wl to directly generate the final result leads to a performance drop. Besides, feeding the manager with all CUi or some CU that is related to the answer (decided by Wi ) also hurts the performance because of confusion led by conflicting CUi . 4
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
实验怎样检验这个方法
作者通过删除管理代理、改变工作代理数量和文本顺序等消融,检验接力式信息整合。多跳问答数据集对不同组件的敏感性不同,因此主要观察应逐任务陈述。 (原文:PDF p.8, experimental setup)
指标:作者通过删除管理代理、改变工作代理数量和文本顺序等消融,检验接力式信息整合。多跳问答数据集对不同组件的敏感性不同,因此主要观察应逐任务陈述。
条件:仅限本地原始PDF的 experimental setup;不同表格与实验不合并
PDF p.8, experimental setup · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
结果说明了什么
MuSiQue上完整CoA为37.09,去掉Manager后为26.79,支持最终整合环节的作用。但HotpotQA中Permutation为56.05,Left to Right为53.62,不能宣称从左到右在所有任务都是最佳顺序。不同任务对顺序与信息整合的敏感程度不同。 (原文:PDF p.8, Table 7)
指标:MuSiQue上完整CoA为37.09,去掉Manager后为26.79,支持最终整合环节的作用。但HotpotQA中Permutation为56.05,Left to Right为53.62,不能宣称从左到右在所有任务都是最佳顺序。不同任务对顺序与信息整合的敏感程度不同。
条件:仅限本地原始PDF的 Table 7;不同表格与实验不合并
PDF p.8, Table 7 · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
降低位置敏感性并不等于消除
作者分析重要信息处于不同位置时的表现变化。读这组结果应关注位置变化后的波动是否缩小,而不是把某种平均改进解释为完全不再丢失中间证据。顺序接力与最终管理降低了直接塞入超长上下文的压力,但仍存在信息选择和传递环节。 (原文:PDF p.8, Lost-in-the-middle analysis)
指标:作者分析重要信息处于不同位置时的表现变化。读这组结果应关注位置变化后的波动是否缩小,而不是把某种平均改进解释为完全不再丢失中间证据。顺序接力与最终管理降低了直接塞入超长上下文的压力,但仍存在信息选择和传递环节。
条件:仅限本地原始PDF的 Lost-in-the-middle analysis;不同表格与实验不合并
PDF p.8, Lost-in-the-middle analysis · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
这篇论文哪里最强,哪里最危险
框架不要求把完整原文都交给最后的管理代理,因此压缩与整合错误仍值得检查。论文的基准改进不等于对所有长文问题都无损读取,也没有证明增加任意数量的工作代理都能继续提高效果。是否保留了问题所需证据,比代理数量本身更重要。 (原文:PDF p.9, Limitations)
指标:框架不要求把完整原文都交给最后的管理代理,因此压缩与整合错误仍值得检查。论文的基准改进不等于对所有长文问题都无损读取,也没有证明增加任意数量的工作代理都能继续提高效果。是否保留了问题所需证据,比代理数量本身更重要。
条件:仅限本地原始PDF的 Limitations;不同表格与实验不合并
PDF p.9, Limitations · PDF p.9
Table 8: Comparison of three multi-path augmentation through judge or voting. Multi-path CoA furthers enhance the performance. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P Bi-direction: left-to-right and right-to-left paths (2-way) w/ judge 54.11 36.97 24.47 39.23 65.00 16.41 49.69 w/ vote 51.46 34.16 21.59 37.42 64.60 9.51 38.70 oracle 62.12 48.02 32.84 46.37 71.80 18.83 59.67 Self-Consistency: five left-to-right reasoning paths (5-way) w/ judge 57.17 38.82 21.58 36.24 62.80 17.06 46.97 w/ vote 57.49 40.78 25.56 39.15 68.60 8.35 35.56 oracle 67.07 55.74 39.89 52.74 80.40 20.81 63.52 Permutation: five random order reasoning paths (5-way) w/ judge 59.17 42.37 25.47 37.65 63.40 17.81 52.45 w/ vote 58.29 39.17 26.58 38.09 67.60 8.31 35.44 oracle 75.73 60.16 39.58 52.22 79.80 20.88 67.80 5.5 Ablation Study: Effectiveness of Manager and Alternative Design Choices To demonstrate the effect of the manager, we conduct an ablation study that uses the last worker to generate results directly. As shown in Table 7, “w/o Manager” hurts the performance significantly, dropping more than 10% on MuSiQue. This demonstrates the important role of the manager. Next, to empirically verify that left-to-right yields the best performance, we evaluate other orders of reading, including Right-to-Left by reading from the last chunk to the first one and Permutation which reads in random order. As shown in Table 7, on most of the datasets, left-to-right yields the highest score, demonstrating the advantages of natural reading order. 5.6 Multi-path Chain-of-Agents Further Enhances Performance We manually investigated the results over these three orders (left-to-right, right-to-left, permutation), and we found that other orders sometimes can produce better answers than left-to-right. Inspired by this observation, we explore two approaches to select the best result among multiple paths. w/ vote applies majority voting over the final results while w/ judge uses an LLM to judge the most reliable CUl of diverse paths and generate the final answer. Oracle picks the best path by evaluating score of each path, yielding the upper bound performance. Table 8 compares three multi-path augmentation approaches. Surprisingly, results show that 1) all ensemble approaches (Bi-direction, Self-consistency, and Permutation) can further enhance the performance of CoA and 5-way Permutation yields the best improvement, 2) majority voting (w/ vote) of final answer is better than using an LLM as judge (w/ judge) in Self-consistency, but worse in Bi-direction, 3) using LLM judge (w/ judge) works well on long result generation tasks (QMSum, RepoBench-P), and 4) there is large space to improve because oracle (choose as answer the one with highest performance) is much higher than either w/ judge or w/ vote. We leave the direction of multi-path reasoning to future study. 6 Conclusion In this paper, we propose Chain-of-Agents, a multi-agent LLM collaboration framework for solving long context tasks. It is a training free, task/length agnostic, interpretable, and cost-effective frame- work. Experiments show that Chain-of-Agents outperforms RAG and Long Context LLMs by a large margin despite of its simple design. Analysis shows that by integrating information aggregation and context reasoning, CoA mitigates lost-in-the-middle and performs better on longer samples. Limitations. While CoA features with a simple and effective design, future directions can address the following limitations to further improve its prowess and efficiency. First, communication effec- tiveness can be further improved via finetuning or in-context learning because current LLMs are aligned with human norms which is not optimal for communication between LLMs. Second, CoA does not explore other forms of communication approaches, such as debating or complex discussions. Third, the cost and latency of running CoA can be further reduced, such as replacing some LLMs with more effective models via model routing [56]. 9
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
读完后记住这三件事
每棒读取一个文本块和上游消息。管理代理使用最后累积的信息。压缩通信仍可能丢证据。 (原文:PDF p.3, Section 3;PDF p.4, Section 3; framework;PDF p.8, experimental setup;PDF p.8, Table 7;PDF p.8, Lost-in-the-middle analysis;PDF p.9, Limitations)
指标:Chain of Agents处理单个模型上下文装不下或难以利用的长文本。它把文档分块,让工作代理按顺序阅读并传递压缩后的相关信息,最后由管理代理作答。重点是信息如何接力,而不是让一群代理同时给独立答案再投票。
条件:仅限本地原始PDF的 Section 3;不同表格与实验不合并
PDF p.3, Section 3 · PDF p.3
information to feed into the LLM and (ii) Full-Context (Vanilla), which feeds all input into the LLM until reaching the window limit. Our results show that on all nine datasets, CoA obtains significant improvement over all baselines by up to 10%. Noting that there is not enough research on multi-agent for long context tasks, we carefully create two multi-agent baselines, including a hierarchical structure and result merging approach to further demonstrate that CoA is superior among other possible multi-agent frameworks. 2 Related work Multi-agent LLMs. Multi-agent LLMs has become a popular topic [19]. A large proportion of works focus on social simulation. “Generative agents” is a sandbox environment allowing 25 agents to communicate with each other [47], while “Social simulacra” extends to 1000 agents [48]. Based on the success of them, some works explore the game settings [35, 68, 75, 76, 42], world wars [21], economy markets [32, 70], recommendation systems [81], and pandemics [17]. Others advance problem solving, focusing on reasoning of short text via multi-agent debating [16, 73, 10, 60] and discussing [11, 53] for different tasks in reasoning [16, 60], mechanics problems [44], paper review [77], knowledge graph construction [79], and code intelligence [64, 22]. Different from the above works, we improve problem solving on long context tasks. To the best of our knowledge, the closest work utilizes a tree structure to do single-hop QA over long context [9]. However, it is not designed for multi-hop reasoning or other tasks without communication between sibling agents. Long Context Modeling for LLMs. Input Reduction: RAG is broadly leveraged to solve long context query-based tasks [74, 2]. Combined with a strong retriever [72, 37, 67], LLMs are expected to handle long context questions in open domains. Previous studies have augmented LLMs during pretraining [24, 66], finetuning [31], inference [80], or directly integrating [26, 55]. Moreover, some token-level retrieval approaches are proposed [34]. Longllmlingua [25] removes tokens from long prompt to compress long context prompt to a desired budget. Window Extension: The context windows of LLMs are getting longer and longer thanks to the development of GPUs. For instance, the context window increases from 1024 (GPT-2 [51]), 2048 (GPT-3 [7]), to 128k (GPT-4 [45]). Moreover, the newest version of Claude-3 [5] supports 200k context windows. To save the cost of LLM training, some continue learning or finetuning approaches are proposed to extend the context window of pretrained LLMs [41, 50, 40, 43]. For instance, position interpolation [13] modifies rotary position encoding [58] and extends the context length of LLaMA [62] to 32k. Different from the above works, CoA does not reduce the input length or extend the window length of LLMs, but rather leverages multi-agent collaboration and communication to obtain the full receptive field. Complex Task Reasoning. Previous works on complex reasoning have focused on decomposing the complex question into sub-questions to solve them step-by-step. [49] decompose the questions with an unsupervised model and answer them separately with another model. Decomposed Prompt- ing [27] leverages some predefined modules to classify each decomposed sub-question, then further decompose if needed. Additionally, decomposing is used for human-computer interaction [71], and prompter training [65]. Recently, many work has been proposed for LLMs, such as Chain- of-thought [69] Least-to-most prompting [85] and Pearl [59]. However, the length of the prompt does not exceed the context limit of a single agent. By contrast, our Chain of Agents framework is proposed to effectively reason across multiple agents to support the unlimited length of source text. 3 Method Figure 1 shows the overview of our Chain-of-Agents (CoA) framework, containing two stages. In stage 1, long context is split into chunks where each chunk can be processed by a worker agent. Then, the worker agents communicate sequentially to produce evidence over the entire context. In stage 2, a manager agent consumes the knowledge from the chain of workers to generate the final answer. To formulate the task, we denote a long-context sample as (x, y, q), where x is the input of n tokens, y is the output of m tokens, q is an optional query. Given a LLM with k tokens (usually k ≪ n) as the context window limit, the target is to generate y with the limited input context window. Therefore, we divide each source text x into chunks x = {c1 , c2 ...cl }, so that each chunk can be completely fed into the LLM agent backbone model. 3
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:工作代理接收任务、当前文本块和前一棒的通信内容,提取与问题相关的证据并更新通信单元,传给下一棒。管理代理根据接力得到的信息组织最终答案。这样每个工作代理只需要有限窗口,但早期证据能否到达终点,仍取决于中间代理是否正确保留和整合。
条件:仅限本地原始PDF的 Section 3; framework;不同表格与实验不合并
PDF p.4, Section 3; framework · PDF p.4
3.1 Stage 1: Worker Agent: Segment Comprehension and Chain-Communication In Stage 1, CoA contains a sequence of l number Algorithm 1 Chain of Agents (CoA). of worker agents. Each worker Wi inputs the concatenation of a chunk ci from source text Input: Source input x, query q, agent window size k, x, a query q, instruction for a specific task for large language model LLM(∗). Output: Answer to the query. worker agent IW , and the message passed from Split x into l chunks {c1 , c2 , · · · , cl } the previous agent, denoted as “communication where ci is shorter than k unit” CUi−1 . The worker agents process them Initialize CU0 ← empty string. and output the message CUi for next worker, for i in 1, 2, · · · , l do expressed as: CUi ← LLMWi (IW , CUi−1 , ci , q) end for CUi = LLMWi (IW , CUi−1 , ci , q), (1) return LLMM (IM , CUl , q) CUs produced by worker agents vary across dif- ferent tasks. For question answering, CU contains the evidence for the manager to answer the question. For summarization, CU contains the summary of the previous texts. For code completion, CU contains the code summary with function/class names and explanation. Effectiveness on diverse tasks demonstrates the flexibility of CoA (Appendix C). The multi-step worker communication in CoA expands the model context to the full receptive field, meaning that the last worker can read the full input no matter how long the input is. Therefore, CoA is extensible to inputs with different lengths by adjusting the number of worker agents. The left side of Figure 1 underscores the necessity of collaborative communication among workers to effectively address complex, long-context reasoning tasks. We observe that 1) Although the question is unanswerable given c1 , W1 generates related evidence that is useful for answering the question; 2) with the partial answer from the previous worker, W2 further reasons with the current source to complete the full reasoning chain across agents and generate the interpretative reasoning chain; 3) W3 finds no related information in the chunk 3, it directly rewrites CU2 by putting the correct answer as the first token of CU3 without adding any unrelated information. This shows that if workers are independent (such as tree structure communication), it is impossible to answer hop two while the answer of hop one is held by another worker. 3.2 Stage 2: Manager Agent: Information Integration and Response Generation In Stage 2, after multiple steps of information extraction and comprehension by worker agents, the manager agent produces the final solution. While worker agents extract relevant information in a long-context source, the manager agent synthesizes relevant information accumulated by the end of “worker-agent-chain” to generate the final answer. Specifically, given the instruction for manager IM and query q, the manager agent consumes accumulated knowledge from last worker CUl and generates the final answer Response: Response = LLMM (IM , CUl , q) (2) The benefit of using a separate LLM as the manager agent is to decompose the duty of analyzing chunks in the long-context source (“worker agents”) and producing the final answer (“manager agent”), so that every agent can fulfill its duty to the most3 . 3.3 Time Complexity Analysis Table 2: Time complexity. We compare the time cost of full-context input and Chain-of- Agents theoretically in a decoder-only setting. We assume Encode Decode the response generated by LLMs contains r tokens on aver- Full-Context O(n2 ) O(nr) age, the input has n tokens, and the context limit of LLM is CoA O(nk) O(nr) k. The time complexity is shown in Table 2 (Appendix A). As can be seen, the encoding time of CoA is less than Full- Context because k ≪ n in long context tasks, while they have the same decoding time. This demonstrates the efficiency of CoA compared with the Full-Context baseline. 3 Other design choices: Our experiments show that using the last worker Wl to directly generate the final result leads to a performance drop. Besides, feeding the manager with all CUi or some CU that is related to the answer (decided by Wi ) also hurts the performance because of confusion led by conflicting CUi . 4
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:作者通过删除管理代理、改变工作代理数量和文本顺序等消融,检验接力式信息整合。多跳问答数据集对不同组件的敏感性不同,因此主要观察应逐任务陈述。
条件:仅限本地原始PDF的 experimental setup;不同表格与实验不合并
PDF p.8, experimental setup · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:MuSiQue上完整CoA为37.09,去掉Manager后为26.79,支持最终整合环节的作用。但HotpotQA中Permutation为56.05,Left to Right为53.62,不能宣称从左到右在所有任务都是最佳顺序。不同任务对顺序与信息整合的敏感程度不同。
条件:仅限本地原始PDF的 Table 7;不同表格与实验不合并
PDF p.8, Table 7 · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:作者分析重要信息处于不同位置时的表现变化。读这组结果应关注位置变化后的波动是否缩小,而不是把某种平均改进解释为完全不再丢失中间证据。顺序接力与最终管理降低了直接塞入超长上下文的压力,但仍存在信息选择和传递环节。
条件:仅限本地原始PDF的 Lost-in-the-middle analysis;不同表格与实验不合并
PDF p.8, Lost-in-the-middle analysis · PDF p.8
Figure 3: Comparison on NarrativeQA. X-axis/Y- Figure 4: Performance of CoA and Full on Nat- axis indicate RAG/CoA performance while each ural Questions. CoA mitigates the lost-in-the- point represents a bin. The number indicates the middle issue. X-axis is the index of document chunk index of gold answer (ratio of number of with gold answer where small number indicates samples in bracket), and the size of the point indi- gold answer is closer to start. cates the improvement of CoA over RAG. Figure 5: A case study of RAG (left) and CoA (right) on HotpotQA. The sequential agent communi- cation enables CoA to perform complex multi-hop reasoning over long contexts. Table 7: Ablation on CoA. Manager plays an important role in CoA, and left-to-right yields the best performance among other reading orders including Right-to-Left and Permutation. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P CoA 53.62 37.09 25.26 37.17 65.42 16.77 58.25 w/o Manager 48.58 26.79 20.80 29.66 58.80 16.50 56.16 Right-to-Left 51.83 29.77 21.57 36.60 62.80 15.91 55.10 Permutation 56.05 34.55 23.60 37.42 64.60 16.50 58.43 displayed in Figure 4. The Vanilla model exhibits a significant "lost-in-the-middle" issue, with a performance range of 6.13 (±2.17). In contrast, CoA shows resilience against this issue, with a narrower performance gap of 4.89 (±1.91), demonstrating that CoA effectively mitigates this problem by providing each agent a shorter context to focus on. 5.4 Multi-agent Collaboration in CoA Enables Complex Reasoning over Long Context Figure 5 displays a sample prediction from HotpotQA. To find the correct answer, RAG retrieves text chunks with high semantic similarity with the query. However, conducting multi-hop reasoning is challenging as the critical first-hop answer often lacks semantic relevance to the query. In contrast, CoA operates differently: the first agent explores related topics without knowing the query’s answer, aiding subsequent inference. The second agent, also unaware of the answer, broadens the topic scope by incorporating new information. The third agent finally discovers the answer, synthesizing information from earlier agents and new data to complete the reasoning chain. This collaborative approach highlights CoA’s ability to facilitate complex reasoning across long context tasks. 8
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
指标:框架不要求把完整原文都交给最后的管理代理,因此压缩与整合错误仍值得检查。论文的基准改进不等于对所有长文问题都无损读取,也没有证明增加任意数量的工作代理都能继续提高效果。是否保留了问题所需证据,比代理数量本身更重要。
条件:仅限本地原始PDF的 Limitations;不同表格与实验不合并
PDF p.9, Limitations · PDF p.9
Table 8: Comparison of three multi-path augmentation through judge or voting. Multi-path CoA furthers enhance the performance. HotpotQA MuSiQue NarrativeQA Qasper QuALITY QMSum RepoBench-P Bi-direction: left-to-right and right-to-left paths (2-way) w/ judge 54.11 36.97 24.47 39.23 65.00 16.41 49.69 w/ vote 51.46 34.16 21.59 37.42 64.60 9.51 38.70 oracle 62.12 48.02 32.84 46.37 71.80 18.83 59.67 Self-Consistency: five left-to-right reasoning paths (5-way) w/ judge 57.17 38.82 21.58 36.24 62.80 17.06 46.97 w/ vote 57.49 40.78 25.56 39.15 68.60 8.35 35.56 oracle 67.07 55.74 39.89 52.74 80.40 20.81 63.52 Permutation: five random order reasoning paths (5-way) w/ judge 59.17 42.37 25.47 37.65 63.40 17.81 52.45 w/ vote 58.29 39.17 26.58 38.09 67.60 8.31 35.44 oracle 75.73 60.16 39.58 52.22 79.80 20.88 67.80 5.5 Ablation Study: Effectiveness of Manager and Alternative Design Choices To demonstrate the effect of the manager, we conduct an ablation study that uses the last worker to generate results directly. As shown in Table 7, “w/o Manager” hurts the performance significantly, dropping more than 10% on MuSiQue. This demonstrates the important role of the manager. Next, to empirically verify that left-to-right yields the best performance, we evaluate other orders of reading, including Right-to-Left by reading from the last chunk to the first one and Permutation which reads in random order. As shown in Table 7, on most of the datasets, left-to-right yields the highest score, demonstrating the advantages of natural reading order. 5.6 Multi-path Chain-of-Agents Further Enhances Performance We manually investigated the results over these three orders (left-to-right, right-to-left, permutation), and we found that other orders sometimes can produce better answers than left-to-right. Inspired by this observation, we explore two approaches to select the best result among multiple paths. w/ vote applies majority voting over the final results while w/ judge uses an LLM to judge the most reliable CUl of diverse paths and generate the final answer. Oracle picks the best path by evaluating score of each path, yielding the upper bound performance. Table 8 compares three multi-path augmentation approaches. Surprisingly, results show that 1) all ensemble approaches (Bi-direction, Self-consistency, and Permutation) can further enhance the performance of CoA and 5-way Permutation yields the best improvement, 2) majority voting (w/ vote) of final answer is better than using an LLM as judge (w/ judge) in Self-consistency, but worse in Bi-direction, 3) using LLM judge (w/ judge) works well on long result generation tasks (QMSum, RepoBench-P), and 4) there is large space to improve because oracle (choose as answer the one with highest performance) is much higher than either w/ judge or w/ vote. We leave the direction of multi-path reasoning to future study. 6 Conclusion In this paper, we propose Chain-of-Agents, a multi-agent LLM collaboration framework for solving long context tasks. It is a training free, task/length agnostic, interpretable, and cost-effective frame- work. Experiments show that Chain-of-Agents outperforms RAG and Long Context LLMs by a large margin despite of its simple design. Analysis shows that by integrating information aggregation and context reasoning, CoA mitigates lost-in-the-middle and performs better on longer samples. Limitations. While CoA features with a simple and effective design, future directions can address the following limitations to further improve its prowess and efficiency. First, communication effec- tiveness can be further improved via finetuning or in-context learning because current LLMs are aligned with human norms which is not optimal for communication between LLMs. Second, CoA does not explore other forms of communication approaches, such as debating or complex discussions. Third, the cost and latency of running CoA can be further reduced, such as replacing some LLMs with more effective models via model routing [56]. 9
解释边界:以本段给出的指标、对照和限制解释;不外推为通用质量保证或已完成复现。
代码从哪里读
原始来源入口。此处是论文或作者项目入口;本轮核验以本地原始PDF为准。没有运行仓库、下载模型或重做实验;不把项目演示视为独立复现证据。