Gemma security agents fix more vulnerabilities with auto-built harnesses, not retraining
A NIST and Grenoble preprint lets a strong model rewrite the instructions, tools and controls around a weaker one. On SEC-bench, Gemma-4-31B went from fixing under half of real vulnerabilities to more than three quarters, with no change to its weights.
scienceunderway.com/articles/gemma-security-agents-fix-more-vulnerabilities-with-auto-built-harnesses-not-ret


What the study shows
An AI agent is a language model wrapped in a harness. The harness is everything around the model: its instructions, the tools it can call, memory notes and rules such as step limits. Harnesses are usually written by hand for one model and may work worse with another.
The authors, from the US National Institute of Standards and Technology (NIST) and Université Grenoble Alpes, propose a loop they call Reinforcement Building. A target model tries to patch training vulnerabilities. A program checks each patch by building the project and replaying the crashing input. A stronger optimiser model, Claude Opus 5.5 in the main runs, reads every attempt and proposes edits to the harness. An edit is kept only if it improves results on a separate set of held-out tasks by a statistical test.
They tested it on two open-weight models, Gemma-4-31B and the much smaller Gemma-4-E4B. The main benchmark was SEC-bench, 200 real vulnerabilities with public CVE identifiers. With a single attempt per bug, the built harness lifted Gemma-4-31B from about 46% to about 78% fixed. The best rival harness builder, ContraFix, reached about 64%. Reinforcement learning with verifiable rewards (RLVR), which retrains the model on pass or fail scores, reached about 58%.
The small model gained most. It went from fixing about 5% of SEC-bench bugs to about 41%. RLVR made no significant gain for it, because the model almost never succeeded, so the pass or fail score gave it almost nothing to learn from.
The authors report that the method learns quickly. On Gemma-4-31B it reached its best score after 190 practice runs, while RLVR needed about seven times as many. For the Gemma-4-31B build, the optimiser worked for 85 minutes, at about $22 in API fees.
Each model got a different harness, fitted to its own weakness. Gemma-4-31B often got stuck re-reading the same code, so its harness gained a loop guard and a rule to write a hypothesis before each command. Gemma-4-E4B gave up before testing its patch, so its harness gained a one-step rebuild-and-test tool and a rule not to finish until the test passes. A harness built for one model sometimes made another model worse.

Our reading
In our reading, the central point is about where improvement comes from. A failed attempt holds a lot of information: where the agent looped, which edit broke the build, when it quit. Retraining on a pass or fail score throws all of that away. Letting a capable model read the record and change the setup uses it. That explains why the small model improved here when retraining did nothing.
The result also suggests that a poor benchmark score can understate a model. Gemma-4-E4B looked nearly useless at about 5%. Much of that turned out to be bad habits that a better harness could correct. For teams that want small models running on their own hardware, that matters.
The evidence is strongest on SEC-bench. On the two harder benchmarks, with 41 and 53 tasks, the method still beat the plain setup, but it was not clearly better than the rivals. This is a preprint and has not been peer reviewed. We rate it Readiness level III, open source available: the authors say they release code, harnesses and results, at an anonymous review link.

The rest of this story is for members. Membership is free: read it at scienceunderway.com/articles/gemma-security-agents-fix-more-vulnerabilities-with-auto-built-harnesses-not-ret
Read the rest of this story
Membership is free. You get every article in full, and can save stories and follow topics.
We send a sign-in link, no password needed. Already a member? Sign inReadiness assessment
| Level | Status | Evidence |
|---|---|---|
| I Lab only | Met | The method is described and tested in isolated containers on public vulnerabilities. |
| II Benchmarked | Met | Results are reported on public benchmarks against EvoRepair, ContraFix, RLVR and WSP. These are SEC-bench (200 CVEs), CyberGym-E2E (41 tasks) and PatchBench (53 tasks). |
| III Open source | Met | The paper says the code, built harnesses, build ledgers and graded results are released at an anonymous 4open.science link. It is not yet clear whether this is a permanent public repository. |
| IV In production | Not yet | No documented use by a named organisation in production. |
What would move it up
Documented use by a named security team or open-source project, fixing real vulnerabilities with RB-built harnesses, would move it up. Patches accepted by maintainers would be strong evidence.
The study
Amine Lbath, Aurelien Delaitre, Vadim Okun et al.. Reinforcement Building: Toward Self-Improving Harnesses for Defensive Software Security Agents. arXiv, 26 November 2026. Read the paper
Notes
- Lbath, Delaitre, Okun and Amini, 'Reinforcement Building: Toward Self-Improving Harnesses for Defensive Software Security Agents', arXiv preprint, November 2026. Source
- Code, built harnesses, build ledgers and graded results, as linked in the paper (anonymous review mirror). Source
- Exact SEC-bench figures: Gemma-4-31B base 45.5%, RB 77.7%, ContraFix 64.3%, EvoRepair 50.5%, RLVR 57.5%, WSP 59.8%. Gemma-4-E4B base 4.8%, RB 40.8%, ContraFix 33.5%, RLVR 4.5%.
- Efficiency: RB reached 77.7% after 190 training episodes; RLVR needed 1,408 (7.4 times). Gemma-4-31B build: 13 optimiser calls, 85 minutes, about $22. Gemma-4-E4B build: 12 calls, 98 minutes, about $27.
- Readiness: level III, open source available. Public benchmark results (II) and released code (III) are reported; no documented production use (IV).
Edited and signed by
Stefan PerdalFounder. Twenty-five years of building digital products.194 stories editedStefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.
How this was made
An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.
How we workNo corrections


