Coding agents for systems research: pick the problem, then build the loop

Over the past year I built two benchmarks where coding agents do real ML-systems work, and I'm now building an agent that optimizes a customer's LLM serving system for hours, and improves itself while it runs. The lesson I keep relearning: the model matters less than the loop around it. This post covers the one decision that comes first (which problem to give the agent) and the three parts of the loop that decide whether its results can be trusted. It ends with two ways that strong agents still get stuck.

The three projects

The agent loop A problem defines the environment. The agent works inside the environment and submits candidates. A hidden verifier checks each candidate on a fresh server, the reward scores it, and the result goes back to the agent through memory. 0 · the problem clear feedback, runs in a loop 1 · environment sandbox · GPU · start point coding agent root shell, hours candidate files on disk, not claims 3 · verification hidden · fresh server · a seed the agent never saw 2 · reward one number for the goal, paid only if gates pass memory
Figure 1. Every project follows the same loop. The problem comes first because no loop can rescue a problem without clear feedback. The other three parts decide whether a number the agent produces means anything.

0Pick the right problem

Before any harness work, ask two questions about the problem. Can a program tell, without a human, whether a candidate is better? And can the agent try many candidates in the time you have? Systems performance work often answers yes to both: you can run the candidate on a workload and measure it. Audrey Cheng and colleagues make the same argument in Barbarians at the Gate, calling the approach AI-driven research for systems.

The second question is where the hard cases live. A serving system takes minutes to rebuild and a 30-minute replay to judge, so an 8-hour ServerBench run gets a handful of honest measurements. In ServeForge a traffic run is twenty minutes of the one GPU, so even a twelve-hour engagement gets a few dozen. A compressed 27B checkpoint takes longer still to produce and evaluate. The fewer tries a problem allows, the more each one has to count, and the more the harness has to decide what to try.

Where problems sit An illustrative map with the cost of one verified try on the horizontal axis and how exact the feedback is on the vertical axis. Kernel tuning and sparse-attention policies are cheap and exact. Serving systems and checkpoint compression are exact but slower. Pretraining a new architecture is slow with noisy proxy feedback. cost of one verified try → (minutes … hours … days) feedback: proxy / noisy → exact sweet spot GPU kernel tuning one serving flag serving system (replay) checkpoint compression pretraining a new architecture "is this idea novel?"
Figure 2. An illustrative map, not a measurement. Problems in the top left give the agent many exact signals per run. Problems to the right still work, but each measurement is precious, so the verifier has to be right the first time. Problems near the bottom need a human in the loop.

1Environment: the sandbox and the start point

ServerBench and CompressionBench run agents in Harbor sandboxes: a container with a GPU, the model weights, the toolchain and nothing else, with the network cut once the image is built so the agent cannot download a finished answer. ServeForge gives every agent the same pinned engine, machine and brief, on local GPUs or cloud sandboxes, plus a single added command, finish. In all three, the grader's traffic, tests and thresholds never enter the sandbox.

The start point is part of the environment, and it shapes the search. ServerBench starts from a correct but naive server, so every gain is the agent's own work and the baseline cannot be gamed. ServeForge starts from the opposite end: the customer's own serving command on a production engine, measured at several loads, so the agent has to beat a deployment someone already tuned. A start point too far from the goal wastes the run on boilerplate; one too close leaves only flags to turn, which is exactly where the first failure mode below begins.

2Reward: define the goal as one number

The reward should be what you would actually pay for. In ServerBench it is token value per dollar of GPU cost, counted only for requests that meet the latency targets. A server that is fast but answers wrongly earns nothing, and so does one that is accurate but too slow. ServeForge pays income per GPU-hour at the customer's prices, and only if the server comes up, at least 99% of requests complete, hidden probes match the reference engine and every behaviour test passes.

The agent will optimize anything you measure, so the reward has to say what may not be traded. In ServeForge, five of the eight graded DeepSeek runs on two tasks raised their income by lowering precision: a recurrent state served in bf16 where the task gives fp32, or an fp8 KV cache on a BF16 checkpoint. They measured $38–74 per GPU-hour against the customer's $22–33, and every one scored zero. None of them tripped a speed or latency gate; each broke the rule written into the agent's instructions: a server must compute, for every request, what the checkpoint itself would compute.

3Verification: grade files, not claims

Nothing the agent reports is graded. In ServerBench, the grader boots the server from the files the agent froze and replays sessions the agent never saw; a run whose frozen tree does not boot gets no verdict at all. CompressionBench runs its hidden verifier exactly once, after the deadline. ServeForge re-creates the deliverable from its files on a fresh server, runs the grader's traffic on a seed that never entered the sandbox, and checks every gate against a deliberately dishonest server before trusting it. Then a stronger model reads what the run actually changed and rules it clean, likely hacking or hacked.

The precision cases above were caught this way: each server measured well on its own numbers, and each was a different system from the one the customer asked for.

Two ways strong agents still get stuck

The loop makes results trustworthy. It does not make the search good. Across our ServerBench and ServeForge runs with DeepSeek, Sonnet and Opus models, two failure modes kept showing up, and they look the same across model families.

1 · They settle into a local optimum

On the ServerBench task that serves Qwen3.5-9B, every run of one Opus model built a capable engine (paged KV cache, prefix reuse, CUDA graphs) and then spent its remaining hours refining it. Their p90 time per output token landed between 49.8 and 60 ms. The best DeepSeek run reached 35.8 ms. None crossed the task's 23.5 ms bar by tuning. The one run that did, at 13.1 ms, added a different idea: speculative decoding with the model's own multi-token-prediction heads.

p90 time per output token on the ServerBench Qwen3.5-9B task, lower is better Opus 5 runs: 49.8 to 60 milliseconds. SGLang baseline: 39.7. Best DeepSeek V4.1 Flash run: 35.8. Opus 5.5 with speculative decoding: 13.1. The task bar is 23.5 milliseconds. 0 20 40 60 80 ms task bar 23.5 ms Opus 5 · 7 runs 49.8–60 SGLang baseline 39.7 DeepSeek V4.1 Flash · best 35.8 Opus 5.5 · + speculation 13.1
Figure 3. p90 time per output token on the ServerBench Qwen3.5-9B task (lower is better). Refining one design plateaued well above the bar; only a change of approach crossed it. The Opus 5.5 run's correctness check was lost to a harness defect, so its result is reported but not scored.
data table
agentp90 TPOT (ms)
Opus 5, 7 runs with logs49.8–60
SGLang baseline39.7
DeepSeek V4.1 Flash, best of 235.8
Opus 5.5 with speculative decoding13.1
task bar23.5

ServeForge shows the same shape one level down. Four DeepSeek runs spent their engagement on configuration: 30 to 47 runs of the stock engine with different flags and not one run of a changed engine, including seven hours of 300-second flag comparisons inside a 42% run-to-run swing. Flags pay first and then level off, and an agent that measures one small gain at a time never sees the hill it is standing on.

2 · They commit to one idea and never leave it

The second failure is earlier and more costly: the agent picks a path in the first hour and treats it as fixed. Both Sonnet 5 runs on the Gemma-4 task kept the stock Hugging Face forward pass and tuned around it. One of them measured its time per token at 204–224 ms in eight of its own replays and changed nothing about the design that caused it. The runs that met the latency bar on that task had all written their own engine. A DeepSeek run on the 9B task saw its server emit doubled tokens and called them "an artifact I've seen all along" instead of questioning the path that produced them.

One Sonnet 5 run's design path on the Gemma-4 E4B task The run started on the Hugging Face forward pass, added a static cache and CUDA graphs for short prompts, then replayed eight times at 204 to 224 milliseconds per token without changing the design. The branch it never took, writing its own engine, is what the runs that met the bar did. HF forward pass start cache + CUDA graphs graphs for short prompts only replay × 8 204–224 ms per token same design never tried: write its own engine what every run that met the latency bar did
Figure 4. One Sonnet 5 run on the ServerBench Gemma-4 E4B task. The agent kept measuring the same design and never went back to the decision that capped it.

Across families the pattern is the same: each model made recognisably the same design decisions run after run, and those decisions predicted its result better than run-to-run noise did. Strength does not cure it either: even the strongest ServeForge run so far rode a plateau to the end, with repeated attempts at one design and re-validation, and no new best in its second half. More hours do not fix this, because the agent spends the extra hours on the path it already chose.

What I'm trying next

Both failures are search problems, so in S800 the fixes go into the harness rather than the prompt. Four are in place or in progress:

None of this solves the problem yet. But it changes where I spend my time: less on prompting agents, more on choosing problems with honest feedback and on building loops that push agents off the path they would otherwise never leave.

ServerBench, CompressionBench and ServeForge are joint work with my collaborators at CMU's InfiniAI Lab, led by Prof. Beidi Chen. Numbers come from our run records: the ServerBench analysis of past runs on the Qwen3.5-9B and Gemma-4 E4B tasks (Oct 2026), and ServeForge's results ledger and failure tables for S800 (Nov 2026). Model names are those of the runs. Code: ServerBench · CompressionBench.