All research

· KodeGauge Research

Can an open-weight model fix code as well as a frontier model?

A KodeGauge benchmark of Claude Sonnet 4.6 and Qwen3.8 27B on 23 code-fixing tasks. Both models' fixes passed every test 96–100% of the time, and every fix KodeGauge labelled "verified" was correct.

Benchmark banner: Can an open-weight model fix code as well as a frontier model? Same 23 tasks, same pipeline, blind-reviewed; the result was comparable. In the latest run, 100% of the frontier model's fixes and 96% of the open-weight model's fixes passed every test, and 100% of verified fixes were correct.

Key findings

On the KodeGauge code-fixing benchmark, an open-weight model performed comparably to a leading frontier model, and nearly every fix from both models worked.

  • Fixes that work: in the latest run, all 69 of Claude Sonnet 4.6's fixes passed every test, and 66 of 69 of Qwen3.8 27B's (96%). Across both runs, each model's fixes passed every test at least 96% of the time.
  • A label that can be trusted: in the final verification design, every fix KodeGauge labelled "verified" was correct, for both models: a precision of 100%, with recall of 88% to 96%.
  • Strict pass@1: 74% for both models when a fix must also pass every one of KodeGauge's deterministic checks. The gap from the figures above is conservative flags on working code, not broken code.
  • Fix quality: a blind reviewer from a third AI provider preferred Qwen's fix 19 times and Claude's 17 times, and rated 33 pairs a tie.
  • Speed: the open-weight model was about five times slower, with a median of 24 seconds per task against 5 seconds.

The result matters for code sovereignty. Organisations that cannot send source code to a frontier AI provider can use an open-weight model without a quality loss this benchmark can detect.

Why this matters: code sovereignty

Source code is among the most sensitive assets a company holds. Many banks, public bodies, defence suppliers and regulated firms cannot send it to an external AI provider, wherever that provider is based.

Open-weight models change that. Their weights are published, so they can run with a hosting provider the customer chooses or, in time, on the customer's own servers. The question is whether they are good enough for real engineering work.

KodeGauge measures technical debt in financial terms and fixes it with AI. It can run entirely on an open-weight model, with no fallback to a frontier provider, so code never leaves the agreed boundary. This benchmark tested whether that mode gives up quality.

Benchmark design

The benchmark has 23 tasks, each run three times per model through KodeGauge's production pipeline. Each task is a small repository written for this benchmark, so neither model could have seen it in training.

The two models were Claude Sonnet 4.6 (frontier) and Qwen3.8 27B (open-weight, served through Fortytwo). Both used the same prompts, the same pipeline and the same settings.

How the 23 tasks were chosen. There is one task per issue type in scope, plus a second variant for SQL injection and N+1 queries. Refactoring is tested in two steps, planning a split of a large file and carrying it out, in each language.

Category Issue types Python Java Tasks
Security SQL injection (2 variants), weak hashing, unsafe deserialisation, shell injection, path traversal, hard-coded secrets, weak tokens, insecure temporary files 9 0 9
Reliability swallowed and empty exceptions, unclosed resources, money stored as floating point (2 languages), mutable defaults, string comparison, magic literals, N+1 queries (2 variants) 5 5 10
Refactoring plan a file split, carry out the split 2 2 4
Total 16 7 23

The design is not balanced: all security tasks are in Python. The next round will use a full grid, with the same number of tasks in every category and language, and will add JavaScript.

Scoring. Every attempt was scored by KodeGauge's deterministic checks, run in an isolated environment:

  1. The code builds.
  2. The repository's existing tests pass.
  3. Hidden tests, written for each task and never shown to the model, pass.
  4. The deterministic checks confirm the original issue is resolved.
  5. The deterministic checks raise no new issues.

An attempt that passes checks 1 to 3 passes every test: the code works. An attempt that passes all five checks counts as fully correct. Pass@1 is the share of attempts that are fully correct with no retry, the standard accuracy measure for code-generation benchmarks. Each of the three attempts per task is an independent first try.

Two kinds of run. Head-to-head runs switched KodeGauge's verification off, to measure the models alone. Verification runs switched it on, to measure what would reach a customer. The head-to-head benchmark was run twice, on 9 and 17 November 2026.

Results

In both runs, both models' fixes passed every test at least 96% of the time. Their 95% confidence intervals overlap, so the models are comparable; this benchmark cannot rank them.

Chart: share of attempts out of 69 that passed every test, per model and run, with 95% confidence intervals. Run 1: Claude Sonnet 4.6 96%, Qwen3.8 27B 96%. Run 2: Claude Sonnet 4.6 100%, Qwen3.8 27B 96%.

The intervals treat all 69 attempts as independent. Repeats of the same task are not fully independent, so the true uncertainty is somewhat wider.

Out of 69 attempts Claude, run 1 Qwen, run 1 Claude, run 2 Qwen, run 2
Passes every test 66 (96%) 66 (96%) 69 (100%) 66 (96%)
Fully correct (strict pass@1) 48 (70%) 51 (74%) 51 (74%) 51 (74%)
Python fully correct (of 48) 33 33 36 33
Java fully correct (of 21) 15 18 15 18
  • Test failures were rare and concentrated. Each model's failures came from a single task, repeated on all three attempts: Qwen on a money-handling task in both runs, and Claude on a weak-hashing task in the first run.
  • Java: Qwen scored higher on strict pass@1 in both runs (18 of 21). One task accounts for it: a deterministic check flagged Claude's fix while the code worked.

Why strict pass@1 is 74%

Strict pass@1 also requires that a fix passes every one of KodeGauge's deterministic checks. Almost all of the gap between passing every test and strict pass@1 comes from that requirement.

Latest run, out of 69 attempts Claude Qwen
Fully correct: all five checks 51 51
Code works; a deterministic check raised a new flag 15 12
Code works; a deterministic check still flags the original pattern after a safe fix 3 3
Code broke: failed tests 0 3

Most of these flags are known false positives: the checks are deliberately conservative. The same five tasks were flagged for both models on every attempt, which points to the checks rather than the models.

The benchmark keeps strict pass@1 because it is the standard measure. For a team deciding whether a fix works, passing every test is the more relevant figure. In the product, every fix is verified deterministically before a PR is raised, so a fix like Qwen's money-handling attempt would be repaired or withheld.

Fix quality: a blind, position-swapped reviewer

A fix can pass every check and still be a poor change. To judge quality, a model from a third provider, OpenAI's gpt-6-astra, compared the two models' fixes for each attempt. It preferred neither model overall.

How the reviewer worked. It saw the two fixes as "Change A" and "Change B", with no model names. It scored each from 1 to 5 on four criteria: correctness, minimality, fixing the root cause, and readability. It then picked a winner.

Every pair was judged twice, with A and B swapped. A win counted only when the reviewer picked the same fix in both orders; any disagreement counted as a tie. This removes the known tendency of AI reviewers to favour whichever answer they see first.

Latest run, 69 pairs Count
Qwen's fix preferred 19
Claude's fix preferred 17
Tie 33
  • Ties are genuine: in 31 of the 33 ties, the reviewer rated the fixes equal in both orders. Only 2 ties came from the two orders disagreeing.
  • Criteria scores were close: each model's average was within 0.3 points of the other's, out of 5, on all four criteria. Qwen scored slightly higher for readability and root cause, Claude for correctness.
  • The first run agreed: 17 wins each, with 35 ties.

What reaches a customer: precision and recall of the "verified" label

With KodeGauge's verification on, every fix that received the "verified" label in the final design was correct: a precision of 100% for both models. The cost is recall: about one correct fix in ten went out without the label.

Each AI fix is verified deterministically before a PR is raised, and labelled "verified" only when every check passes. That label works as a classifier, so it has a precision and a recall:

  • Precision: of the fixes labelled verified, the share that were correct. A wrong fix with the label is the outcome that costs a customer's trust.
  • Recall: of the correct fixes, the share that received the label. A correct fix without the label still reaches the team, but asks more of the reviewer.

A fix counts as correct when it builds, passes the existing and hidden tests, and resolves the original issue.

Verification run Model Precision Recall Wrong fixes stopped
All 19 fix tasks, 10 Nov Claude Sonnet 4.6 100% (48 of 48) 89% (48 of 54) 3
All 19 fix tasks, 10 Nov Qwen3.8 27B 100% (52 of 52) 93% (52 of 56) 0
9 security tasks, final design, 11 Nov Claude Sonnet 4.6 100% (23 of 23) 88% (23 of 26) 0
9 security tasks, final design, 11 Nov Qwen3.8 27B 100% (24 of 24) 96% (24 of 25) 2
  • One scoring judgement: these figures count one SQL injection task as correct. Its fixes pass every test, but a deterministic check still flags the original pattern. Counting them as wrong gives precision of 87% to 96%.
  • The design favours precision. It withholds the label when in doubt, accepting lower recall so that the label can be trusted.

Speed, cost and capacity

The open-weight model was about five times slower per task, which suits background work but not interactive use. Reliability and capacity were not a constraint.

Latest run Claude Sonnet 4.6 Qwen3.8 27B via Fortytwo
Time per task, median 4.7 s 24.1 s
Time per task, 95th percentile 71 s 339 s
Time per model call, median 2.9 s 18.3 s
Output tokens per task, average 866 1,774
Cost per task $0.024 not compared
  • Speed: KodeGauge raises fixes as pull requests in the background, so a few minutes per fix is acceptable. An interactive assistant would need a faster setup.
  • Output length: Qwen wrote about twice as many tokens per task, which accounts for part of the difference in time.
  • Cost: the frontier model cost about 2.4 cents per task. Open-weight pricing depends on the hosting arrangement, so no cost comparison is made. The case for open-weight models here is sovereignty, not savings.
  • Reliability and capacity: all 138 attempts completed with no provider errors. No request was delayed by rate limits.

Limitations

The benchmark shows that the two models are comparable on these tasks. It does not show that either is better, and it does not measure everything that matters in practice.

  • Size. Repeats of the same task are not independent, so the effective sample is 23 tasks. That can detect a gap of around 15 points, not a small one.
  • Small, clean tasks. Each task is a short, self-contained repository with one clear issue. Production code has unclear test layouts, unused code and tangled dependencies.
  • Coverage. Only Python and Java, with all security tasks in Python. JavaScript is not covered.
  • Conservative checks. False positives from the deterministic checks lower strict pass@1 for both models, which is why passing every test is reported alongside it.
  • Two models. The results apply to these two models at these versions, served as they were in November 2026.
  • Correct is not the same as worth merging. The benchmark checks whether a fix is right, not whether the change was worth a reviewer's time. A separate review of KodeGauge pull requests on a real repository is informing that work.
  • AI reviewer. The reviewer's verdicts have not been compared with human reviewers', so they are indicative. The pass@1 results do not depend on them.

What comes next

The question this benchmark set out to answer, whether an open-weight model can do this work, has a clear answer. The next work moves from seeded tasks to real code.

  1. Real repositories. Run KodeGauge on open-source projects, and on customer code in enterprise pilots, and report the results with the same rigour.
  2. Sovereign mode for enterprise pilots. Enterprise customers can run KodeGauge on open-weight models, deciding where their code is processed. On-premises deployment is on the roadmap.
  3. A balanced grid. Any future benchmark round will use the same number of tasks in every category and language, and will add JavaScript.
  4. Worth, not just correctness. Measure whether each fix was worth making, not only whether it was right.

Terms used

Term Meaning
Open-weight model A model whose weights are published, so it can run with any hosting provider or on an organisation's own servers
Frontier model A leading model available only through its developer's own service
Code sovereignty Control over where source code is processed and stored
Benchmark A fixed set of tasks and scoring rules used to compare systems on equal terms
Pass@1 The share of attempts that are fully correct with no retry
Fully correct Builds, passes existing and hidden tests, and passes every one of KodeGauge's deterministic checks
Passes every test Builds and passes the existing and hidden tests: the code works
Hidden tests Tests written for each task that the model never sees
Precision (of the verified label) Of the fixes labelled verified, the share that were correct
Recall (of the verified label) Of the correct fixes, the share that were labelled verified
Position-swapped review Each pair is judged twice with the order reversed; a win counts only if both orders agree
95% confidence interval The range in which the true score is likely to fall, given the sample size

Know the risk. Choose the next fix with confidence.

Bring repository health, prioritization, and modelled impact into one view your team can investigate.

No credit card required · Free tier available · Setup in minutes