Blog

You can't swarm inside Claude, so swarm around it

Each dot is one run, placed at how much it had spent when its best program first reached 99% of the reference score. Haiku swarm against OpenEvolve on Sonnet at three effort levels, on three geometry problems

SwarmEvolve, from Jiang and Karniadakis at Brown (arXiv 2611.08483), improves a program against an automatic scorer, round by round. In each round, hundreds of small agents reason inside one open-weights model's hidden states. On 21 math and scientific-computing problems, with one GPU and 60 minutes per run, it averaged 0.804 on Qwen3 8B, where 1.0 matches the best known result. The three open-source frameworks it was compared with scored 0.642 to 0.700. Claude's hidden states are not reachable through an API, so I built the nearest version that works from outside the model: a swarm of Haiku 5.5 calls that write short ideas, and one Haiku call that turns them into a program. Compared with OpenEvolve driving Sonnet 5.5, the Haiku swarm spent 9 to 33 times less to reach 99% of the reference answer on the two easier problems. On the hardest of the three, the two sets of runs overlapped. The slowest Haiku run spent slightly more than the fastest Sonnet run.

SwarmEvolve's agents reason without writing and one writer turns their state into code

Evolutionary code search keeps an archive of scored programs, asks a model to rewrite some of the best ones, scores each rewrite, and repeats. OpenEvolve makes one model call per new program. SwarmEvolve groups its agents into swarms that each study a parent program with a different focus, and the agents reason in the model's hidden states without producing text. A writer model receives what they computed and writes the next program.

Haiku proposers write their ideas in 45 words or fewer

Each round of my version runs four swarms. In each swarm, eight Haiku calls (the proposers) read one parent program and one of the paper's focus prompts, such as "the starting point of the solution", paired with a thinking style, such as "question one assumption the program makes". Each proposer replies with an idea of at most 45 words, without code. One more Haiku call (the writer) reads the eight ideas and the parent programs and writes a complete new program, which is scored as soon as it exists. The driver picks each swarm's parents differently: one refines one of the two best programs so far, one combines three of the best ten, one explores two drawn from anywhere in the archive, and one starts fresh from the initial program. Each program the Haiku swarm writes costs about a cent.

The paper's agents reason for very few steps. Its nearest text equivalent would be a small, fixed thinking budget, which I could not set: every call ran through claude -p, Claude Code's headless mode, and Haiku 5.5's thinking cannot be switched off or capped that way. Effort low was the smallest setting available, and at that setting the proposers did no thinking on more than half of their calls.

Ten Claude Code sessions ran 48 searches and 27,897 model calls in about six hours

Everything ran in Claude Code on the web, where each session's container has four CPUs. Every program the models write has to be run and scored locally, and running all 48 searches one after another in one container would have taken about 26 hours. So I split the runs into ten groups, kept one in this session, started nine sibling sessions for the other nine, and checked in on them as they ran. A shared scheduler kept the account inside its usage limits: when the five-hour window ran low, the Sonnet runs waited while the cheaper Haiku runs carried on, and the time spent waiting was left out of each run's clock.

The table below tallies the 48 runs.

Haiku swarm arms Sonnet loop arms
runs 23 25
model calls 26,523 1,374
programs scored 3,073 1,300
list-price cost $22.61 $79.69

The Haiku arms ran 3,058 swarms. Together the calls read 83 million tokens from the prompt cache, wrote 81 million to it and generated 32 million. By Oskar's count, the experiment, run on 9 November 2026, took two full five-hour usage windows and nearly two days' worth of the account's weekly limit.

Three geometry problems range from easy to hard for a small model

Oskar set the test before any run: "Arm B beats Arm A at matched spend on all three seeds. Anything less is noise at n=3, and the writeup should say so." Arm A is stock OpenEvolve driving Sonnet 5.5, which costs 20 times as much per token as Haiku 5.5. Arm B is the Haiku swarm. Each run stopped at $3 of list-price spend or after 60 minutes, with three seeds per arm. Sonnet ran at three effort levels, Claude's setting for how much it thinks before answering.

The problems are three of OpenEvolve's own examples with a known reference answer. In circle packing, 26 circles go in a unit square and the goal is the largest total radius. In hexagon packing, the goal is the smallest regular hexagon that holds 11 unit hexagons. In the Heilbronn problem, 11 points go in a triangle, placed so that the smallest triangle any three of them form is as large as possible. A score of 1.0 matches the best known circle packing, or AlphaEvolve's published construction for the other two problems, so scores above 1.0 are possible there. Hard here means hard for a small model: in SwarmEvolve's own table, OpenEvolve on Qwen3 8B scored 0.88 on circles, 0.55 on hexagons and 0.05 on Heilbronn.

The three videos show what each task asks. The circle and hexagon videos start from the answer that OpenEvolve's starting program gives. That program puts all 11 Heilbronn points on one corner, so the Heilbronn video starts from a random arrangement instead. Each video moves in a straight line to the answer from the Haiku swarm's best program. That line is a visual bridge, not the path the search took. A shape turns red while it overlaps another or sticks out of its container, and the score under each frame is recomputed for that frame. In the Heilbronn video the shaded smallest triangle passes from one set of three points to another as the points move. At the best answer, 17 of the 165 possible triangles tie for the smallest area, so enlarging any one of them means moving a point that other tied triangles share.

The Haiku swarm spent 9 to 33 times less to reach 99% on the two easier problems

The table compares the Haiku swarm with the Sonnet effort level that did best on each problem. I picked that level after seeing the results, which favors Sonnet. The ratios pair the extremes. On circles, Sonnet's cheapest run cost 17 times as much as the Haiku swarm's most expensive one, and Sonnet's most expensive run cost 33 times as much as the Haiku swarm's cheapest. On hexagons the same comparison gives 9 and 17 times.

problem Haiku swarm: $ to 99% best Sonnet effort: $ to 99% ratio
circles $0.013–0.019 $0.32–0.44 (medium) 17–33×
hexagons $0.035–0.060 $0.53–0.58 (high) 9–17×
Heilbronn $0.09–0.50 $0.77–1.02 (medium) 1.5–11×

Oskar's test was written against Sonnet at effort high. I switched the paired baseline to effort low after Sonnet's circle-packing scores did not vary with its effort level. At $0.25 spent, every Haiku swarm run was ahead of the Sonnet run at effort low with the same seed on all three problems: 0.998 to 1.0 against 0.963 to 0.964 on circles, and 0.995 to 0.998 against 0.981 to 0.982 on hexagons. On the two harder problems the Haiku swarm runs were also ahead of the Sonnet runs at effort high. The Haiku swarms evaluated 88 to 156 programs per dollar, against 4 to 20 for the Sonnet loop.

Circle packing: best score against dollars spent and against wall-clock minutes, three seeds per arm

Hexagon packing: best score against dollars spent and against wall-clock minutes, three seeds per arm

The Haiku swarm's cost advantage fell to 1.5 to 11 times on the hardest problem

The starting program for Heilbronn scores zero. The Haiku swarm still led at $0.25, scoring 0.928 to 1.0 against 0.790 to 0.835 for Sonnet at effort low, and all three Haiku runs reached 1.0 within their 60 minutes. The dollar ranges overlap. The slowest Haiku run reached 99% at $0.50, while one Sonnet run at effort low got there at $0.46. Of the other two Sonnet runs at effort low, one needed $1.17 and one never reached 99%.

Heilbronn triangle: best score against dollars spent and against wall-clock minutes, three seeds per arm

Sonnet matches the Haiku swarm's final scores once it spends about $3

The default Haiku swarms reached their 60-minute limit after spending $0.89 to $1.39. With its full $3, Sonnet ended at the same scores. On hexagons, one Sonnet effort-high program scored 1.0008, slightly above AlphaEvolve's published construction, and it reproduced on a re-run. The best Haiku swarm hexagon program scored 1.0007 and did not reproduce, because it uses randomness.

The effort level mattered for Sonnet on two problems of three. On hexagons only effort high passed 0.999 on all three seeds, on Heilbronn only effort medium reached 1.0 on all three seeds, and on circles the three settings finished within noise of each other. The charts also show a Haiku swarm with its writer at effort low. That variant reached 0.999 on every circle seed, but on hexagons none of its runs reached 0.999, and on Heilbronn one never reached 0.99.

The writer alone nearly matched the full Haiku swarm on circle packing

In SwarmEvolve's own ablation, swarms of 0 to 75 agents ended their 60 minutes at similar scores. A control run here gave the same result. With the proposers removed, four Haiku writers working alone reached 0.999 on circle packing at $0.26, against $0.20 for the full swarm with eight proposers per writer. That is one seed on the easiest problem. The proposers took 30 to 39% of the Haiku swarm's spend, so part of its advantage may come from Haiku writing many cheap programs rather than from the ideas.

Circle packing with four swarm shapes, one seed each: two swarms of 16 proposers, four of 8, eight of 4, and four writers with no proposers

The search runs as a skill with a dollar cap and a score bound

The Haiku swarm is packaged as evolving-with-swarms, which runs from Claude Code on the web or the desktop. You supply a problem statement, a starting program and an evaluator. It meters every call against a dollar cap, waits when the account's usage window runs low, and treats any score above a bound you set as zero. The results, plots and code are in haiku-swarm-poc.