← Back to Podcast

Why AI should not grade its own code

AI judges score their own work above other models' work, a 2024 study found. So who checks the code that your supplier's AI wrote, before it reaches your customers?

Put that question to your supplier in those words. If the answer is the same model that wrote it, the check is weaker than it looks, and so are any tests that model wrote for its own change.

A woman in a navy coverall studies an opened jet engine in a hangar while a man waits by a tool cart behind her
A separate reviewer reads every change.

Why a model favors its own work

One likely reason is that a model recognizes its own writing. The study (Panickssery, Bowman and Feng, presented at NeurIPS 2024, a leading research conference) had models grade short summaries of news articles, some written by the grader itself and some by others.

The graders scored their own summaries higher than the others', even where human reviewers rated the two as equal in quality. And the better a model was at recognizing its own text, the stronger the preference. Researchers call this self-preference bias.

The study graded summaries, not code. I expect the same pull when a model reviews its own change. There is a second problem, separate from the bias. A model that misread your requirement while writing the code will tend to misread it the same way while reviewing it.

A second model from another family

Your supplier may add a second model. It should come from a different family, meaning the line of models one company trains. Two models from the same line usually share much of their training, so I expect them to share habits and blind spots. A reviewer with the same habits is likely to repeat the author's mistakes and then approve them as correct.

A different family is a precaution against shared blind spots, not a guarantee. Test what it adds on defects you already know about before you rely on it for any change.

Your regression tests are the first gate: a change that breaks one is flagged and stopped before it ships, and your live system keeps the version that passed.

Three gates, and what each catches

Every change goes through the first two gates. Each compares it with what the authoring model did not produce: your requirements, or another model's reading. The third is a person who reads where the first two disagree. Each is set out below with what it is built to catch.

Diagram of the three gates an AI-written change passes. Gate 1: regression tests whose expected results come from your approved requirements, run on every change. Gate 2: a verifier from a different model family, which sees the requirement and the change but not the author's reasoning. Both results go to gate 3, a person who reads first where the two disagree, and who stops the change when a flag is confirmed. With no flag confirmed, a change that touches money, customer data or production is signed by that person before it is released.

First gate: regression tests

Automated tests run on every change and confirm that what worked yesterday still works. Their expected results come from your approved requirements or verified records, not from the code. The authoring model may help write them, but its tests alone never count as the independent check. Built to catch: a break in behavior you already agreed on.

Second gate: a verifier from another family

It receives your requirement, the change, and the code and constraints around it, but not the authoring model's notes or reasoning. Its job is to argue against the change. In my experience, a reviewer that reads the author's justifications tends to agree with them. Built to catch: a change that departs from what your requirement says, even when it runs cleanly.

Third gate: a person who reads the disagreements

When the tests pass and the verifier objects, or two model families read the requirement differently, that disagreement is where a person looks first. That person also signs every change that touches money, customer data or production. Built to catch: what the first two gates leave undecided, and any flag on a change that person must sign.

One rounding error through the gates

You run a logistics company. Your billing rules say a delivery charge is rounded once, on the invoice total. Your supplier's AI agent changes the billing code, and it rounds each line instead. The same agent writes tests for its change. They pass, because they were written to match the code, mistake included. Its own review approves it, and the change is ready to ship.

Now run the three gates. A regression test built from your billing rules replays last month's invoices, and some totals come out a cent or two off. The verifier from another family reads the requirement and flags rounding per line. Because the change touches money, a person has to sign it. They see both flags and stop it before it reaches a customer.

Each gate adds something different. The regression test finds the symptom: totals that disagree with last month's invoices. The verifier finds the cause: rounding per line instead of once. The person has the authority to hold the release, and uses both flags to decide.

A cent or two, every month

Without the gates, that error appears on every affected invoice, every month, until a customer's accounts team finds it. Then the question becomes how many other changes were checked the same way. Answering it can mean investigating earlier billing changes and replaying affected invoices to establish how far the error spread. The gates catch an error like this one before release, while it is still a single change with one person reading it.

If engineers review everything

Ask what the engineer reads. If a person reads every line of every change, that is a real check. If the volume of AI-written code makes them skim, some errors get through. Then the independent gates do most of the checking, and a person reads closely where risk is highest.

Ask for the written rule that names which changes get that close read: at least every change that touches money, customer data or production. Then check a month of changes against it.

The test to run on your supplier

  1. Take one recent change they shipped you. Ask for the checks it passed before release.
  2. Write who or what did each check. Which test, which model, which person.
  3. Mark checks the authoring model did. If all are marked, nothing independent looked.

References

  1. Panickssery, A., Bowman, S. R., & Feng, S. LLM Evaluators Recognize and Favor Their Own Generations. Advances in Neural Information Processing Systems (NeurIPS), 2024.

NEXT · TO PRODUCTION

Find the real blocker.

Fifteen minutes with Omar.