AI Trust Index

The security benchmark for AI-generated code.

How leading AI models perform across 11 languages frameworks, and how much curated security rules reduce measured risk score

Guidance

Baseline
+ Best rules

14 models · Updated Oct 2026

Which AI model writes the most secure code?

Every model runs in the same agent harness, with the same spec and prompt, across 11 frameworks and 10 runs each. The ranking is the baseline score: the model on its own, averaged across all frameworks. Lower measured risk is safer. Switch to + best rules to see how much each model improves from its own baseline.

How security rules shift the whole field

Distribution of measured risk across all models and frameworks: the baseline, and the same models with their best performing security rule per framework. The further left a curve sits, the safer the code that setting produces across the board.

View data table
Chart
Table

Leaderboard

SCW AI Trust Index scores run from 0 to 100. A score of 100 means fewest vulnerabilities of all models tested in that context; 0 means most. Scores are normalized relative to all models in the current dataset and are not an absolute measure of security. Rankings reflect the full 32-model dataset. As new models are released and evaluated, we recalculate the scores for all models, so results here are always current. Click a model name to explore.

Security guidance in context

BaselineNo security guidance
+ Best rulesSecure-coding rules in context

Measured average risk score over time

Baseline measured average risk score of every model by release date. Lines join versions of the same model. Click a model to explore it.

View data table
Chart
Table

AI-generated code vs human-written code

Confirmed vulnerabilities per 1,000 lines of code under the selected guidance setting, against two figures from Stanford research: human-only commits (0.08) and unreviewed AI-assisted code (0.76).

View data table
Chart
Table

Trust Index vs cost per run

Each circle is a model under the selected guidance setting. Higher is better security. Its size is the model’s functional correctness (share of runs that passed the functional checks).

View data table
Chart
Table

OWASP vulnerability fingerprints

Where each model’s confirmed vulnerabilities concentrate across OWASP categories, compared with the average model. Baseline runs.

Chart
Table

Explore by framework

Pick a framework to see how every model performs in it.

Security guidance in context

Baseline

No security guidance

+ Best rules

Secure-coding rules in context

Risk score and vulnerabilities, all frameworks

Mean measured risk, total vulnerability count and unique CWE types across all models, under the selected guidance setting.

View data table
Chart
Table

Average cost by framework

Average API cost per run across all models, under the selected guidance setting. With + Best rules, each framework uses the cost of the rule set that gave it the lowest risk. Cheapest first.

View data table
Chart
Table

Vulnerability analysis

Unique CWEs identified across every generated codebase.

OWASP Top 10 distribution

True positives are confirmed vulnerabilities in the framework’s primary language. Average risk combines severity, spread and detection.

Chart
Table

Top 10 CWEs by volume

Chart
Table

What security guidance changes

Fixed
OS command injection (CWE-78)

OS command injection (CWE-78)

Tagline

Fell 50–79% with security rules in context.

Missed
Sensitive data in log files (CWE-532)

Sensitive data in log files (CWE-532)

Tagline

Only fell 10–30% with security rules in context.

Made worse
Unchecked exceptions (CWE-703)

Unchecked exceptions (CWE-703)

Tagline

Rose 3–25% with security rules in context.

How the AI Trust Index is measured

Every model gets the same app spec, the same agent harness (Pi), the same scanners and the same scoring.

How we test

Generate

Each model builds the ExpenseForge spec 10 times in each of 11 frameworks, inside Pi, a non-opinionated agent harness with file-system tools. One shared system prompt. No planning or supervising agents. The generated code is then checked against the functional spec. If it meets less than 90% of it, the model gets up to 5 more attempts to reach 90%.

Scan

Each codebase is scanned with Semgrep, Bearer and Bandit (Python). Only findings in the framework’s primary language are scored.

Verify

An AI verifier agent classifies each finding as a true or false positive in code context. Only confirmed findings are scored.

Score

Confirmed findings become a CWE-level risk score per framework. The baseline run gives the ranking; each security-rules run is compared with the same model’s baseline.

Baseline and security rules

The baseline is each model running in the agent harness with no security guidance at all. It is the main comparison on this page and the only run every model gets, so it is what the ranking is built on.

A subset of models is also run with secure-coding rules placed in the agent’s context. Each of those runs is compared with the same model’s baseline, so the figure you see is that model’s own improvement, not a comparison between models. Where a model was run with more than one set of rules, the index shows its best result, labelled + best rules. We ran enough models this way to measure how much security rules help on average; we no longer run every new model with rules.

Where a model has only a baseline run, the rules views say so rather than guessing.

How scores are built

Risk score

Each CWE a model introduces in a framework gets a risk score: R = V × I × L × Vol × C × 100.

Validation (V)

1 if at least one finding is confirmed as a true positive, otherwise 0.

Impact (I)

Potential impact if exploited, from the finding’s severity: Critical 1.0, High 0.8, Medium 0.6, Low 0.4.

Likelihood (L)

Share of runs with a confirmed finding.

Volume (Vol)

How far it spreads in the codebase: log10(files with a confirmed finding + 1), in the runs where it occurs.

Confidence (C)

Scanner agreement: 1 scanner 0.7, 2 scanners 0.85, 3 or more 1.0.

A model’s risk score in a framework is the sum across every CWE it introduced. It has no upper limit; lower is safer. Only confirmed findings in the framework’s primary language count.

Trust Index

A Trust Index (0–100) is computed via min-max normalization for each model within each framework, so higher is safer:

Trust Index =

The Overall Trust Index (0–100) for a model is computed by averaging the normalized Trust Indexes across all frameworks. These normalized scores will change as new models get added to the evaluation set, as they reflect the relative position of each model within the set.

There are two versions. The baseline Trust Index uses each model’s baseline risk scores. The best rules Trust Index uses the same calculation with the risk score of each model’s best performing security rule in each framework, scaled between the best and worst best rule scores, so it isn’t directly comparable to the baseline version. The leaderboard shows whichever matches the Baseline / + Best rules switch.

Functional correctness

The share of generated apps that pass the functional checks for the spec. It sits beside the risk score so a model that writes safe code by writing less of it doesn’t win by default.

Vulnerability density

Confirmed vulnerabilities per 1,000 lines of generated code, from the baseline run. It lets AI-generated code be compared with published figures for human-written code: research from Stanford University found that human-only commits introduced roughly 0.08 vulnerabilities per 1,000 lines (Baumann et al., “SWE-chat,” arXiv preprint, April 2026). Methodologies differ, and the figures aren’t directly comparable.

What changed from the July 2026 study

The July 2026 study measured models called directly through their APIs. Those results are not comparable with the current index and are no longer shown.

July 2026 study
Current index
What’s tested
The raw model, via API
The model inside an agent harness (Pi)
Orchestration
Planning and supervising agents run by one fixed model
None. Each model works alone in the harness.
Security guidance
Not tested
A subset of models also run with secure-coding rules in context, compared with their own baseline
Functional correctness
Not recorded
Recorded for every run and shown beside the risk score
Cadence
Point-in-time study, Jan–Jul 2026
Ongoing. New models tested soon after release.
Unchanged
ExpenseForge spec, 11 frameworks, 10 runs, 3 scanners, AI verification
Same

Scope and providers

API providers

Models are accessed through their own providers, Amazon Bedrock or OpenRouter.

Temporal scope

Ongoing. New models are added to the dataset as their runs complete, and every score carries its test date.

Retired models

Models their provider has sunset, deprecated or retired are labelled as such and stay in the index as a point in time. They are not re-run.

Limitations

  • One app spec (ExpenseForge): CRUD with auth, file upload and payments.
  • Three open-source scanners. Commercial SAST may find more. Dependencies aren’t scanned.
  • One harness (Pi). Vendor harnesses may produce different results.
  • Code quality beyond security (maintainability, scalability, performance, modularity) isn’t evaluated.
  • Security-rules runs cover a subset of models.
  • Results are observed, not statistically tested.
  • Models change. Every score is a point in time.
  • Scanner coverage varies by language: Python also gets Bandit, the others don’t.

Changelog

Jul 2026

July 2026 study published: 16 models, 1,760 codebases

17 Nov 2026

Current index launched on the agent-harness method, 32 models

The paper

“Measuring the Security Cost of AI-Generated Code: A Multi-Model, Multi-Framework Empirical Study”, Secure Code Warrior and RMIT University. Covers the July 2026 study.

Back to AI Trust Index

Switch model

GPT 6 Astra
OpenAI

O

GPT 6 Astra code security score

Pi agent harness
Tested Nov 2026

Security guidance in context

Baseline

No security guidance

+ Best rules

Secure-coding rules in context

Trust Index

97

Higher is safer

Functional correctness

91%

Vulnerabilities per 1,000 lines

0.24

Cost per run

$8.43

#1 of 14

Ranks first of 14 models on its baseline run, across 11 frameworks.

As of Oct 2026.

See the full ranking

Risk score and vulnerabilities by framework

Measured risk, total vulnerability count and unique CWE types for this model in each framework, lowest first.

View data table
Chart
Table

What security rules change, by framework

Each framework’s measured risk with the best rule set, compared with this model’s own baseline. Left of centre means the rules cut the risk.

View data table
Chart
Table

Measured risk vs cost per run, by framework

Each circle is a framework under the selected guidance setting; its size is this model’s functional correctness there. Bottom-left is best value: low risk, low cost.

View data table
Chart
Table

OWASP vulnerability fingerprints by framework

Where this model’s confirmed vulnerabilities concentrate in each framework, compared with every model tested in the same framework.

View data table
Chart
Table

Weaknesses it leaves most often

The CWEs with the most confirmed findings for this model across all frameworks.

Chart
Table

Explore other models

Back to the full index
Back to Frameworks

Switch framework

Java

Java - Spring

Web app
Tested Nov 2026

Security guidance in context

Baseline

No security guidance

+ Best rules

Secure-coding rules in context

Trust Index

97

Higher is safer

Unique CWE types

–

Average functional correctness

–

Average cost per run

–

#1 of 11

Ranks first of 11 frameworks on mean baseline risk, across 32 models.

As of Oct 2026.

See the full ranking

Measured risk by model

Measured risk per model for this framework under the selected guidance setting. Lower is safer. Click a model to explore it.

View data table
Chart
Table

Measured risk vs cost per run, by model

Each circle is a model in this framework under the selected guidance setting; its size is the model’s functional correctness here. Bottom-left is best value: low risk, low cost.

View data table
Chart
Table

OWASP vulnerability fingerprints in this framework

Where each model’s confirmed vulnerabilities concentrate in this framework, compared with every model tested in it. Baseline runs.

Chart
Table

Explore other frameworks

Back to the full index

Provider

All providers

#

Model

Lower is safer

Baseline risk

With best rules

vs baseline

Functional correctness

1

O

GPT 6 Astra

OpenAI, $8.43 per run, tested Oct 2026

13.9

3.1

−78%

91%

Showing 10 of 32 models

C

C - Basic

Baseline risk

12.8

With best rules

5.8 · −55%

Explore framework →

Risk score

#

CWE ID

Category

True positives

1

CWE-79

Cross-site scripting

1,771

#

Model

Baseline risk

2

O

GPT 6 Luna

Sunset

OpenAI

19.1

O

#1

GPT 6 Astra

OpenAI, $11.58 per run, tested Nov 2026

5.4

−75%

Baseline 21.2

Functional correctness 98%

From benchmark to better code

The AI Trust Index shows how AI models perform on security, and where each one falls short. The next step is acting on it. Steer your AI coding agents with guidance drawn from that research, so they write secure code the first time.

Book a demo
trust score
FAQ

AI code security, answered

What is AI software governance?

AI software governance is the ability to see, measure, control, and enforce how artificial intelligence is used in software development. It includes visibility into AI coding assistants and LLMs, commit-level risk analysis, policy enforcement, and preventing risky AI-generated code from reaching production.

Why is AI software governance important?

As organizations move from developers casually using AI chatbots to AI agents autonomously generating and modifying code, the risk surface expands dramatically. These tools can introduce vulnerabilities, insecure patterns, and compliance exposure at machine speed.

AI software governance enables organizations to adopt AI safely by making AI usage visible, enforcing policy controls, and preventing AI-introduced risk before code reaches production.

How is AI development governance different from DevSecOps?

DevSecOps integrates security testing into CI/CD pipelines to detect vulnerabilities. AI development governance goes further by making AI usage visible, correlating AI-assisted commits with developer skill, enforcing AI model policies at commit, and improving secure coding behavior. DevSecOps detects risk; AI governance prevents it.

How does Secure Code Warrior reduce AI software risk?

Securing AI-generated code requires visibility into AI tool usage, commit-level risk analysis, and governance oversight across development workflows. Secure Code Warrior provides AI observability, vulnerability correlation, and developer capability insights within a unified AI software governance platform.

How do you prove AI risk reduction to leadership or auditors?

Secure Code Warrior provides enterprise dashboards, AI model traceability, and governance reporting that demonstrate measurable reductions in introduced vulnerabilities, improved developer Trust Score®™ metrics, and policy compliance across teams.

The platform also maintains audit-ready traceability of who — or what — generated specific code, including developers, AI coding assistants, LLMs, and autonomous agents. This creates verifiable AI software supply chain accountability for leadership, regulators, and auditors.

Still have questions?

Contact us and our team will be happy to help.

Contact