Context Theory Get your growth audit

Answer

Why does AI-generated code look right and fail?

Because it is written to resemble correct code, and resemblance is strongest exactly where the specifics matter least to the reader.

Because plausibility and correctness come apart in the details. The structure, naming and shape of correct code are reproduced reliably; the specific interface, the edge case and the assumption about the data are not, and they read the same.

There is a systematic reason this happens rather than an accident. What makes code read as correct — consistent naming, sensible structure, plausible error handling, idiomatic style — is exactly the class of feature that generalises from having seen a great deal of code. What makes it actually correct is the fit between this code and this specific system, this version of a library, this shape of data. The first is reliably produced; the second is not, and a reader assessing the first will pass the second.

The commonest concrete failures follow from that. An interface that does not exist but should: a method with the obvious name and the obvious arguments, from a library where the real one is spelled differently. A version mismatch: correct code for a previous release. An edge case that was not in the example: the empty list, the null, the duplicate, the concurrent write. An assumption about the data that holds in the sample and not in production.

There is a second effect that is less discussed and matters more in mature codebases: the change is locally correct and contextually wrong. It works, and it duplicates something that already exists, or bypasses a layer that exists for a reason, or handles an error in a way that conflicts with how the system handles errors elsewhere. Nothing about the code is wrong; it does not belong. This kind of failure is invisible to tests and visible only to someone who knows the system.

The practical consequence is that reading is the wrong primary control. Running is better: does it compile, do the tests pass, does the failing case now pass, does the behaviour actually change when you exercise it. Searching is better for the contextual class: does this already exist, who else calls this, how do neighbouring modules handle the same situation. Both are cheaper than careful reading and both catch things reading does not.

The failure this predicts at team level is worth naming. Because the output reads well, it passes review more easily than equivalent human work, and the defects that survive are concentrated in the specifics that a reader skims. Teams that adopt these tools and keep their review habits unchanged usually see the defect rate hold or improve initially and then drift, because the escaping defects are the kind that take a while to surface.

The code looks right because looking right is a property of the surface, and the surface is the part that was easiest to get right.

Siddharth Sharma, Context Theory

Related questions

Does this improve as models get better?

The rate of invented interfaces and version mismatches falls, and the contextual failure does not, because it depends on knowledge of your system rather than on general competence. Improvement also carries a hazard: as the obvious errors become rarer, the checking habit erodes, and the remaining errors are the subtle ones.

What is the single most effective check?

Running the thing, including the case that motivated the change. A surprising share of generated code has never been executed at the point it is presented, and execution catches the invented interface, the version mismatch and the obvious edge case in one action. It says nothing about the contextual class, which needs a search rather than a run.

METHOD

Every figure below carries its source and the date it was verified. Nothing on this page is asserted.

The numbers on this page.

Datapoints
What Value Specific to
Close rate — response under 5 minutes vs over 24 hours32% vs 12%Category-wide
Sub-15-minute compliance — automated routing vs manual only62.5% vs 39.1%Category-wide

Optifai speed-to-lead benchmark · n=939 companies · Q2 2025–Q1 2026 · verified

2026 speed-to-lead benchmark · verified

What is specific to this page.

Evidence
Kind Claim Check it against
SoftwareThe features that make code read as correct — naming, structure, idiom, plausible error handling — generalise across codebases, while correctness depends on fit with a specific system, library version and data shape, so a reader assessing the first will pass the second.Checking a sample of generated changes for whether defects sit in surface features or in specifics.
WorkflowA distinct failure class is locally correct and contextually wrong: the code works while duplicating existing functionality, bypassing a layer that exists for a reason, or handling errors inconsistently with the rest of the system, which tests do not detect.Searching for existing implementations of the behaviour a generated change introduces.
ResponseExecution catches invented interfaces, version mismatches and obvious edge cases in a single action and is frequently omitted because generated code is often presented without having been run.Checking whether a presented change was executed before being offered, and running it if not.
ConstraintBecause generated output reads well it clears review more easily than equivalent human work, so teams retaining unchanged review habits see escaping defects concentrated in skimmed specifics and surfacing on a delay.Tracking the origin of defects found in production against how the change was reviewed.

Each row would be wrong on another industry's page. Where a sourced figure exists it is in the table above instead; these are the constraints that shape the work and do not happen to be numbers.

Start with the measurement.

Reading about a benchmark is not the same as knowing your own number. The audit produces yours, measured rather than estimated.

Get your growth audit

$497 · delivered in 5 business days · credited against month one