TL;DR
SWARMRESEARCH is a novel multi-agent framework designed to prevent AI coding agents from prematurely converging on suboptimal solutions during open-ended optimization tasks. By separating global strategy (managed by a "Shepherd" agent) from local execution (carried out by "Search" agents in isolated git branches), it enables broader architectural exploration and outperforms state-of-the-art LLM-guided evolution and multi-agent baselines on 13 out of 15 complex benchmarks.
What Problem Does This Paper Address?
Long-running AI coding agents (like Karpathy’s autoresearch) show immense promise in autonomously optimizing code. However, they suffer from a major flaw: they tend to quickly settle on a single high-level approach and spend the rest of their compute budget making minor, low-level tweaks.
The authors identify two core harness-level design flaws causing this "greedy local search" behavior:
- Context Accumulation: As an agent iterates, its conversation history grows. This long history anchors the LLM, making it highly unlikely to pivot to a completely new, radical approach.
- Single Program State: Traditional agent loops overwrite or revert code on a single branch. They lack a mechanism to preserve and independently evolve alternative, competing ideas.
Methods
SWARMRESEARCH introduces an orchestrator-subagent architecture that treats the optimization space like a branching tree, managed natively via Git.
The framework splits responsibilities between two agent roles:
- The Shepherd Agent (Orchestrator): Maintains global context over all attempts and scores. It strategically steers the population by deciding which parent solutions to build upon, adjusting the balance of parallel vs. serial execution, and providing minimal, non-prescriptive prompts to subagents.
- Search Agents (Subagents): Operate with strictly local context inside isolated git branches and worktrees. They are divided into two types:
- Explorer Agents: Spawned with fresh context windows. Being unanchored to prior conversation histories, they are free to attempt major, high-level code rewrites.
- Optimizer Agents: Inherit their parent's conversation history to perform deep, serial refinement on a promising approach.
Before completing a run, each Search Agent appends a concise summary of its findings to a local findings.md file, providing a lightweight history for future descendants without cluttering their active context windows.
Datasets
The authors evaluated SWARMRESEARCH across 15 open-ended optimization tasks spanning three distinct domains:
- Mathematics: 5 tasks requiring optimization programs to find new mathematical bounds (e.g., Circle Packing, Signal Processing).
- Systems Engineering: 5 tasks from the ADRS benchmark, which mimics real-world systems research (e.g., Transaction Scheduling, LLM-SQL).
- Heuristic Algorithms: 5 competitive programming tasks from ALE-Bench-Lite (derived from the AtCoder Heuristics Contest), which heavily reward creative, problem-specific human-like algorithms over simple hyperparameter tuning.
Additionally, they conducted an extensive case study on Approximate Speculative Decoding using 100 reasoning-intensive tasks drawn from LiveCodeBench v6, AIME 2026, GPQA Diamond, and HLE-MCQ.
Key Insights and Ideas
- Context Isolation Preserves Diversity: Forcing Explorer agents to start with a blank slate (fresh context) effectively unanchors them from previous failures or biases, encouraging them to try entirely different algorithmic families.
- Git as a Natural Search Tree: Utilizing native git branches allows the framework to naturally maintain competing implementation states. Promising but temporarily lower-performing solutions are preserved rather than discarded.
- Dynamic Test-Time Scaling: Rather than using a fixed number of parallel agents or serial steps, the Shepherd agent dynamically adapts the search "width" (parallel exploration) and "depth" (serial optimization) based on current progress, outperforming optimal fixed-scaling baselines.
Key Results
SWARMRESEARCH matched or exceeded state-of-the-art baselines (EvoX and CORAL) on 13 out of 15 tasks.
Crucially, the framework achieved this through higher-level exploration. As shown below, SWARMRESEARCH typically made significantly larger code modifications—changing a median of 3.2× more lines of code than CORAL and 1.7× more than EvoX.
In the speculative decoding case study, SWARMRESEARCH successfully discovered a complex combination of continuous batching, independent RNG streams, and adaptive MoE expert-count pruning. It achieved a 4.58× speedup over vanilla decoding, vastly outperforming vanilla autoresearch (1.80×) and CORAL (2.26×).
Limitations and Future Work
While SWARMRESEARCH excels at exploring the solution space, it does not enhance the fundamental creativity of the underlying LLM; the agents still tend to explore variations of known techniques rather than inventing entirely novel paradigms.
Furthermore, the Shepherd Agent's steering behavior remains highly prompt-reliant. In testing, the orchestrator occasionally struggled to synthesize abstract bottlenecks into strategic prompts without accidentally prescribing specific solutions, indicating that training LLMs specifically for search orchestration is a promising direction for future work.
Summary updated