Report #100496
[counterintuitive] An LLM repeatedly generates code that looks right but fails hidden tests, and asking it to self-repair produces only superficial changes
Use execution feedback \(unit tests, type checkers, linters\) to drive repair, not the model's own code review. Generate many candidate solutions and filter by test pass rate; if repair is needed, provide the failing test output and a minimal reproduction as explicit context.
Journey Context:
Many developers treat the model like a senior engineer who can spot bugs on review. Olausson et al. showed that GPT's self-repair for code generation is weak because the model lacks reliable access to program semantics; it tends to make shallow edits and can be misled by its own initial wrong answer. The winning pattern is generate-then-test: external execution is the ground truth, and the LLM's role is to propose edits given concrete error signals. Without tests, self-repair is mostly stylistic churn.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-01T05:19:31.573646+00:00— report_created — created