Dear Deadline

English

English: the full tool.

Español: una página en español con lo más importante

An independent guide to benefit letters and bills: Social Security, Medicare, SNAP, Medicaid and housing. Not a government website.

Does telling an AI code reviewer what the code should do help?

Paper: When Postconditions Help or Mislead: An Empirical Study of LLM Code Review

Preprint. It has not yet been peer reviewed.

The short version

AI code reviewers see what code does but not what it is supposed to do, so they flag correct code and miss real bugs. I gave three AI reviewers 210 real Java methods, each in its original form and with three planted bugs, sometimes with a statement of what the method should guarantee, called a postcondition. Checked postconditions cut false alarms by more than half for two of the three reviewers. Postconditions written by an AI helped one reviewer find more bugs, but when that reviewer was told to treat them as the specification, it missed many more.

What I found

Why it matters

Teams adding an AI reviewer may cut false alarms by giving it checked statements of what the code is meant to do. The wording matters: give the statement as information, not as an order to treat it as the specification.

How the study was done

The study used a public benchmark of 210 Java methods from 60 open-source projects with checked postconditions. Each method was reviewed alone, with its whole source file, or with either the checked or the AI-written postconditions, and every review was scored against the benchmark. A follow-up experiment removed the instruction to treat the postconditions as the specification, to measure its effect.

Read the paper (PDF) Data and code on Zenodo

How to cite

Thapa, S. J. (2026). When Postconditions Help or Mislead: An Empirical Study of LLM Code Review [Preprint]. Zenodo. https://doi.org/10.5281/zenodo.23956986

All research · Go to the tool