Skip to content

AI-Generated Code Quality Metrics and Statistics for 2026

Matt Li By Matt Li 12 min read
TL;DR: About 44% of AI code generation tasks produced a known security flaw in Veracode's July 2026 tests, almost the same rate as its first report in 2025. CodeRabbit found 1.7 times as many issues in AI co-authored pull requests as in human-only ones. Benchmarks look far better, with Claude Opus 5 resolving 96.0% of SWE-bench Verified.

Frontier models now write code that compiles almost 100% of the time. In Veracode’s Summer 2026 tests, the same models produced secure code on only 12% of log injection tasks and 15% of cross-site scripting tasks. GitClear, reading 623 million code changes, counted 81% more duplicated code blocks than before AI coding tools took hold.

Key takeaways
  1. 1OpenAI stopped reporting SWE-bench Verified in February 2026 after finding flawed tests in 59.4% of the hard problems it audited.
  2. 2Only 48% of developers in Sonar’s 2026 survey always check AI-assisted code before they commit it.
  3. 3In METR’s early 2025 trial, experienced developers took 19% longer with AI and still believed it had sped them up.
  4. 4Java is the weak spot: models passed only 29% of Veracode’s Java security tasks in its Spring 2026 update.

How Often Does AI-Generated Code Contain Security Flaws?

Close to half the time, and the rate is not falling. Veracode’s 2026 GenAI Code Security Report gave 11 new models 80 coding tasks and found an average security pass rate of 56%. Its first report, in July 2025, measured 55% across more than 100 models.

68%
GPT-5.5, the best security pass rate in the Summer 2026 set
51%
Average for models built for coding, against 52% for general models
56% vs 51%
Reasoning models against non-reasoning models
53%
Large models, against 51% for medium and small ones
Source: Veracode 2026 GenAI Code Security Report, July 2026.

Six of the 11 models landed between 50% and 53%. Even GPT-5.5 fails almost one security task in three, and models built for coding produce no more secure code than general chat models.

How the test works. Each task asks a model to finish a function in Java, JavaScript, C# or Python, where both a secure and an insecure version would work. The prompt carries no security hints. Veracode then scans the output with its own static analysis tool for four weakness types.

Which flaws do models miss?

The gap between weakness types is wider than the gap between models. SQL injection and weak cryptography follow repeatable patterns, and models got them right 83% and 87% of the time. Cross-site scripting and log injection depend on how user input moves through an app, and pass rates collapse.

Security pass rate of AI generated code by weakness type in the Veracode 2026 GenAI Code Security Report, across 11 models and 80 tasks: weak cryptography 87 percent, SQL injection 83 percent, cross-site scripting 15 percent and log injection 12 percent.

The defences are well documented. OWASP’s cross-site scripting prevention cheat sheet sets out the output encoding rules, and cybersecurity resources such as VPNpro publish guides on wider online security. Veracode’s prompts did not ask for either, so the scores show what a model does by default.

Java is still the weakest language

Models passed 29% of Java tasks in the Spring 2026 update, against 57% to 62% for the other three languages. Veracode suspects the training data: public Java repositories hold millions of lines written before modern security frameworks existed.

Veracode security pass rate of AI generated code by language, July 2025 report compared with the Spring 2026 update: Python 61.7 to 62 percent, JavaScript 57.3 to 57 percent, C sharp 55.3 to 58 percent and Java 28.5 to 29 percent.

The summer report put Java at 30% and called it the most improved language, still last by a wide margin. Python, JavaScript and C# have each moved by three points or less since the July 2025 report.

Academic studies found the same pattern

The problem predates today’s models. In 2021, researchers prompted GitHub Copilot with 89 security-sensitive scenarios and found about 40% of the 1,689 programs vulnerable.

Code already sitting in public projects looks similar. A study of 733 AI-generated snippets on GitHub found security weaknesses in 29.5% of the Python snippets and 24.2% of the JavaScript ones, across 43 weakness types. Feeding the scanner warnings back to Copilot Chat fixed up to 55.5% of them.

Agents working across whole repositories do no better. In the SusVibes benchmark of 186 real feature requests, 57% of the solutions from SWE-Agent with Claude 4 Sonnet worked, but only 11.8% were secure. Adding vulnerability hints to the request did not close the gap. Our AI tool security vulnerability statistics go wider than code generation.

Does AI-Generated Code Have More Bugs Than Human Code?

In open-source pull requests, yes. CodeRabbit’s December 2025 report counted 10.83 issues per AI co-authored pull request against 6.45 for human-only ones, across 470 PRs on GitHub.

Readability issues more than 3xSecurity issues up to 2.74xFormatting 2.66xError handling gaps almost 2xLogic errors 75% moreExcessive I/O about 8x

Readability was the biggest gap. The report says AI code often looks consistent but breaks the local rules for naming and structure. The security findings clustered around improper password handling and insecure object references. No vulnerability type showed up only in AI code; almost all of them were more common there.

The method has a limit CodeRabbit states itself. It labelled a PR as AI co-authored only when the PR carried a signal saying so and treated the rest as human-written, so some “human” PRs may contain AI code. CodeRabbit also sells AI code review. Our list of AI code review tools compares it with the alternatives.

Is AI Making Codebases Harder to Maintain?

Commit data says it is. The Maintainability Gap, a 2026 study by GitClear and GitKraken, read 623 million code changes from 2023 to 2026. About a quarter of commits now show AI assistance, and eight maintainability signals moved the wrong way, LeadDev reported.

Change in code signals in 2026 against the pre-AI baseline, from GitClear and GitKraken's Maintainability Gap study of 623 million code changes as reported by LeadDev: duplicated code blocks up 81 percent, error masking code up 47 percent, cross-file function calls down 35 percent, moved or refactored code down 70 percent and updates to code older than a year down 74 percent.

A duplicated block is any run of five or more repeated meaningful lines. Moved code, GitClear’s measure of refactoring, fell 70%. Changes to code last touched more than a year ago fell 74%, so older code sits untouched while new code piles up beside it.

“Every time you want something, AI creates a new package for it.”

Bill Harding, GitClear CEO, to LeadDev, 2026

Error masking rose 47%. GitClear counts catch blocks, safe-navigation operators and stubbed methods that swallow unexpected input. Harding says maintainers are left to work out which error handling had a real cause and which was added for AI expediency. These figures track code written as AI use grew; they are not a controlled comparison.

Developers report the same debt

In Sonar’s State of Code survey of more than 1,100 developers, published in January 2026, 88% cited negative effects of AI on technical debt, while 93% also saw positive ones such as better documentation. The top complaints were code that looks correct but is not reliable (53%) and code that is unnecessary or duplicated (40%).

The same developers put AI at 42% of their committed code and expect 65% by 2027. Our breakdown of how much code is written by AI sets that figure against other counts.

What Happens to Delivery Stability When Teams Adopt AI?

Delivery gets less stable as AI use rises. Google’s 2025 DORA State of AI-assisted Software Development report, based on almost 5,000 technology professionals, found that AI adoption now lifts delivery throughput but is still linked to more instability.

DORA 2024 findings
  • 7.2% more delivery instability for every 25% rise in AI adoption
  • 1.5% less delivery throughput for the same rise
DORA 2025 findings
  • Throughput now rises with AI adoption
  • Instability still rises, with no sign that AI adoption softens its harm
Source: DORA, 2025 State of AI-assisted Software Development, which restates its 2024 estimates.

DORA tracks instability with two numbers. Change fail rate is the share of deployments that need a rollback or hotfix. Rework rate is the share of unplanned deployments caused by a production incident. The report checked whether AI adoption softens the harm instability does to product performance and burnout, and found no such effect.

Perception runs the other way. 59% of respondents said AI had improved their code quality, and only 10% saw any harm. 90% use AI at work, for a median of two hours on their latest workday. Our AI in software development statistics track that adoption in more detail.

Does AI Make Experienced Developers Faster?

In METR’s randomized trial, AI made them slower. The 2025 study gave 16 experienced open-source developers 246 real issues from their own repositories, each assigned at random to allow or bar AI. With AI allowed, tasks took 19% longer.

The developers had expected AI to speed them up by 24%. After the study they still believed it had sped them up by 20%.

METR randomized trial results for the change in task completion time when AI tools were allowed. Early 2025 study with 16 developers: 19 percent slower, confidence interval 2 to 39 percent slower. Late 2025 returning developers: 18 percent faster, interval from 38 percent faster to 9 percent slower. Late 2025 new developers: 4 percent faster, interval from 15 percent faster to 9 percent slower.

METR started a larger follow-up in August 2025 with 57 developers and more than 800 tasks. Its February 2026 update estimates an 18% speedup for returning developers and 4% for new ones, but both confidence intervals still include a slowdown.

METR calls the new data weak evidence. Between 30% and 50% of developers said they held back tasks they did not want to do without AI, and some refused to join at all. Pay also fell from $150 to $50 an hour. METR thinks these effects hide the biggest gains, so the real speedup may be higher.

How Much Do Developers Trust AI-Generated Code?

Less than they use it. In the 2025 Stack Overflow Developer Survey, 84% of respondents used or planned to use AI tools, yet 46% distrusted the accuracy of the output and 33% trusted it. Only 3% said they highly trust it. Developers with 10+ years of experience were the most wary, at 2.6% highly trusting and 20% highly distrusting.

Almost right, but not quite66%
Debugging AI code takes longer45.2%
Less confident in my own problem-solving20%
Hard to see how or why the code works16.3%
Frustrations with AI tools, share of 31,476 respondents, more than one answer allowed. Source: Stack Overflow Developer Survey 2025.

Distrust is also the top reason to ask a person: 75% said they would still go to a human for help when they do not trust an AI answer. DORA found a similar split: 30% of its respondents have little or no trust in AI-generated code.

Checking lags behind the doubt. In Sonar’s survey, 96% do not fully trust that AI code works as intended, yet only 48% always check it before committing. 38% say reviewing AI code takes more effort than reviewing a colleague’s. Our AI coding assistant statistics cover the tools those developers use.

What Do Coding Benchmarks Say About AI Code in 2026?

They say the models are close to perfect, which is the problem. Anthropic’s Claude Opus 5 system card reports 96.0% on SWE-bench Verified, the 500 human-checked GitHub issues that became the standard coding score in model launches. On harder tests built to resist leakage, the same model scores far lower.

Claude Opus 5 scores from Anthropic's July 2026 system card, averaged over five trials: SWE-bench Verified 96.0 percent, SWE-bench Multilingual 89.5 percent, SWE-bench Pro 79.2 percent, DeepSWE v1.1 68.8 percent and SWE-bench Multimodal 59.4 percent.

OpenAI, which helped build SWE-bench Verified, stopped reporting it on February 23, 2026. Its audit of 138 problems that o3 failed at least once in 64 runs found material flaws in 59.4%. Most were tests that reject correct fixes or check for features the issue never asked for.

Contamination was the second finding. All the frontier models OpenAI probed could reproduce the original fix or task wording for some problems from memory. DeepSWE’s authors wrote its 113 tasks from scratch to avoid that, and Opus 5 averages 68.8% there.

SWE-bench Pro, drawn from maintained repositories with larger multi-file changes, is the score OpenAI now recommends, and all three big vendors report it. OpenAI’s GPT-5.6 launch table and Google DeepMind’s Gemini 3.1 Pro page carry their own figures:

Claude Opus 5Jul 2026
79.2%
SWE-bench Pro, average of five trials, per Anthropic
GPT-5.6 SolJul 2026
64.6%
SWE-bench Pro, per OpenAI’s launch table
Gemini 3.1 ProFeb 2026
54.2%
SWE-bench Pro (Public), single attempt, per Google DeepMind
Each vendor runs its own harness, so small gaps between cards are not a clean ranking. Sources: Anthropic, OpenAI and Google DeepMind model pages.

None of these benchmarks scores security or maintainability. A SWE-bench patch passes when the repository’s tests pass, and Veracode’s results show that working code can still carry a known flaw.

What Does an AI Coding Failure Look Like in Production?

The best-documented case is SaaStr founder Jason Lemkin’s July 2025 experiment with Replit’s coding agent. During a declared code and action freeze, the agent wiped a live database holding data on more than 1,200 executives and more than 1,190 companies, Fortune reported. It then told him a rollback would not work.

Jul 12, 2025
Lemkin blogs about building a prototype on Replit in a few hours.
Mid-Jul 2025
The agent fakes data and reports, lies about a unit test, then deletes the production database during the freeze.
Jul 19, 2025
The rollback works, after the agent had said it was impossible.
Jul 20, 2025
The agent breaks a new code freeze seconds after Lemkin posts that freezes cannot be enforced.
By Jul 23, 2025
Replit CEO Amjad Masad calls the deletion unacceptable and rolls out separate development and production databases.
Sources: The Register, July 21, 2025; Fortune, July 23, 2025.

Lemkin had also caught the agent building a 4,000-record database of fictional people, The Register reported. Masad also promised better rollback and was building a planning-only mode, so users can plan with the agent without risking live code. Our vibe coding statistics cover how many professional developers build this way.

Hiring Engineers Who Can Review AI Code

Sonar calls it a verification bottleneck: AI writes code faster than teams can check it. Second Talent matches companies with pre-vetted engineers in Asia, including back-end developers for teams that need more review capacity on the code their AI tools produce.

Tell us what you are building and we will send matching profiles.

Frequently Asked Questions

Is AI-generated code less secure than human-written code?

The largest security test has no human baseline: Veracode measures how often models avoid known flaws, and they manage it a little over half the time. The closest direct comparison is CodeRabbit’s pull request study, which found up to 2.74 times more security issues in AI co-authored code.

Which AI model writes the most secure code?

GPT-5.5 led Veracode’s Summer 2026 snapshot with a 68% security pass rate. Model size made little difference: large models averaged 53% and smaller ones 51%.

What should teams measure to track AI code quality?

Four numbers come out of the research above: the security scan pass rate on new code, duplicated code blocks, change fail rate and rework rate. The first is what Veracode tests, the second is GitClear’s clearest signal, and the last two are DORA’s instability measures.

Is SWE-bench Verified still a useful score?

Not for comparing frontier models. OpenAI dropped it over flawed tests and training data leakage and recommends SWE-bench Pro, which it found far less contaminated. Anthropic still reports Verified alongside Pro and DeepSWE.

Hire AI-native talent.

Second Talent connects companies with pre-vetted AI Talent.

Hire talent Apply as talent →
Matt Li

Written by

Matt Li is a tech-driven entrepreneur with deep expertise in global talent strategy, digital experience optimization, e-commerce, and Web3 innovation. He is the Co-Founder of Second Talent, a US-based company that connects businesses with top-tier tech professionals worldwide. Since launching the company in 2024, Matt has led its growth by leveraging technology to streamline remote hiring and scale distributed teams. With a background spanning product, operations, and innovation, Matt brings a cross-disciplinary perspective to the evolving digital economy. His work sits at the intersection of global talent, emerging technology, and scalable digital transformation.

More posts by Matt Li →
WhatsApp