arXiv(opens in a new tab)cs.AIAug 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.00237

Learning What to Retain: Gated-Memory Routing for Efficient Collaboration in Multi-Agent LLM Systems

Rakibul Hasan Rajib, Mengxing Zheng, Qian Lou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language model (LLM)-based multi-agent systems tackle complex reasoning by orchestrating how multiple agents are configured and how they collaborate. A central challenge is to adapt orchestration to the evolving collaboration state. Routing from the query alone cannot adapt to intermediate progress or errors, which hurts accuracy. Routing from the complete execution history supplies this missing context, but forces later decisions to process every prior step, including redundant or low-utility ones. This creates an execution-history overload that inflates cost. Effective orchestration instead requires a compact state that captures useful progress without accumulating redundant context. We propose Gated-Memory Routing, which conditions each decision on the query and a learned execution memory. A learned Memory Write Gate commits only non-redundant reasoning steps, and a learned Retrieval Gate supplies each agent a compact, relevant subset, so every decision conditions on a clean, informative state. At each step, the system selects the next role and backbone from this memory, while an Adaptive Halting Controller stops execution once the memory contains sufficient evidence for answering. Across five reasoning and code-generation benchmarks, our framework is both effective and efficient: it attains the best average accuracy, exceeding the strongest baseline by 2.44 points, while reducing HumanEval inference cost by 31.9% relative to that baseline. Code is available at https://github.com/rajibrhasan/gated-memory-routing.

1 Introduction

Large language model (LLM)-based multi-agent systems have become a powerful paradigm for complex reasoning: by decomposing a problem across agents that specialize, critique, or extend one another's reasoning, they achieve strong performance on reasoning and code-generation bench-

marks (Chen et al., 2024c; Liang et al., 2024; Zhang et al., 2024; Qian et al., 2025). Their effectiveness depends not only on the underlying LLMs but on how execution is orchestrated: how many agents to invoke, which roles to assign, which backbone powers each agent, and what each agent may see. These decisions constitute the routing problem, and how well they are made determines whether collaboration yields genuine reasoning gains or redundant computation.

Early multi-agent systems address routing through fixed, hand-engineered designs, instantiating predetermined agents with manually specified roles and static collaboration patterns that remain constant across queries (Hong et al., 2024; Qian et al., 2024; Li et al., 2023; Du et al., 2024; Wu et al., 2024). To relax this rigidity, later work makes the interaction structure adaptive by optimizing or pruning the communication graph (Zhuge et al., 2024; Zhang et al., 2025a; Wang et al., 2025; Liu et al., 2024), and end-to-end routers configure agent count, roles, and backbones directly from the query (Yue et al., 2025). These query-only routers commit routing decisions before any agent produces reasoning, so they cannot respond to partial progress, errors, or emerging gaps in the solution. A recent alternative conditions routing on the unfolding execution, sequencing agents over the evolving task state (Dang et al., 2025). When that evolving state is carried forward with little filtering, however, each decision must reason over an undifferentiated, ever-growing context that mixes useful evidence with redundant or erroneous reasoning; this full-history routing exposes downstream agents to low-value context and inflates inference cost.

These two approaches have opposite limitations: conditioning on the query alone observes too little, committing before execution begins, which hurts accuracy, while conditioning on the full execution history (Figure 1a) observes too much, forcing each decision to process an unfiltered and growing tra-

Figure

(a) Full-History Routing

Figure

(b) Gated-Memory Routing

Figure 1: Full-history routing feeds each decision the entire trajectory, raising context length and cost. Gated-memory routing instead maintains a selective memory through write and retrieval gates and halts when further collaboration is unlikely to add value, keeping context relevant and cost low.

jectory, which inflates cost. A router should instead learn what to retain, what to surface, and how to act on the resulting state. This motivates conditioning routing on a structured, selective memory (Figure 1b): the system dynamically routes based on a gated memory, exposes only step-relevant context to downstream agents, and commits only the reasoning steps worth preserving. These decisions are tightly coupled: low-quality writes pollute later retrieval, overly broad retrieval distracts downstream agents, and fixed-depth execution either stops prematurely or continues spending computation after additional reasoning is unlikely to help.

Based on this view, we introduce Gated-Memory Routing, a framework in which a learned, gated execution memory serves as the shared state that every routing decision conditions on. A single jointly trained router acts on it through complementary components: a History-Aware Role Allocator and an LLM Router choose the agent and its backbone, a Retrieval Gate surfaces a compact, step-relevant subset of memory, a Memory Write Gate commits only high-utility, non-redundant reasoning steps, and an Adaptive Halting Controller decides when the gated state is sufficient to stop. Because routing is driven by this gated memory rather than the raw history, the interaction structure emerges dynamically during execution.

References (18)