LaMAR: Latent Multi-agent Collaboration via KV-Cache Communication for Automated Program Repair
Abstract
Multi-agent systems for automated program repair communicate through text tokens, requiring each agent to decode its internal state into discrete symbols and the next agent to re-encode them. This conversion loses information and incurs token overhead that grows quadratically with the agent count. We develop Latent Agent Communication (LAC), a theoretically grounded framework that formalizes how agents can share KV-cache representations directly in continuous space, and prove it provides a communication channel with strictly higher information capacity while reducing token complexity from O(N^2) to O(N). We instantiate LAC as LaMAR, a dual-chain repair system: Bug Analysis Chain diagnoses the bug through four collaborating latent agents; Repair Chain refines the patch through multi-agent latent collaboration with cross-chain context transfer, and supports optional multi-round iteration for complex defects. Evaluated across three benchmarks spanning Java, Python, and C++ with three model families, LaMAR with Qwen3-8B achieves 24.5% repair success rate on Defects4J and 62.1%--87.5% on DebugBench and QuixBugs, outperforming all baselines in the large majority of settings. Ablation experiments identify the bug analysis chain and latent communication as the most critical components.