Manuscript Offprint

arXiv:2611.06956

Octopus: One Brain, Many Branches for Latent-KV Multi-Agent Reinforcement Learning

Tianming Sha

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

ABSTRACT

Deep search and long-horizon reasoning naturally unfold as branching trajectories that pursue parallel sub-queries, abandon dead-end detours, and cross-check sibling findings. Yet modern serving engines, agent harnesses, and reinforcement learning (RL) trainers execute every episode as a flat, append-only text sequence: stretching a single context window leaves failed detours in working memory that dilute attention, in-place edits break prefix KV caching and recurrent states, and splicing caches across all layers overwrites hybrid recurrent working memory and triggers severe task hijacking.

We introduce Octopus, a co-designed serving runtime, GPU memory manager, and RL framework that executes episodes as a GPU-resident DAG over immutable radix cursors (89.6% GPU KV cache hit rate). Agents coordinate via five primitives: fork shares parent KV prefixes in O(1)\mathcal{O}(1) with isolated 32K branch budgets, rewind restores hybrid recurrent checkpoints, read_thread mounts sibling KV pages in zero copy, and wait and done synchronize results. To prevent cross-branch interference in hybrid models, Octopus splices sibling KV pages exclusively into full-attention layers under monotonic position offsets while recurrent layers skip mounted spans, retaining 92.2% of full-text answer information and cutting off-task hijacking by 21×21\times (57.9%→2.7%57.9\% \to 2.7\%) with zero new KV pages. During RL, our prefix-tree packed DAG kernel and DAG-GRPO objective deduplicate shared prefixes via prefix-deduplicating loss masks while keeping mounted KV edges differentiable in the forward-backward graph, cutting rollout-training KL divergence 32×32\times and routing reader gradients directly into producer KV projections. Trained on Qwen3.5-4B with binary outcome rewards, Octopus self-organizes a commander-worker hierarchy and peer-to-peer latent KV mesh from scratch, lifting BrowseComp-Plus accuracy under sparse BM25 from 26.0% (32K ReAct) and 32.1% (143K Single-Agent GRPO) to 49.6% (+17.5 points; 51.2% on OpenResearcher). Despite its 4B footprint, Octopus surpasses 9B context-editing RL (42.5%), matches OpenAI o3 under BM25 (49.3%), and outperforms dense-retrieval browser agents up to 250×250\times larger, including 30B Tongyi-DeepResearch (44.5%), 671B DeepSeek-R1 (16.4%), 1T Kimi-K2 (35.4%), GPT-4.1 (36.4%), and Claude 4 Opus (36.8%).

Code & Runtime: https://github.com/shatianming5/octopus

Figure

Figure 1: Flat append-only context vs. Octopus GPU-resident execution DAG. (a) Flat windows keep failed detours and all-layer KV splicing corrupts recurrent states. (b) Octopus coordinates isolated 32K branches over GPU radix cursors via O(1)\mathcal{O}(1) fork, rewind, and attention-only read_thread (read) KV mounting.

TECHNICAL REPORT

1 Introduction

Deep search and multi-hop reasoning are inherently branching processes: an agent decomposes a question into parallel sub-queries, abandons dead-end detours, cross-checks sibling findings, and synthesizes verified evidence [1–3]. Yet modern serving engines, agent harnesses, and reinforcement learning (RL) trainers execute every episode as a flat, append-only text sequence [4–8]. Forcing tree-structured exploration onto a single linear context creates an immediate trilemma. A standard 32K window saturates after opening just a few 8K-token web pages, capping a 4B agent at 26.0% accuracy on BrowseComp-Plus (Table 3). Stretching that flat window to 143K under RL lifts accuracy to only 32.1% and stalls at 28.5% capacity (40.8K tokens), because failed detours remain in working memory and dilute attention over true evidence [9, 10]. Meanwhile, compacting or editing prior turns in place [11–15] discards exact identifiers, breaks append-only prefix KV caching, and invalidates sequential recurrent states in modern hybrid architectures such as Gated DeltaNet (GDN) [16] and Mamba-2 [17].

Breaking out of a single flat window requires native branching execution, yet existing multi-agent, KV-sharing, and RL systems hit three structural walls. First, client-side multi-agent harnesses coordinate workers over stateless chat APIs, re-transmitting text histories and duplicating shared prefixes across sessions [5, 6, 18, 19]. Second, inference-time KV-sharing methods splice or re-rotate caches across all layers indiscriminately [20–23]; in hybrid recurrent-attention models, stepping recurrent states through a sibling's text or full-layer cache overwrites the reader's sequential working memory and hijacks over half of subsequent turns (55.2%–57.9%; Table 5). Third, existing branching RL frameworks exchange findings only as re-encoded text summaries [24–26], while naive sequence-level tree training either overcounts shared prefixes or severs cross-branch KV dependencies.

We introduce Octopus (Figure 1), a co-designed serving runtime, GPU memory manager, and RL framework that replaces the flat text tape with a GPU-resident execution DAG. Agents coordinate directly over immutable server-side radix cursors through five primitives: fork shares the parent's KV prefix in O(1)\mathcal{O}(1) while granting each child a clean 32K growth budget; rewind rolls back dead-end detours and restores hybrid recurrent checkpoints hkh_k; read_thread mounts sibling KV pages in zero copy; and wait and done synchronize results. Two co-designed mechanisms make latent cross-branch execution both hijack-free and end-to-end trainable. First, Octopus decouples sequential working memory from associative recall in hybrid models [27]: read_thread splices sibling KV pages exclusively into full-attention layers under a monotonic position offset, while recurrent layers skip mounted spans. This zero-copy mount allocates zero new KV pages, retains 92.2% of full-text answer information, and cuts off-task hijacking by 21×21\times (57.9%→2.7%57.9\% \to 2.7\%). Second, our prefix-tree packed DAG kernel and DAG-GRPO objective deduplicate shared prefixes by masking each tree segment to a single owner while keeping mounted KV edges differentiable in the forward-backward graph. Retaining live mount edges cuts rollout-training divergence by 32×32\times (KL=0.0142→4.45×10−4KL = 0.0142 \to 4.45 \times 10^{-4}) and routes reader gradients directly into producer KV projections, keeping cross-branch latent communication strictly on-policy and end-to-end differentiable.

Trained on Qwen3.5-4B using pure binary outcome rewards with zero process shaping [28], Octopus discovers a self-organized division of labor from scratch (Figure 10). Without RL, exposing branching primitives yields no gain over 32K single-agent ReAct (26.3% vs. 26.0%). Under DAG-GRPO, the policy undergoes a sharp phase transition at Step 15: the root thread evolves into a dedicated commander that forks on Turn 1 in 98.0% of episodes (up 38×38\times), offloads 92.8% of 8K-page reads and 91.5% of rewinds to sub-agents, and coordinates a peer-to-peer latent KV mesh averaging 23.9 zero-copy mounts per episode. Disabling fork at test time on the exact same trained weights collapses paired BrowseComp-Plus accuracy by 21.7 points (50.8%→29.1%50.8\% \to 29.1\%), proving that gains come from live collective execution rather than weight memorization.

Isolating noisy document reads across clean 32K branches keeps per-turn active prompts at 26.4K tokens while scaling explored context to 329.2K (199.0K net surviving), compressing critical-path length by 1.94×1.94\times, more than doubling gold-document opening recall (21.1%→43.3%21.1\% \to 43.3\%), and lifting accuracy on the hardest multi-hop queries by 10×10\times (3.4%→34.1%3.4\% \to 34.1\%). Overall, Octopus-4B under sparse BM25 reaches 51.2% on OpenResearcher and 49.6% on BrowseComp-Plus (+17.5 points over 143K Single-Agent GRPO; Figure 8, Table 3). Despite its 4B footprint, Octopus surpasses 9B context-editing RL (42.5%) [15], matches snippet-only OpenAI o3 under BM25 (49.3%), and outperforms dense-retrieval browser agents up to 250×250\times larger—including 30B Tongyi-DeepResearch (44.5%), 671B DeepSeek-R1 (16.4%), 1T Kimi-K2 (35.4%), GPT-4.1 (36.4%), and Claude 4 Opus (36.8%). Our contributions are:

  1. GPU-Native Branching Execution Primitives (Sections 3.1 and 4.3): We formulate long-horizon exploration as a GPU-resident execution DAG over five primitives (fork, rewind, read_thread, wait, and done) with isolated 32K branch budgets and bounded runtime admission.

  2. Hijack-Free Zero-Copy KV Mounting (Sections 3.2 and 4.2): We splice sibling KV pages exclusively into full-attention layers under monotonic position offsets while recurrent layers skip mounted spans, retaining 92.2% answer information and cutting hijacking 21×21\times (57.9%→2.7%57.9\% \to 2.7\%).

TECHNICAL REPORT

  1. Server-Resident Radix Cursors and Prefix-Tree Packed DAG Kernels (Sections 3.3 and 4.2): We bind turns to immutable GPU radix cursors (89.6% KV cache hit rate) and compile prefix trees, recurrent checkpoints, and KV mounts into one packed forward–backward pass.

  2. Latent-Communication Tree RL and Emergent Collective Scaling (Sections 3.4, 4.1 and 4.3): We introduce DAG-GRPO with prefix-deduplicating loss masks and differentiable mount edges (32× lower rollout–training KL), eliciting emergent multi-agent division of labor and lifting Qwen3.5-4B to 49.6% on BrowseComp-Plus and 51.2% on OpenResearcher.

References (43)