AnyMAC: Cascading Flexible M ulti- A gent C ollaboration via Next-Agent Prediction

Song Wang, Zhen Tan, Zihan Chen, Shuang Zhou, Tianlong Chen, Jundong Li · 2025

Read AnyMAC: Cascading Flexible M ulti- A gent C ollaboration via Next-Agent Prediction by Song Wang, Zhen Tan, Zihan Chen, Shuang Zhou, Tianlong Chen, Jundong Li (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2506-17784.txt.

Introduction

Song Wang and co-authors let teams of language model agents pass work along a chain in this 2025 paper. Most multi-agent systems fix who talks to whom in a graph. Fixed wiring limits how flexibly a team can react to a task.

Their framework, AnyMAC, treats teamwork as a sequence instead. At each step it predicts which agent should act next. That next-agent choice opens a far larger space of team shapes. Roles can enter, exit, or repeat as the problem demands. Tests judge whether the freedom beats static team layouts. Flexible casting may matter most when tasks shift mid-stream. The work reframes team design as a casting problem, solved live.

Catalog record

CREATORSong Wang, Zhen Tan, Zihan Chen, Shuang Zhou, Tianlong Chen, Jundong Li
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE40 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2506-17784

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

AnyMAC: Cascading Flexible M ulti- A gent C ollaboration via Next-Agent Prediction Song Wang, Zhen Tan, Zihan Chen, Shuang Zhou, Tianlong Chen, Jundong Li Abstract Recent progress in large language model (LLM)-based multi-agent collaboration highlights the power of structured communication in enabling collective intelligence. However, existing methods largely rely on static or graph-based inter-agent topologies, lacking the potential adaptability and flexibility in communication. In this work, we propose a new framework that rethinks multi-agent coordination through a sequential structure rather than a graph structure, offering a significantly larger topology space for multi-agent communication. Our method focuses on two key directions: (1) Next-Agent Prediction, which selects the most suitable agent role at each step, and (2) Next-Context Selection (NCS), which enables each agent to selectively access relevant information from any previous step. Together, these components construct task-adaptive communication pipelines that support both role flexibility and global information flow. Extensive evaluations across multiple benchmarks demonstrate that our approach achieves superior performance while substantially reducing communication overhead. Our code is provided at https://github.com/SongW-SW/AnyMAC . 1 Introduction The rise of large language models (LLMs) has revolutionized many domains by enabling powerful agents that can perform complex reasoning, planning, and action execution ( Pan et al. 2023 ; Hong et al. 2023 ; Zhuge et al. 2024 ) . These LLM-based agents, which integrate language generation with decision-making and external tool use, have demonstrated remarkable capabilities in diverse tasks, such as chain-of-thought reasoning ( Yao et al. 2023b ; Wang et al. 2023a ) and code synthesis ( Shinn et al. 2023 ; Chen et al. 2023 ) . Beyond single-agent settings, recent work has shown that teams of LLM agents can collaboratively solve harder problems than any individual agent ( Du et al. 2023 ; Wang et al. 2023b ; Shinn et al. 2023 ; Zheng et al. 2023 ; Wu et al. 2023 ; Zhang et al. 2023 ) , giving rise to an emergent form of collective intelligence. This emergent capability hinges critically on the design of inter-agent communication topologies: how agents are structured, how they exchange messages, and how they integrate information from others. Fig. 1: Comparison of LLM-based multi-agent communication topology design. To support such collaboration, researchers have investigated a wide range of multi-agent communication structures (Fig. 1 ), including chains ( Wei et al. 2022 ; Zhang et al. 2022 ) , trees ( Yao et al. 2023a ) , stars ( Wu et al. 2023 ) , fully connected or random graphs ( Qian et al. 2024 ) , and learned or optimizable topologies ( Zhuge et al. 2024 ; Zhang et al. 2024a ) . These designs, often tailored to task complexity or communication budgets, aim to balance performance and efficiency in various deployment scenarios. Notably, recent approaches have introduced learning-based topology construction ( Hao et al. 2023 ; Liu et al. 2023 ; Zhang et al. 2024b ) , enabling dynamic selection of agent communication graphs conditioned on input tasks and queries. Such adaptive frameworks mark a shift from fixed pipelines to more flexible, input-aware systems that can better exploit the potential of LLM collectives. Despite these advancements, current graph-based structures still face fundamental limitations. First, they enforce static communication schemas within each round: once the topology is learned, all agents operate under the same fixed communication pattern, preventing the reuse of agents or dynamic adaptation during the reasoning process. Additionally, to maintain acyclic message flow, many designs restrict the graph to be a Directed Acyclic Graph (DAG), which further constrains the solution space (of communication topology) and prohibits recursive or repeated consultation of specific agents. For example, in a task where one expert agent (e.g., a Python coder) is particularly useful at multiple stages of reasoning, a DAG-based structure cannot re-query this agent after it is used earlier in the round. This leads to inefficient or suboptimal reasoning, especially in complex tasks where revisiting agents is crucial. Second, most existing works limit information flow strictly to direct graph edges between agents, meaning that each agent can only access messages from its neighbors. For example, in tree-based structures, downstream agents often lack access to parallel branches’ outputs, missing potentially useful contextual signals. This makes it hard for the agents to obtain global context for well-informed reasoning. To address these challenges, we propose a new multi-agent collaboration framework, namely AnyMAC , that formulates multi-agent collaboration through a sequential communication protocol rather than a graph-based one. In this way, the construction of the communication topology is formulated as predicting the next agent iteratively. Our framework contains two novel and critical designs: (1) Next-Agent Prediction , where the system dynamically determines the next agent to activate in a stepwise manner. This sequential design bypasses the constraints of graph structures, allowing for greater flexibility in agent reuse and order variation across different queries. (2) Next-Context Selection , which allows each step to flexibly retrieve outputs from any previously activated agents. This globally accessible mechanism enables richer and more adaptive communication flows, where information is not constrained to propagate through fixed graph edges or sequential orders, but instead can be retrieved through dynamic selection based on task requirements. We conduct extensive experiments across multiple benchmarks, and the results validate the effectiveness of our approach, outperforming state-of-the-art communication topologies in both accuracy and efficiency in terms of token consumption. Our contributions can be summarized as follows: • Formulation. We propose a new formulation of multi-agent communication, where the system predicts the next agent role and selects context from any previous agents. This formulation is proven to subsume the solution space of prior graph-based methods. • Framework. We propose a transformer-based framework to realize our formulation, leveraging the transformer’s global attention and sequential modeling capabilities. • Experiments. We conduct extensive experiments across diverse benchmarks. Our method outperforms state-of-the-art multi-agent baselines in both accuracy and efficiency, demonstrating adaptivity, robustness, and favorable cost-performance trade-offs. 2 Related Work Single Agent Reasoning. Recent research has demonstrated that multi-step reasoning allows large language models (LLMs) to solve complex problems and self-correct along the way. Broadly, single agent multi-step reasoning can be achieved via training-based and prompting-based methods. In training-based approaches, reinforcement learning (RL) is used to optimize the model’s ability to generate long-form Chain-of-Thought (CoT) reasoning ( DeepSeek 2025 ) . While effective, RL methods typically require substantial data and computational resources. To reduce cost, distillation-based methods ( Muennighoff et al. 2025 ; Ye et al. 2025 ) collect high-quality reasoning traces and apply supervised fine-tuning to teach models multi-step reasoning behaviors. Beyond training-based methods, prompting-based techniques enable step-by-step reasoning by prompting procedure. Early approaches include multi-step reasoning exemplars directly in the prompt, as in CoT ( Wei et al. 2022 ) and Automatic CoT ( Zhang et al. 2022 ) . Previous work also explicitly enforces multi-step reasoning in prompting procedure, such as ToT ( Yao et al. 2023a ) and budget-forcing ( Muennighoff et al. 2025 ) . Beyond single-agent reasoning, multi-agent approaches leverage collaboration among multiple LLMs to further improve accuracy, detailed below. Multi-Agent Collaboration. Existing multi-agent systems typically predefine role types and fix the number of agents per role based on the task, then design a communication topology for collaboration. Prior work can be

Read the complete text