Chain of Agents: Large Language Models Collaborating on Long-Context Tasks

Yusen Zhang, Ruoxi Sun, Yanfei Chen, Tomas Pfister, Rui Zhang, Sercan Ö. Arik

arXiv:2406.02818 · 2026-07-27 공개 · arXiv · PDF

long-context question-answering retrieval-augmented-generation summarization llm-framework code-completion information-aggregation multi-agent-collaboration

Abstract

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.

한국어 요약

한 줄 요약

Chain-of-Agents(CoA)는 여러 대형 언어 모델이 협력하여 긴 문맥 작업을 처리하는 새로운 프레임워크로, 최대 10%의 성능 향상을 보인다.

핵심 기여도

핵심 아이디어

긴 문맥 작업에서 기존의 두 접근 방식, 즉 입력 축소(RAG)와 문맥 확장(Window Extension)은 각각 한계를 가진다. RAG는 필요한 정보를 누락할 수 있고, Window Extension은 긴 문맥 내에서 핵심 정보를 집중하기 어렵다. CoA는 이 문제를 해결하기 위해, 여러 LLM 에이전트가 자연어를 통해 협력하는 방식을 도입한다. CoA는 두 단계로 구성된다: 첫 번째 단계에서 여러 워커 에이전트가 입력을 분할 처리하며 정보를 누적하고, 두 번째 단계에서 매니저 에이전트가 전체 정보를 종합하여 최종 결과를 생성한다. 이 방식은 인간이 긴 문서를 처리하는 방식을 모방하며, 각 에이전트가 짧은 문맥을 처리함으로써 집중력을 유지할 수 있도록 설계되었다.

기술적 접근법

주요 결과

의의 및 한계

CoA는 학습 없이도 작동하며, 다양한 작업과 길이에 관계없이 적용 가능한 해법을 제시한다. 또한, 에이전트 간 자연어 기반 협력은 복잡한 작업에 있어 인간과 유사한 처리 방식을 구현할 수 있다는 점에서 학술적 가치가 있다. 그러나 CoA는 여러 LLM을 필요로 하므로, 계산 비용이 증가할 수 있다. 또한, 매니저 에이전트의 부재는 성능에 큰 영향을 미치므로, 매니저의 역할은 매우 중요하다는 한계가 있다.

실용적 활용

CoA는 긴 문서 요약, 대규모 문서 내 질문 응답, 코드 생성 등 다양한 산업 및 연구 분야에서 활용 가능하다. 특히, 단일 LLM이 처리하기 어려운 복잡한 긴 문맥 작업에서 효과적이다.