Blog
hedwigaihedwigaihedwigai

Paper, read

Your coding agent isn’t stuck because it’s dumb. It’s stuck because it’s alone.

Give a strong coding agent a hard GPU kernel, a $1,000 budget and several days. How close does it get to the kernel experts wrote?

On one of DeepSeek-V3’s attention kernels, Codex running GPT-5.5 at its highest reasoning setting reached 28% of expert performance. That is the opening result of Evolving Agent Teams, a paper from UC Berkeley’s Sky Computing Lab published on 27 October 2026.

The authors keep the model and the budget the same and add a supervisor agent. It watches a team of agents work, diagnoses why progress stopped, and redesigns the team.

Why agents plateau

The kernel in question is MLA paged decode. A DeepSeek-V3 server runs it for every token it writes.

A model writes its answer one token at a time, and each new token looks back at every token before it. To avoid recomputing, the model keeps a key and a value for each earlier token in a KV cache, which production servers store in fixed-size pages. DeepSeek’s Multi-head Latent Attention, MLA, squeezes each token’s key and value into one small vector to keep that cache small.

Decode is the work of writing the next token, and the kernel is the GPU program that does it. Two matrix multiplies sit at its centre: Q·K scores the cached tokens against the new one, and P·V mixes their values by those scores.

The expert kernel comes from FlashInfer, the open-source library production servers run. Matching it means keeping tensor cores and CUDA cores busy together, with registers that MLA’s wide heads nearly fill.

One decode stepKV cachesqueezed, in pagesQ·Kscore each tokentensor coresSoftmaxscores → PCUDA coresP·Vmix the valuestensor coresNew tokenThe two kinds of core, over timeSlow: tensorSlow: CUDAFast: tensorFast: CUDAthe same work, done soonerOne thread’s registersthe new token’s querya tile of the cachescores, Pthe output so faralmost nothing left over
One decode step. Filled boxes run on tensor cores, outlined ones on CUDA cores. The cache is read in tiles, and each tile goes through Q·K, softmax and P·V. A schematic, not to scale.

A fast one needs WGMMA, the tensor-core instructions on Nvidia’s Hopper GPUs for large matrix multiplies. With a wrong shared-memory layout, WGMMA returns wrong values without an error, and the agent has to find which layout is wrong.

Agents working alone tried WGMMA, failed the correctness tests a few times, and switched to WMMA. WMMA is an older, simpler tensor-core API. It is easier to make correct, and it uses less of the hardware. Then they spent the rest of the budget tuning it. Each tweak added a little speed. None of them replaced WMMA, which uses less of the tensor cores and so caps the kernel’s speed.

Claude Code with Opus 4.6 did the same and stopped at 0.44–0.51× of the production FlashInfer kernel. Two systems built only for kernel work, K-Search and CUDAForge, did it too. In two runs each, neither produced a WGMMA kernel.

A local optimum

A coding agent improves a kernel by local search. It makes an edit, compiles, runs the tests and times the result, and it builds on the edit if the kernel is correct and faster. Each move is judged by the score it gets right away.

FlashInfer, 1.0×speedfails the tests: scores 0WMMA designsWGMMA designsone agent stops: 0.44–0.51×××each step this way scores 0,so the search turns backthe team crosses0.74×, same budget1.21×, more budget
Kernel designs drawn as a landscape, height as speed. The peaks are the paper’s measured results; the shape between them is our sketch of its account.

WMMA designs sit on a low hill. Small edits there compile, pass and add a little speed, so the search climbs. WGMMA designs sit on a higher hill, across a valley where nothing passes. Moving to WGMMA means getting the shared-memory layout, the descriptors and the register layouts right together, and any one of them wrong scores zero. Any single edit from a WMMA design toward WGMMA scores zero, so local search rejects it.

The model’s weights were set in training, which included reinforcement learning on coding tasks where passing tests is a common reward. None of that training scored this kernel’s speed, and the weights do not change during the run. A failed WGMMA attempt adds an error message to the context window and no gradient to the weights, so the tenth attempt runs on the same weights as the first.

How attention loses old findings

Within a run, the model’s only memory is its context window. Every token it writes attends over the tokens before it through a softmax, so the attention weights on all earlier tokens sum to one. The longer the context, the thinner each old token’s share, and position encodings such as RoPE tilt the share further toward recent tokens. Long-context models are measurably worse at using what sits in the middle of a long context.

Inside one sessionoldestnewest tokenan early findingBar height: the attention the newest tokengives each position. One softmax, so theweights share a total of 1.Across sessionsTeam V4’s contexttaskLEARNINGS.mdwork…report: use RSTeam V5’s contexttaskLEARNINGS.mdwork…no position for thereport: weight 0×Model weightsThe same in every session. Nothing in the run trains them, so a failure leaves no trace in the model.
A schematic. Left, the shape of attention with distance; right, what Teams V4 and V5 had in front of them.

A new session is the extreme case. Its context starts with the task and whatever files it is told to read. A finding that is not in those files is not in the context, so it gets no attention.

The supervisor cannot change the weights. It changes three inputs instead: the design each team starts from, the edits each role may commit, and the files each new session reads first.

The fix: a supervisor that redesigns the team

The paper describes any agent team as three choices:

  • Roles: what each agent is responsible for.

  • Coordination: how agents hand work to each other. A pipeline (research, then implement, then profile), parallel branches, or both.

  • Knowledge management: where findings are written, and who must read them.

Most multi-agent setups fix all three before the run starts. Here a supervisor agent changes them during the run. It runs when a team finishes and at fixed intervals, and each time it follows the four steps below.

  1. 1

    Monitor

    Scores, progress and each agent’s report

  2. 2

    Reflect

    Name the failure pattern

  3. 3

    Redesign

    Roles, coordination, knowledge rules

  4. 4

    Launch

    Start the next team, each agent with a mandate

back to Monitor when a team finishes, or on a timer

Shared file system, kept across every team

  • Code and test harness
  • Learnings document
  • Each team’s kernels and records
  • The supervisor’s history of changes
The supervisor’s loop, after Figure 2 of the paper.

There are no predefined roles. The supervisor invents them from what it diagnoses. On the decode kernel it tried more than 100 team configurations. Some of the roles it created:

  • Disciplinarian

    Blocks any commit that leaves the WGMMA path. One change per commit, so every gain can be traced.

  • Fresh-Eyes Agent

    Retries approaches earlier teams dismissed.

  • Challenger

    Stress-tests claims that the kernel has hit its ceiling.

  • Knowledge Integrator

    Turns findings scattered across teams into one document with a plan.

Table 3 of the paper lists 22 roles in all, from a Roofline Analyst to a Compiler Specialist.

Under every team sits the shared file system in the figure above. Each new team starts from everything earlier teams found.

After the supervisor added the Disciplinarian, the kernel’s speed against FlashInfer fell from 0.15× to 0.065×. The 0.065× kernel was the first correct WGMMA kernel, and every later version was built on it.

The recommendation nobody read

The supervisor numbers its teams V1, V2, V3 and so on. From V3, every team ran into the same wall: getting the P·V multiply onto WGMMA. V3, V4 and V5 each tried and failed on the same root cause.

Team V4 also wrote down a fix. Its report recommended a register-source WGMMA, which keeps the scores (P) in registers. Teams V5, V6 and V7 ignored the recommendation. It sat in V4’s report. It never reached the shared learnings document, the file later teams read.

The supervisor’s diagnosis: “Lost knowledge between teams is the biggest structural weakness.” The learnings document kept single facts. It did not keep strategic advice that spanned experiments.

So the supervisor changed the knowledge rules. It added a Knowledge Integrator and a new file, SYNTHESIS.md, that joins every agent’s findings into one plan. Every later team had to read it.

  1. V3–V5

    Each team tries to put the P·V multiply on WGMMA. Each fails on the same root cause.

  2. V4

    V4’s report recommends a fix for the P·V multiply: a register-source WGMMA. The recommendation stays in the report.

  3. V5–V7

    These teams do not use the fix. It was never added to the shared learnings document, so none of them read it.

  4. V8

    The supervisor adds a Knowledge Integrator and SYNTHESIS.md, required reading. The P·V multiply passes a standalone test for the first time.

  5. V9

    The P·V multiply goes into the kernel.

  6. V10

    A fresh profile of the new kernel guides the next changes: 0.50× → 0.66×, +32%.

One recommendation, from the report it was written in to the kernel. Section 3.3 of the paper.

The model was the same from V7 to V8. What changed was one file, SYNTHESIS.md, and the rule that every team reads it.

Results

The main comparison is the MLA decode kernel on an Nvidia H100, scored on 47 production DeepSeek-V3 workloads from FlashInfer-Bench. Every system had the same token budget. 1.0× would match production FlashInfer.

MLA paged decode on H100: mean speedup over production FlashInfer at a matched budget
  • Evolving agent team (Opus 4.6)0.74×

    Figure 3a, best of two runs

  • Claude Code (Opus 4.6)0.51×

    Figure 3a, best of two runs

  • Fixed four-role team (Opus 4.7)0.31×

    Figure 6, one run

  • Codex (GPT-5.5 xhigh)0.28×

    Figure 6, one run

FlashInfer = 1.0×

The fixed four-role team is the useful control. Its four roles were Profiler, Hardware Researcher, Planner and Implementer, and they never changed. It ran a newer model than the evolving team. It finished below Claude Code alone.

With more budget, the evolving team’s kernel reached 1.21× the speed of production FlashInfer on average. It was faster on 36 of the 47 workloads and at 0.86–0.99× on the other 11. The best earlier published result was 0.61×, from K-Search.

The authors also ran four further settings with newer models (Opus and Sonnet 5.5):

  • KDA prefill, the kernel that reads the prompt for Kimi Delta Attention: 3.01× faster than vLLM’s production kernels on an AMD MI350X, and 3.44× faster than FlashKDA on an Nvidia B200.
  • Serving a large model on a Mac: Qwen3.8-Flash-Next, about 79 GB of 4-bit weights, served on a 48 GB M4 Pro by streaming experts from SSD, at 30.3 tokens a second.
  • RoboDojo, 42 simulated two-arm robot tasks: a control program scoring 62.1 on held-out seeds, against 55.3 for the best leaderboard entry.

What the numbers don’t settle

  • Few runs. The main settings ran twice, and the paper reports the better run. The fixed-team and Codex runs happened once, and so did the four newer settings. The authors say this limits statistical conclusions.

  • At equal spend, the Mac result is a tie. At $200, a single Claude Code agent scored 1.047× and the team 1.056×. The team pulled ahead only with more time and money: 1.083× at $509. On the MI350X at $300 the gap was clearer: 1.65× solo, 2.13× team.

  • The 1.21× needs extra budget. At a matched budget the team reached 0.74× on MLA decode, still below FlashInfer.

  • Some runs start strong. The B200 KDA run began from a port of FlashInfer’s kernel that already scored 1.96×. The Mac run began from a server the team had already made 3.2× faster. These measure improvement over a good start, not from scratch.

What this means if you run agents

In the paper, team design moved the result as much as the model did. The fixed team ran a newer model and scored 0.31×, less than half the evolving team’s 0.74×.

  • When an agent stalls, ask why before adding tokens. Each of the supervisor’s changes answered a named failure. Drift got a Disciplinarian. A debugging problem that blocked all tuning got its own branch, so one agent debugged while another tuned. A lost insight got a synthesis file. A new design got a fresh profile, because the old bottleneck analysis no longer applied.

  • Write findings where the next session reads. A new session reads the task and the files it is told to read. With Claude Code or Codex, keep one file in the repo that every new session is told to read first, and update it when a finding changes the plan.

  • Make the hard constraint someone’s job. Agents told to use WGMMA switched to WMMA after a few failed tests. In the paper, a second agent that rejected every commit leaving WGMMA kept the team on it.

  • Splitting work across agents can hide a bug. The paper traces the fixed team’s slow start to one bug. The researcher knew the layout rule, the implementer wrote the layout, and neither read the other’s file. A single agent would have had the rule and the code in one context.

Try it

We wanted to see the effect with a model small enough to run on a laptop. We gave Qwen3.5-4B a toy tuning task with the same shape as the kernel: six settings, an easy design that tops out at 0.50×, and a fast design worth up to 1.06× that only works once three settings change together. Change one alone and it fails with a compile error or wrong output.

Each run got 40 model calls, and we ran each setup 20 times. The evolving team’s supervisor redesigned it three times per run, and its calls came out of the same 40.

Qwen3.5-4BMean bestReached the fast designTokens per run
Solo agent0.69×8 of 2042k
Fixed team of three0.93×16 of 2044k
Evolving team0.89×15 of 2030k

The solo agent plateaued the way the paper describes. In 12 of its 20 runs it tried the fast design, watched it fail, and settled between 0.42× and 0.49× on the easy one. Both teams got past that wall about twice as often.

The supervisor did not beat the fixed team. A 4B model writes fluent diagnoses that are often wrong: in 12 of 20 runs it banned the fast design at least once. What it did do was cut tokens by 30%, because each role reads only its own history. With Qwen3.5-0.8B, no setup beat the solo agent at all.

Our harness, prompts and scorer are in a gist, and every run is replayed call by call in the demo below.

This is a synthetic task with a scorer we wrote, run on one Mac. It illustrates the idea; it does not reproduce the paper, whose supervisor read real compiler and profiler output. We had no part in the paper. For the real thing, read it and run the authors’ code.

Sources

More head-to-head evals

GLM-5.3 against DeepSeek V4.1 Flash on 75 questionsTwo models answer the same 75 questions; one is always right, the other 14× cheaper.
MeasureGLM-5.3DeepSeek V4.1 Flash
Right, of 757571
Seconds a question, median3.91.8
Read the comparison
How we made a long-running AI agent for knowledge work 4× fasterOne cited knowledge work task through 13 experiments: 937 s to 233 s, with the model held constant.
MeasureFirst runBest since
Landscape, seconds937233
Memo, seconds759602
Read the report
Ten models plan a change to a spreadsheet: which do it in under a minute, traced call by callTen models drive one agent harness through the same spreadsheet request; six write the plan, timed and traced call by call.
MeasureQwen3 235BGLM-5.2Gemini 3.8 FlashClaude Opus 5
Seconds to the plan, median27485794
Plans written, of three runs2333
Read the comparison
SubQ, jev, Perplexity's Decider and Bespoke's Nimble on biotech diligence memos: finding the sentences a column is aboutFour decision models judge every sentence of ten biotech diligence memos for five columns, scored against sentences a person marked.
MeasureSubQjevDeciderNimble
Found, mean of five columns at section length64%65%66%68%
Mechanism of action, found at section length57%51%61%54%
Read the comparison
Leads with a reason to write: hedwigai ask, Apollo and treg on one brief40 leads each, every one checked: the right person, an inbox that accepts, and a dated reason to write.
MeasureaskApollotreg
Usable leads13 of 407 of 406 of 28
Cost per usable lead$0.037$0.27$0.23
Read the comparison
Self-hosted decisions for ask: Perplexity's open Decider in place of jev on 92 company questionsThe decisions inside hedwigai ask made by Perplexity's open Decider on two NVIDIA RTX 3090s, against jev.
Measureask with jevask with Decider
Questions right, of 928989
Wrong answers12
Read the comparison
Clinical decisions: jev and ask on System One, PubMedQA, SciFact and a 370-decision setEdgeEvals' System One board, PubMedQA, SciFact, and a clinical set built to System One's rules.
Measurejevask
Our 370 clinical decisions, right94.6%93.0%
PubMedQA, right (best EdgeEvals scored: 62.2%)77.0%74.4%
Read the comparison
Executive lookup for US-listed companies: Claude Opus 5.5 and ask on 95 questionsWho runs a public company, and how to email them: a frontier model from memory against hedwigai ask.
MeasureaskClaude Opus 5.5
Questions right, of 955963
Small companies right, of 20139
Read the comparison
Rental comps: floor-plan rents and amenities on 14 listings, five assistants comparedRent per floor plan and amenities for US rentals: hedwigai realestate-us against Claude, GPT, Gemini and Perplexity with web search.
Measurerealestate-usBest of four assistants
Floor-plan rents right, of 262623
Amenities claimed the listing doesn't state12129
Read the comparison
Company screening from SEC filings: jev, Vela 2.0 and ask on 92 yes/no questionsYes-or-no questions about public companies, answered by two decision models alone and by hedwigai ask.
Measureaskjev
Right, of the questions answered98%79%
Wrong answers, of 92219
Read the comparison
Defect localization in industrial images: four frontier models and a trained localizerFour frontier models asked to put a box around what they just described.
MeasureTrained localiserBest of four frontier models
Mean overlap with the defect (IoU, 0 to 1)0.4210.109
Read the comparison