[论文解读] Chain of Agents: Large Language Models Collaborating on Long-Context Tasks
Chain-of-Agents(CoA)使用顺序工作器大语言模型逐块读取长上下文,另有一个独立的管理器大语言模型来综合最终答案,在长上下文任务上的表现相较于 RAG 和全上下文基线提高最多 10%。
Addressing the challenge of effectively processing long contexts has become a critical issue for Large Language Models (LLMs). Two common strategies have emerged: 1) reducing the input length, such as retrieving relevant chunks by Retrieval-Augmented Generation (RAG), and 2) expanding the context window limit of LLMs. However, both strategies have drawbacks: input reduction has no guarantee of covering the part with needed information, while window extension struggles with focusing on the pertinent information for solving the task. To mitigate these limitations, we propose Chain-of-Agents (CoA), a novel framework that harnesses multi-agent collaboration through natural language to enable information aggregation and context reasoning across various LLMs over long-context tasks. CoA consists of multiple worker agents who sequentially communicate to handle different segmented portions of the text, followed by a manager agent who synthesizes these contributions into a coherent final output. CoA processes the entire input by interleaving reading and reasoning, and it mitigates long context focus issues by assigning each agent a short context. We perform comprehensive evaluation of CoA on a wide range of long-context tasks in question answering, summarization, and code completion, demonstrating significant improvements by up to 10% over strong baselines of RAG, Full-Context, and multi-agent LLMs.
研究动机与目标
- 说明处理超出输入缩减和滑动窗口扩展的长上下文任务的必要性。
- 提出一个无需训练、与任务无关的多代理框架,用于在长输入之间聚合信息。
- 实现跨短上下文工作器的交错读取与推理,以覆盖完整的感受野。
- 证明一个独立的管理代理能将工作器输出综合成准确的最终答案。
提出的方法
- 将长输入 x 分割成大小≤k 的块,使每个工作器 W_i 能在查询 q 和指令 I_W 的条件下处理 c_i。
- 工作器按顺序处理并产生一个通信单元 CU_i,其中包含用于下一步的证据或摘要推理。
- 管理器 M 采用来自最后一个工作器的 CU_l 来通过一个大语言模型生成最终答案:Answer = LLM_M(I_M, CU_l, q)。
- CoA 使得交错的读-处理循环成为可能,在为每个工作器提供短上下文的同时,整体覆盖完整输入。
- 将 CoA 与 Vanilla(在 k 内的全上下文)和 RAG 基线进行对比,以及两个多代理基线(Merge、Hierarchical)。
- 时间复杂度:CoA 的编码为 O(nk),而全上下文为 O(n^2),解码在两种情况下均为 O(nr)。
实验结果
研究问题
- RQ1在不进行训练的前提下,是否一个由若干工作器 LLM 组成的顺序链条配合一个独立的管理器,能够在长上下文任务上提升性能?
- RQ2以每个代理较短上下文进行交错读取-处理,是否能缓解“在中间丢失”问题并在长输入上实现有效多步推理?
- RQ3在问答、摘要和代码补全任务中,CoA 相对 RAG 和全上下文基线的表现如何?
- RQ4代理排序和多路径增强对最终性能有何影响?
主要发现
- CoA 在涵盖问答、摘要和代码补全的九个长上下文数据集上,优于 Vanilla 和 RAG,提升幅度高达 10%。
- 在更长的输入和更强的模型下,CoA 相对于基线的相对改进更大,且在 NarrativeQA 和 BookSum 上取得显著提升。
- 消融实验表明管理组件很重要;移除它会显著降低性能(例如 MuSiQue)。
- 从左到右的读取顺序通常表现最佳;多路径方法(自洽 Self-Consistency、置换 Permutation、双向 Bi-directional)可以进一步提升结果,天真的最优路径设定了上限。
- 与普通全上下文基线相比,CoA 缓解了“在中间丢失”的现象,特别是在较长样本上。
- 相较于具有超大窗口(如 Claude-3 200k)的长上下文 LLM,使用较小窗口的 CoA 可以实现更高或具有竞争力的性能,尤其中输入长度增加时。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。