Skip to main content
Curtail
Air Force Research Laboratory

The appearance of the AFRL mark does not constitute endorsement of Curtail or ReGrade by the Air Force Research Laboratory, the U.S. Air Force, or the Department of Defense.

AI-Generated Code Safety and Security

A 17-model, 6-provider evaluation, in collaboration with the Air Force Research Laboratory and cleared for public release. The figures on this page are the study as published and do not change as later testing continues.

In collaboration with AFRL · figures as published

Distribution (A) Approved for public release; distribution is unlimited; AFRL-2026-3793, AUG 2026

Curtail uses your address to send you the document and to keep a record of the request. We do not sell it or pass it on. Privacy policy.

More bugs fixed

ProviderModelControlTreatmentChange
AnthropicHaiku 4.51.3 / 1812.3 / 18+825%
AnthropicSonnet 4.65 / 1818 / 18+260%
AnthropicOpus 4.78.3 / 1818 / 18+117%
AnthropicOpus 4.67 / 1817.7 / 18+152%
OpenAIGPT-5.413.3 / 1817.7 / 18+33%
OpenAIGPT-5.513.3 / 1818 / 18+35%
GoogleGemini 3 Flash Preview9.7 / 1817.7 / 18+82%
GoogleGemini 3.1 Pro Preview8.7 / 1814.3 / 18+64%
xAIGrok 4.20 Reasoning3.7 / 1815.7 / 18+324%
xAIGrok 3 Fast2 / 188 / 18+300%
xAIGrok 3 Mini1 / 182.7 / 18+167%
AlibabaQwen3.6-Plus4 / 1816 / 18+300%
AlibabaQwen3.6-Max-Preview5.7 / 1812.8 / 18+125%
AlibabaQwen3-Coder-Plus2 / 1812 / 18+500%
AlibabaQwen3-Coder4 / 189 / 18+125%
DeepSeekDeepSeek V4 Pro5.3 / 1816.2 / 18+206%
DeepSeekDeepSeek V4 Flash3 / 187 / 18+133%

Improvement is computed from unrounded trial means, so dividing the rounded figures shown does not reproduce it exactly.

Cost reduction

ProviderModelControlTreatmentChange
AnthropicHaiku 4.5$0.377$0.058-85%
AnthropicSonnet 4.6$0.126$0.092-27%
AnthropicOpus 4.7$0.257$0.199-23%
AnthropicOpus 4.6$0.294$0.097-67%
OpenAIGPT-5.4$0.020$0.015-25%
OpenAIGPT-5.5$0.156$0.091-42%
GoogleGemini 3 Flash Preview$0.015$0.008-47%
GoogleGemini 3.1 Pro Preview$0.118$0.136+15%
xAIGrok 4.20 Reasoning$0.235$0.077-67%
xAIGrok 3 Fast$0.105$0.060-43%
xAIGrok 3 Mini$0.010$0.007-30%
AlibabaQwen3.6-Plus$0.060$0.024-60%
AlibabaQwen3.6-Max-Preview$0.333$0.036-89%
AlibabaQwen3-Coder-Plus$0.070$0.032-54%
AlibabaQwen3-Coder$0.015$0.026+73%
DeepSeekDeepSeek V4 Pro$0.011$0.017+55%
DeepSeekDeepSeek V4 Flash$0.007$0.004-41%

Dollars per bug fixed, at each provider’s list price: what the trials cost, divided by the bugs the agent eliminated. Cost per trial is a different metric and moves differently.

AI-Generated Code Safety and Security — Research Summary

Companion summary for the full paper “AI-Generated Code Safety and Security — Network Comparison Application Security Testing (NCAST): A 17-Model, 6-Provider Evaluation.” See the full paper for methodology and detailed results.

TL;DR

Curtail tested NCAST, a behavioral-diff method that compares HTTP traffic between two versions of a service, as a signal fed to AI coding agents fixing bugs in existing Python HTTP service code. Across 17 models from 6 providers, giving an agent this signal raised the average number of bugs it fixed and, for most models, lowered the dollar cost per bug fixed. The two tables at the top of this page report both effects model by model, transcribed from the same dataset published on curtail.com.

What we tested

  • Models: 17 from 6 providers: Anthropic (Haiku 4.5, Sonnet 4.6, Opus 4.7, Opus 4.6), OpenAI (GPT-5.4, GPT-5.5), Google (Gemini 3 Flash Preview, Gemini 3.1 Pro Preview), xAI (Grok 3 Mini, Grok 3 Fast, Grok 4.20 Reasoning), Alibaba (Qwen3.6-Plus, Qwen3.6-Max-Preview, Qwen3-Coder-Plus, Qwen3-Coder), DeepSeek (V4 Pro, V4 Flash).
  • Codebases: BaxBench (a small synthetic Flask service), DriftBench (a 300,000-line padded codebase with 21 planted bugs), Ghost CMS, and NetBox (a 291,000-line production system).
  • Setup: an AI coding agent was given shell access to each codebase and asked to fix planted bugs, once without NCAST’s diff signal (control) and once with it (treatment). The reference version of the code was withheld from the agent in both arms, so it had to find the bugs rather than compare against a known-good copy.

More bugs fixed

Every one of the 17 models fixed more bugs with NCAST than without it. The size of the effect varies a great deal: budget-tier models like Grok 3 Mini start from a low base and gain a few bugs, while a model like Haiku 4.5 goes from fixing about one bug in 18 to fixing most of them.

Cost reduction

Cost is the dollar cost of API tokens spent per bug fixed, at each provider’s list price: what the trials cost, divided by the bugs the agent actually eliminated. Fourteen of the 17 models cost less per bug fixed with NCAST, from -23% (Opus 4.7) to -89% (Qwen3.6-Max-Preview). The other three (Gemini 3.1 Pro Preview, Qwen3-Coder, DeepSeek V4 Pro) are low-baseline cells: their control cost per bug is already trivially small, $0.011 to $0.118, so any treatment overhead inflates the ratio even though the absolute dollars stay in the cents. Cost per trial is a different metric and moves differently. On Anthropic-billed trials it is higher with NCAST, because the delta text sits in cached context across every turn of the agent loop, and the full paper reports that separately.

What the numbers mean

NCAST’s diff signal, marketed as Curtail’s ReGrade product, tells an agent which parts of a service’s behavior changed between versions. That signal helped every model in this study fix more bugs, and it lowered the cost per bug fixed for most of them. The two effects do not always move together: a model can fix more bugs while spending more money doing it, and a handful of individual bugs go the other way, where a model does worse with the signal than without it. Those exceptions cluster in a small number of models rather than spreading evenly across the lineup; the full paper breaks them out model by model.

Methodology in brief

Each model was run in agent mode, with shell access to the target codebase and no reference copy of the fixed version. Each (model, benchmark) combination was run 3 times unless otherwise noted in the full paper, and results are reported as the trial mean out of 18 possible bugs. Evaluation ran from April to May 2026. The tables above use the same headline configuration the full paper reports as its primary result: the reference version withheld, so the agent has to find bugs rather than diff against a known answer.

Read the full paper

  • Full paper: 81 pages, 16 tables, 3 figures. Available as a PDF download from the AFRL study page on curtail.com, alongside this summary.
  • Supplementary data: the analysis scripts and per-trial data behind the paper. Available on request.
  • DriftBench public release: https://github.com/Curtail-Inc/DriftBench

Scope

This summary covers 17 models across 6 providers, evaluated in agent mode with 3 trials per cell unless otherwise noted, from April to May 2026. Results pertain to AI-generated Python HTTP service code. We make no claim about other languages, other kinds of software (frontend, mobile, embedded, data pipelines), or bug types beyond the HTTP behavioral regressions tested here.

Source: AI-Generated Code Safety and Security, Tables 7.1, 7.5 and 7.6. Distribution (A) Approved for public release; distribution is unlimited; AFRL-2026-3793, AUG 2026