Skip to content

Coding agents can design your serving stack. Your repo context is where they go insecure.

#coding-agents #code-security #llm-serving #benchmarks #repository-context

A coding agent beat the vLLM reference by 4.87x, and a third of the runs still failed ​

Give a coding agent a GPU budget, a latency target, and a service to replace, and it will come back with something. ServerBench puts a number on how good that something is.

The benchmark ran 11 coding-agent models across three deployments, 33 runs total, one per model-deployment pair. Each run starts from a task spec and a shared objective: latency-qualified token value per dollar of GPU cost, reported as a normalized score where 1.0 means parity with the reference system. Claude Sonnet 5.5 finished at 2.97 on Gemma E4B. That's 4.87 times the vLLM reference, which works out to roughly 0.61 for the reference on the same scale. Triple the usable tokens per GPU dollar, if you trust the score.

The score is gated on independent verification. 22 of 33 runs produced a system that survived that gate, and 13 of those went on to beat the strongest baseline in the comparison set. The other 11 runs produced numbers attached to execution paths nobody had checked.

Two out of three sounds like a passing grade for autonomous systems engineering. It also means a third of the time you get a confident, well-formatted answer that does not hold up.

What ServerBench actually measures ​

Serving is a coordination problem, not a tuning problem. Batch size, KV cache budget, prefix reuse, admission control, and replica count all push on each other. Crank the batch size and throughput climbs while p99 goes sideways. Cache more prefixes and you help the chat workload while starving the bursty one.

Stateful replay is the part that makes the benchmark honest. Sessions are replayed with their dependencies intact, so an agent can't score well by treating every request as independent. Multi-turn behavior, cache reuse across turns, and arrival patterns all stay inside the measurement.

The verification step is the design decision I'd copy first. Agents that optimize a serving path introduce new execution paths in the process: a fallback, a fast path for cached prefixes, a shed-load branch. Those paths are where the wins come from and where the bugs hide. Checking them after the fact is cheaper than trying to prevent them during generation, and far cheaper than discovering them in production.

Three behaviors separate the winning runs ​

The analysis lands on three patterns. High-scoring designs change capacity and load selection together. An agent that raises the batch ceiling without touching which requests get shed has moved the latency problem, not solved it. The runs that scored well paired the two: bigger batches for traffic that tolerates them, earlier shedding for traffic that doesn't.

Good runs also read performance feedback through workload-relevant experiments. When the score dropped, they re-ran a slice of the real workload instead of a synthetic microbenchmark. That sounds obvious. It's also the first thing an agent skips when a result already looks good enough.

And reliable delivery needs verification of the execution paths the optimization introduced. Not the paths the agent tested. The ones it created.

Quick take: agents are competent enough to design serving systems that beat a strong baseline, and the difference between the runs that count and the runs that don't is verification, not cleverness.

Context is a security control, and nobody tuned it that way ​

The second paper covers a different part of the same pipeline, and it's the part that bites you in production.

Every coding assistant or agent builds a repository context before it writes code. For security-sensitive changes, that context decides what the model imitates. If retrieval surfaces the project's authorization helper, the generated handler calls it. If retrieval surfaces a legacy handler that checked roles inline, or a test fixture with a stubbed auth layer, the generated handler does that instead.

A.S.E 2.0 built CASE-Bench to measure the difference. It has 145 repository-level tasks drawn from real CVEs across 51 projects. Each task runs in Docker with functional tests and a proof-of-concept exploit validated in both directions: the exploit must fire on the vulnerable code and stay quiet on the fix. Each task is annotated with the repository code that enforces or undermines its security.

The comparison covered 13 context construction methods, six controls, and six LLMs. The authors also edited single context elements and read through coding-agent trajectories.

ServerBenchCASE-Bench
What it gradesa complete serving systema repository-level patch
Unit of workone deployment per run, 33 runs145 CVE-derived tasks in 51 projects
Success signaldollars per dollar, gated on verificationfunctional tests plus a bidirectional exploit
Scale tested11 agent models, three deployments13 context methods, six controls, six LLMs
Headline result2.97 dollars per dollar, 4.87x the vLLM reference+8.2 pp functional, +3.7 pp secure
Failure it exposesoptimization paths nobody verifiedcontext that hides the safeguard

The 8.2 versus 3.7 gap is the whole story ​

Functionality-oriented context, the kind every retrieval pipeline is tuned to produce, raises the functional pass rate by up to 8.2 percentage points. It raises the secure pass rate by at most 3.7.

Read those as two independent numbers and you'd conclude retrieval is mildly useful for security. Read the asymmetry and you get something sharper. Withholding a safeguard from context lowers the secure pass rate by up to 8.1 pp. Missing guardrails hurt more than present guardrails help. Your retriever's failures cost roughly twice what its successes buy.

Then there's the insecure exemplar. One inserted insecure example raises correct-but-exploitable code by 6.3 pp. That's the outcome that matters in production. The patch compiles, the suite goes green, the review is quick because the diff looks idiomatic, and the endpoint ships without a permission check.

One caveat on the pp figures. 145 tasks means a single task is worth about 0.7 pp, so 3.7 pp is roughly five tasks flipping. The direction holds across methods and models, which is what makes it credible. The exact magnitude deserves a raised eyebrow.

Agents mostly don't look at the guardrail ​

The trajectory analysis is the finding I keep coming back to. Coding agents observed the relevant safeguard in 27 to 36 percent of trajectories. In something like two-thirds to three-quarters of runs, the agent never saw the file that enforces the check, even when it was reachable.

That reframes the problem. You can put the guardrail in your index and still lose. Retrieval ranks by similarity to the change, and an authorization helper's similarity to a new endpoint handler is often lower than five other endpoint handlers that are also plausible neighbors, some of which skip the check.

So the fix isn't a better embedding model. It's making the safeguard a required part of context rather than a retrieved one.

The two benchmarks in one breath. ServerBench: 2.97 dollars per dollar, 4.87x the vLLM reference, 22 of 33 runs verified. CASE-Bench: 145 CVE-derived tasks, +8.2 pp functional against +3.7 pp secure from functionality-oriented retrieval, safeguards observed in 27 to 36 percent of agent trajectories.

What I ran into with repo-wide context ​

I pointed an agent at a service with an in-house permission helper and let default retrieval do its thing. The generated handler looked like the rest of the codebase and passed the functional suite. It also skipped the helper, because the three nearest neighbors were all older handlers written before the helper existed. A reviewer caught it in about ninety seconds, which is not a control you can lean on at volume.

Forcing the helper file into context by path fixed that failure and introduced a new one: patches started calling the helper for read-only public endpoints that didn't need it. More context wasn't better. The right context was. And the agent had to be told which file mattered, not left to find it.

The same shape showed up on the serving side. An agent I set loose on a synthetic throughput target cranked the batch size, posted a nice number, and fell over the moment I replayed real multi-turn sessions through it. It had optimized a path it never exercised. That is exactly the failure ServerBench gates against, and exactly what my own eval was missing.

Common pitfalls ​

The first mistake is treating retrieval as a security control. Similarity search finds code that looks like your target, not code that guards it. If the nearest neighbor to the endpoint you're writing is a handler that skipped the role check in 2021, you've handed the model an insecure exemplar, and the paper prices that at 6.3 pp more correct-but-exploitable code.

The second is using a green test suite as the gate. Functional context buys up to 8.2 pp on function and at most 3.7 pp on security, which tells you the suite is measuring something else. Add the exploit check in both directions: it has to fire on the vulnerable revision and stay quiet on the fixed one. A one-directional check passes on code that's broken in a way you didn't anticipate.

The third is assuming the agent read the guardrail. It observed the relevant safeguard in 27 to 36 percent of trajectories. Pass the file by path, and hard-fail the run when the recorded context omits it. A prompt that says "follow existing auth patterns" is not that.

The fourth is scoring a generated serving system on throughput or dollars per dollar without verifying the paths the agent added. Any unverified fast path is a place where the number can be right and the system can be wrong. ServerBench gates the score for a reason, and an internal eval that doesn't gate it will reward agents for finding the untested branch.

The fifth is tuning one knob. Capacity and load selection are coupled. Raising the batch ceiling without changing admission control doesn't improve the system, it relocates the tail latency. If your agent changed one and not the other, the improvement is probably an artifact of the workload you tested on.

Sources ​

One thing to remember ​

A retrieval pipeline tuned for green tests will hand your agent the insecure version of the code it's about to write, and the diff will look completely normal.

What this means for your team ​

If you're building a coding agent against a repo with a real authorization model, wire the safeguard files in by path and fail the run when they're absent. Similarity-based retrieval tops out at 3.7 pp of secure gain while a withheld safeguard costs 8.1 pp, so the success mode is cheap and the failure mode isn't.

If you're evaluating serving-system agents, gate the score on verification of new execution paths before you compare dollars per dollar. Two-thirds of ServerBench runs delivered something verified; the rest produced numbers describing a system nobody checked.

If you ship generated code to production this quarter, add the bidirectional exploit test to CI before you add another retrieval tweak. One insecure exemplar in context moves correct-but-exploitable code by 6.3 pp, and your functional suite will not notice.