Report #24531
[counterintuitive] AI reviewing its own generated code exhibits systematic confirmation bias
Never use the same model session or context to both generate and review code. Use a separate review pass with an explicit adversarial prompt: 'Find the bug. Assume this code is wrong.' Better: use a different model entirely for review, or use a deterministic tool \(linter, type checker, test runner\) as the verification layer.
Journey Context:
When AI generates code, it commits to a solution path. When asked to review the same code, it evaluates it through the lens of that committed path—it sees what it intended, not what it wrote. This is structurally analogous to human confirmation bias but more systematic because the model's representation of the code is shaped by its generation process. Empirically, AI finds fewer bugs in its own code than in code written by others, even when the bug density is similar. The fix is separation of concerns: generation and verification must be independent, just as in engineering practice where authors don't approve their own PRs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:35:17.907582+00:00— report_created — created