Repair, Retry, and the Cost of Hindsight: Verifier Feedback in Formal Theorem Proving
Organizations: Department of Computer Science, Stanford University
Abstract
Verifier-guided self-repair conditions a model on feedback from failed attempts before it tries again, without weight updates. Yet two findings in prior work are in tension: verifier feedback can improve repair of failures, but self-repair itself can provide little-to-no advantage over independent resampling. We reconcile these findings in Lean theorem proving through controlled one-step experiments that hold the preceding failure fixed while varying whether the failed proof is shown, whether the compiler error corresponds to that failure, and the retry instruction. We test frozen Qwen3.6-27B, a general-purpose model, and DeepSeek-Prover-V2-7B, a specialized prover, on difficult MiniF2F problems. We find two opposing effects. Showing the model its failed predecessor reduces success and sharply increases copying of it, while on Qwen adding that attempt's compiler error recovers the loss, to the level of the diagnostic alone. Replacing the predecessor with another theorem's failed proof largely removes the degradation on both models; on Qwen, replacing the diagnostic with another problem's error substantially reduces the recovery. Without the failed proof, correct diagnostics show no resolved advantage over wrong-diagnostic controls on either model. The failed-proof penalty persists with and without the retry instruction, whereas Qwen's diagnostic recovery is weaker without it. In 11-problem sequential experiments through 64 attempts, Qwen retains a correct-diagnostic benefit within failed-proof histories, while DeepSeek-Prover shows no resolved recovery. However, no tested one-step feedback condition establishes an advantage over instruction-only resampling, nor does 64-attempt sequential repair with failed proofs and correct diagnostics at equal token budgets. Verifier feedback can thus improve repair without overcoming the performance loss from conditioning on a failed attempt.
Figures & tables
| Study | Repair context | Feedback control | Additional separation |
|---|---|---|---|
| Verma (2026) | Failed code under matched-budget retries | Placebo feedback; successful cross-task examples in a separate experiment | Failed-code exposure versus omission; cross-task examples supplement rather than replace the failed code |
| Iscan (2026a) | Failed code in one repair step | Generic fact bullets matched to the executed-feedback format | Blind resampling with matched generation count |
| This work | Fixed failed Lean proof and evolving histories | Cross-problem diagnostics, ordinary or class/length matched | Own-proof omission or replacement and retry-instruction crossings |
| Condition | Instruction | Failure notice | Failed proof | Added feedback |
|---|---|---|---|---|
| Bare | – | – | – | – |
| Yes | – | – | – | |
| Yes | Yes | – | – | |
| Yes | Yes | Yes | – | |
| Yes | Yes | – | Diagnostic | |
| Yes | Yes | Yes | Diagnostic |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Contrast | (pp) | 95% CI | Status | Adjustment |
| Repair does not beat retrying | |||||
| Qwen | Expl. | — | |||
| DS | Expl. | Holm, BH | |||
| Qwen | Prim. | — | |||
| DS | Prim. | Holm, BH | |||
| Own failed proof harms | |||||
| arm | prompt | pass@4 count | passes | vs. (sign, ) |
|---|---|---|---|---|
| bare | task only | 15 | 18 | 9/42, |
| instruction line + task | 45 | 110 | — | |
| N † | random words + instruction | 49 | 105 | 19/23, 0.64 |
| N2–N5 † | four more random-word sentences | 48/43/42/44 | 130/87/117/116 | 0.16/0.20/1/0.50 |
| failure sentence + instruction | 33 | 81 | 11/26, 0.020 | |
| S † | “did fully verify” variant | 30 | 77 | 8/27, 0.0019 |
| scaffold | without line | with line | line’s worth (sign, ) | without, vs. bare |
|---|---|---|---|---|
| nothing | 15 (bare) | 45 ( ) | (42/9, ) | — |
| random words | 30 | 49 | (33/12, 0.002) | (26/8, 0.003) |
| failure sentence | 46 (repl. 45) | 33 | (14/29, 0.03) | (42/7, ) |
| + compiler error | 32 | 41 | (22/11, 0.08; McNemar 0.049) | (28/8, 0.001) |
| + wrong error | 29 | 39 | (25/13, 0.07) | (28/11, 0.009) |
| + reflection | 41 | 42 | (18/18, 1) | (39/10, ) |
| scaffold | with line | without line |
|---|---|---|
| nothing | 29 (65; bare) 34 (85; ) | — |
| random words | 32 (83) | — |
| failure sentence | 35 (92) | 32 (88) |
| + compiler error | 30 (79) | 32 (81) |
| + another problem’s error | 32 (83) | 32 (86) |
| + failed code | 14 (25) | 8 (12) |
| Contrast | Counts | Wins/losses | Raw | Holm |
|---|---|---|---|---|
| vs. bare | 33/15 | 32/9 | 0.000215 | 0.00108 |
| vs. | 41/33 | 25/19 | 0.226 | 0.462 |
| vs. bare | 41/15 | 37/9 | 0.0000203 | 0.000122 |
| vs. | 42/33 | 25/15 | 0.154 | 0.462 |
| vs. | 18/33 | 11/27 | 0.0139 | 0.0554 |
| vs. | 40/41 | 25/22 | 0.771 | 0.771 |
| Model | Contrast | All problems | Parseable problems |
|---|---|---|---|
| Qwen | |||
| Qwen (167) | DeepSeek-Prover (137) | |||
| arm | problems | passes | problems | passes |
| 42 | 93 | 33 | 88 | |
| 47 | 90 | 32 | 87 | |
| 27 | 66 | 12 | 26 | |
| Contrast | Identifier subset ( ) | Other problems ( ) | Subset difference |
|---|---|---|---|
| ( ) | ( ) | ||
| ( ) | ( ) | ||
| ( ) | ( ) | ||
| ( ) | ( ) | — |
| Predecessors | Failed one-step samples | |||
|---|---|---|---|---|
| Category | Qwen | DeepSeek | Qwen | DeepSeek |
| Lean 3 keyword ( begin ) | 48 | 0 | 2,376 | 0 |
| Valid in 2024 Mathlib, renamed since | 7 | 18 | 1,269 | 1,089 |
| Needs an unopened namespace | 1 | 0 | 49 | 0 |
| Never in either library | 11 | 0 | 1,135 | 20 |
| Local hypothesis or variable | 1 | 0 | 271 | 61 |
| Contrast | Lean 3 predecessors ( ) | Other problems ( ) |
|---|---|---|
| ( ) | ( ) | |
| ( ) | ( ) | |
| ( ) | ( ) | |
| ( ) | ( ) | |
| ( ) | ( ) |
| Status | Contrast | (pp) | 95% CI |
| Ordinary-shuffle registration (2026-09-07, 2026-09-08) | |||
| Primary | |||
| Primary | |||
| Reg. | |||
| Reg. | |||
| Reg. | |||
| arm | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|---|
| 3 | 8 | 12 | 15 | 17 | 20 | 25 | |
| 4 | 11 | 28 | 35 | 40 | 44 | 49 | |
| 2 | 9 | 13 | 15 | 17 | 20 | 23 | |
| 2 | 9 | 17 | 18 | 22 | 24 | 29 | |
| 1 | 4 | 14 | 24 | 40 | 60 | 70 | |
| 5 | 10 | 20 | 27 | 37 | 51 | 63 |
| Status | Contrast | (pp) | 95% CI |
| Ordinary-shuffle registration (2026-09-11) | |||
| Primary | |||
| Reg. | |||
| Reg. | |||
| Reg. | |||
| Reg. | |||
| arm | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|---|
| 7 | 10 | 11 | 14 | 16 | 20 | 27 | |
| 9 | 9 | 12 | 14 | 16 | 20 | 27 | |
| 11 | 11 | 13 | 14 | 15 | 17 | 25 | |
| 9 | 9 | 9 | 11 | 14 | 21 | 25 | |
| 9 | 12 | 26 | 35 | 52 | 61 | 74 | |
| 9 | 17 | 24 | 35 | 53 | 72 | 90 |
| Model | Contrast | Full (pp) | Range | Sign | Excl. |
|---|---|---|---|---|---|
| Qwen | 0 | 1 | |||
| 0 | 0 | ||||
| 0 | 0 | ||||
| 0 | 0 | ||||
| 0 | 0 | ||||
| 0 | 0 |
| Model | Accounting | Budget | (%) | ||||
|---|---|---|---|---|---|---|---|
| Qwen | total | 200k | 63.1 | 0.066 | 0.50 | ||
| Qwen | input | 20k | 69.3 | 0.018 | 0.025 | ||
| Qwen | output | 20k | 35.9 | 0.98 | 0.16 | ||
| DeepSeek | total | 200k | 89.9 | 0.002 | 0.062 | ||
| DeepSeek | input | 50k | 90.3 | 0.002 | 0.016 | ||
| DeepSeek | output | 5k | 41.0 | 0.002 | 0.84 |
| Category | GPU-hours |
|---|---|
| Depth experiments | 124.8 |
| Qwen one-step | 33.4 |
| No-instruction ladder | 10.7 |
| Code plus shuffled diagnostic | 1.7 |
| DeepSeek-Prover one-step | 1.2 |
| Probes | 0.1 |
| One-step | Sequential | ||
| Manuscript | Artifact | Manuscript | Artifact |
| bare, , | bare , I , F | (memoryless) | memI |
| , , , | F_C , F_E , F_CE , F_R | , | C , CE |
| , | F_E_shuf , F_CE_shuf | , | CE_s , CE_m |
| , | F_E_match , F_CE_match | f | |
| F_C_other | E_s | ||
LLM Self-Correction
Large language model self-correction studies how language models detect and repair errors in their own answers, reasoning, and actions.
See all 159 papers