Counterexamples as Feedback for Agent Self-Correction
When an agent's output is wrong, most retry loops send back some version of "that didn't work, try again". This paper builds the alternative and measures it: a deterministic checker runs the candidate against a small held-back test set and returns up to two concrete strings it wrongly accepted and two it wrongly rejected, so the next turn starts from evidence rather than disapproval. On 30 plain-English-to-pattern tasks that repaired 90% within four turns, against 27% for generic self-correction, 23% for a bare failure count and 17% for one zero-shot attempt — and 27 of the 30 had landed by turn three. If your loop already knows why a check failed — the assertion's actual value, the payload the validator rejected, the row that broke — put that object in the retry prompt instead of the word "incorrect".