Skip to main content
QUICK REVIEW

[Paper Review] Chain of Agents: Large Language Models Collaborating on Long-Context Tasks

Yusen Zhang, Ruoxi Sun|arXiv (Cornell University)|Jun 4, 2024
Natural Language Processing TechniquesComputer Science8 citations
TL;DR

Chain-of-Agents (CoA) uses sequential worker LLMs to read long contexts chunk-by-chunk, with a separate manager LLM to synthesize a final answer, improving long-context task performance over RAG and full-context baselines by up to 10%.

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.

Motivation & Objective

  • Motivate the need to handle long-context tasks beyond input reduction and window extension.
  • Propose a training-free, task-agnostic multi-agent framework to aggregate information across long inputs.
  • Enable interleaved reading and reasoning across short-context workers to cover full receptive fields.
  • Demonstrate that a separate manager agent can synthesize worker outputs into accurate final answers.

Proposed method

  • Split long input x into chunks of size ≤ k so each worker W_i can process c_i with query q and instruction I_W.
  • Workers process sequentially and produce a communication unit CU_i that contains evidence or summarized reasoning for the next step.
  • A manager M consumes CU_l from the last worker to generate the final Answer via an LLM: Answer = LLM_M(I_M, CU_l, q).
  • CoA enables interleaved read-process cycles, giving each worker a short context while collectively covering the full input.
  • Compared CoA against Vanilla (full-context within k) and RAG baselines, plus two multi-agent baselines (Merge, Hierarchical).
  • Time complexity: encoding for CoA is O(nk) versus O(n^2) for Full-Context, with decoding O(nr) in both cases.

Experimental results

Research questions

  • RQ1Can a sequential chain of worker LLMs with a separate manager improve performance on long-context tasks without training?
  • RQ2Does interleaved read-process with short per-agent context mitigate lost-in-the-middle and enable effective multi-hop reasoning over long inputs?
  • RQ3How does CoA compare to RAG and full-context baselines across QA, summarization, and code completion tasks?
  • RQ4What is the impact of agent ordering and multi-path augmentation on final performance?

Key findings

  • CoA outperforms Vanilla and RAG across nine long-context datasets spanning QA, summarization, and code completion, with gains up to 10%.
  • In longer inputs and stronger models, CoA yields larger relative improvements over baselines, including significant gains on NarrativeQA and BookSum.
  • Ablations show the manager component is important; removing it degrades performance notably (e.g., MuSiQue).
  • Left-to-right reading order generally performs best among orders; multi-path approaches (Self-Consistency, Permutation, Bi-directional) can further enhance results, with oracle paths setting an upper bound.
  • CoA mitigates the “lost-in-the-middle” phenomenon compared to vanilla full-context baselines, especially on longer samples.
  • Compared to long-context LLMs with very large windows (Claude-3 200k), CoA with smaller windows can achieve higher or competitive performance, particularly as input length grows.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.