Summary (Overview)
- Core contribution: The paper introduces a dataset of 4,076 audited examples documenting how Lean formalizations deliberately depart from their natural language sources in research-level mathematics, collected from 832 Lean repositories (171 retained after filtering).
- Key finding: LoRA fine-tuning Qwen3.8-27B on these "difference pairs" nearly doubles proof completion (11.2% → 20.4%) and raises the share of statements in gold agreement with the project's own formalization from 30.4% to 39.2%—the best of seven models tested.
- Important nuance: The improvement comes specifically from training on the pairs themselves (informal passage → Lean declaration), not from training on descriptive labels of the differences, which barely helps.
- Benchmark design: The evaluation tests models on writing Lean inside large, held-out research projects (645 tasks from 27 repositories), where each declaration must fit the surrounding project context—a more realistic setting than typical competition-style benchmarks.
- Key insight: The gain is not a general improvement in Lean skill; the model learns to make the same formalization choices projects actually make, which literal transcription of the paper misses.
Introduction and Theoretical Foundation
The paper addresses two fundamental difficulties in autoformalization:
Difficulty 1: The gap between informal and formal mathematics. When a mathematician formalizes a paper in Lean, the code differs substantially from the natural language text. Formalizers:
- Generalize definitions so a Mathlib lemma applies
- Add hypotheses silently assumed in the paper
- Find convoluted workarounds when the Mathlib API doesn't support the paper's proof
- Sometimes use entirely different proofs
Frontier models often waste millions of tokens trying to translate verbatim before realizing this is impossible. The authors argue that models better at predicting how the Lean formalization will differ from its source will be much more efficient.
Difficulty 2: The benchmark gap. Existing knowledge about language models and Lean comes from short, self-contained problems: competition exercises or single sentences translated in isolation. Research-level formalization is different—it produces projects of hundreds of declarations across many files, where each new declaration must fit the ones above. This requires substantial context from both the informal paper and existing Lean code.
Theoretical premise: A model that is good at autoformalization must be a good predictor of how a natural language source must differ from its faithful Lean formalization. The paper operationalizes this by building a dataset of exactly these differences and testing whether training on them helps.
Methodology
Dataset Construction
- Source: 832 Lean repositories publicly available online; 171 retained after eliminating incomplete code and misformalizations
- Content: 4,076 records, each tied to a specific line in a Lean project and a specific sentence in the informal source
- Task types:
- def (145 tasks): write a definition
- thm (250 tasks): write a theorem statement, ending in
:= by sorry - proof (250 tasks): given the exact statement, write the proof
- Held-out test set: 28 projects never used for fine-tuning; 645 tasks from 27 projects (at most 30 from any single project)
Training
- Base model: Qwen3.8-27B (thinking disabled)
- Writer adapter: rank-16 LoRA trained on 3,256 examples of (file prefix, informal passage) → (Lean declaration), 2 epochs, ≈8.5 GPU-hours
- Gap adapter: trained on 17 descriptive labels categorizing how formalizations differ from sources (920 records, 3 epochs, ≈2 GPU-hours); shown only the informal passage, must output the label and a one-line description
Evaluation Metrics
Three quantities are reported:
-
Compiles: The code elaborates without errors (for proofs, also without
sorry). For proofs this is the whole score. -
NL agreement: Compiles AND a judge model (gpt-5.6-sol at temperature 0) scores the candidate's Lean as correctly stating the mathematical content of the passage, allowing reasonable formal choices.
-
Gold agreement: Compiles AND the judge scores the candidate as the same mathematical statement as the project actually wrote, up to naming, hypothesis order, and definitional unfolding. This is the primary measure because:
- The project itself departs from the paper, so a literal transcription can be the wrong theorem
- A passage usually covers several declarations, so a candidate identical to the project's lemma can be judged as stating less than the passage
Both measures binarize at the top score (scores in {0, 1, 2}, with 2 being the top). Uncertainty is a paired bootstrap over tasks (95% percentile intervals, 10,000 resamples).
Models Compared
All run with greedy decoding, one sample per task, through vLLM on a single 80 GB GPU:
- Qwen3.8-27B (base, untuned)
- Qwen3.8-27B + writer adapter
- Qwen3-32B
- Gemma-3-27B
- gpt-oss-120b
- DeepSeek-R1-Distill-Qwen-32B
- Goedel-Prover-32B (trained specifically for Lean proving)
Empirical Validation / Results
Main Results (Table 1)
| Model | Compiles (def) | Compiles (thm) | Compiles (proof) | NL agree (def) | NL agree (thm) | Gold agree (def) | Gold agree (thm) |
|---|---|---|---|---|---|---|---|
| Qwen3.8-27B | .476 | .744 | .112 | .166 | .360 | .131 | .304 |
| + writer adapter | .476 | .700 | .204 | .166 | .356 | .166 | .392 |
| Qwen3-32B | .255 | .580 | .096 | .103 | .256 | .110 | .220 |
| Gemma-3-27B | .276 | .504 | .068 | .076 | .168 | .062 | .164 |
| gpt-oss-120b | .529 | .647 | .224 | .227 | .332 | .210 | .332 |
| R1-Distill-Qwen-32B | .317 | .564 | .112 | .103 | .220 | .083 | .196 |
| Goedel-Prover-32B | .566 | .784 | .244 | .124 | .304 | .083 | .288 |
Best per column in bold, second best underlined. gpt-oss-120b has 119/241/250 tasks because 26 definition and 9 statement generations returned no code.
Key Findings
1. The writer adapter wins on two independent measures:
- Proof completion nearly doubled: 11.2% → 20.4% (+9.2 points, 95% interval )
- Gold agreement on statements: 30.4% → 39.2% (+8.8 points, ), the highest of any model
- 6.6 points above gpt-oss-120b on gold agreement
2. The gain is not from general improvement:
- Statements compile slightly less often (−4.4, [−10.0, +0.8]), but those that compile are in gold agreement far more often (56% vs. 41% for the base)
- Definitions: no significant change (compiles 0.0, [−8.3, +7.6]; gold agreement +3.4, [−1.4, +9.0])
- NL agreement on statements unchanged (−0.4, [−5.6, +4.8])
3. Why NL agreement and Gold agreement disagree: Among compiling statements, the base model has:
- 59 candidates in both NL and gold agreement
- 31 in NL agreement but NOT gold agreement (the "middle group")
- 17 in gold agreement but NOT NL agreement
For the adapter: 72, 17, and 26 respectively.
The middle group consists of candidates that restate the paper correctly but are not the theorem the project wrote—missing hypotheses the project added, pointwise vs. eventual bounds, or single claims where the project proves several at once. The adapter turns fourteen of these into exact matches of the project's statement. The third group (gold but not NL agreement) occurs because the passage often describes more than the one declaration, so NL agreement penalizes a mismatch in granularity unrelated to the candidate.
4. Training on difference labels does not help:
- The gap adapter (trained on 17 descriptive labels) helps on neither measure: proof gain not significant (+3.2, [−0.4, +6.8]), statement gold-agreement flat (+0.4), and compiles significantly less code
- Supplying labels in the prompt (true or predicted) changes scores by a few points in no consistent direction
5. Research-level formalization is hard for all models:
- Best model completes about one proof in four
- No model exceeds 36% NL agreement or 39% gold agreement on statements
- Goedel-Prover compiles the most statements (78%) but only 30% are in NL agreement and 29% in gold agreement
- Model size matters less than expected: a 27B model with small in-project training is competitive with 120B gpt-oss-120b
Theoretical and Practical Implications
Theoretical Implications
-
Semantic equivalence is the bottleneck, not compilation: The large gap between compilation rates and gold agreement rates shows that current open models can write syntactically valid Lean but struggle with mathematical content. This reframes the autoformalization problem: it's not about syntax but about matching the formalization choices of the project.
-
Formalization choices are learnable: The success of the writer adapter demonstrates that the "departure patterns" between informal and formal mathematics are systematic enough to be learned from data. The model learns project-specific conventions (added hypotheses, granularity choices, definitional generalizations).
-
Knowledge of the gap ≠ ability to close the gap: The failure of the gap adapter (trained on labels) shows that describing how formalizations differ is not the same as producing formalizations that account for those differences. The transfer requires training on the actual input-output pairs.
-
Benchmark design matters: The paper shows that competition-style benchmarks are insufficient. The gold agreement measure—comparing against the project's own formalization—captures what matters in real projects, and the two judges (gpt-5.6-sol and gpt-oss-120b) agree almost always on gold agreement but differ substantially on NL agreement.
Practical Implications
-
Efficient fine-tuning: A rank-16 LoRA adapter on a 27B model, trained for only ≈8.5 GPU-hours, outperforms much larger models. This is a practical recipe for improving autoformalization within a project's specific conventions.
-
Workflow implications: The results suggest that autoformalization systems should be trained on the differences between papers and their formalizations, not just on paired translations. This could dramatically reduce the token waste frontier models currently incur trying verbatim translation.
-
Dataset release: The benchmark, adapters, judge runs, and evaluation code are released, enabling further research on this problem.
Conclusion
The paper builds a dataset of 4,076 (natural language, Lean) examples from 171 research-level Lean projects, centered on the places where formalizations depart from their papers. Fine-tuning Qwen3.8-27B with a LoRA adapter on these difference pairs:
- Nearly doubled proof completion (11.2% → 20.4%)
- Raised gold agreement on statements by nearly a third (30.4% → 39.2%)
- Achieved the best results of seven models tested
The gain is not a general improvement in Lean skill; the model has learned to make the formalization choices that projects actually make, which literal transcription misses. Training on descriptive labels of differences does not transfer to closing the gap. The work demonstrates that training on where formalizations depart from their sources is an effective way of improving semantic equivalence in research-level formalization.
Future directions (implied): Larger-scale training on difference pairs, integration with compiler feedback, and extending the approach to other proof assistants beyond Lean.
Related papers
- Unlocking the Power of Loops in Pretrained LLMs with Loop Residuals
LoopRes finetunes pretrained LLMs into looped Transformers, adding loop-aware keys and residual windows to boost math and code scores by up to 29.1% over SFT.
- FlyingStart: Learned Cross-Token Warm Starts for Fixed-Point Decoding in Recurrent-Depth Language Models
FlyingStart learns a linear warm-start map for recurrent-depth language models, cutting decoding layers by 14–19% while matching accuracy and preserving the exit rule's safety certificate.
- RecurSciBench: Benchmarking Recursive Self-Improvement in Data-Driven Scientific Research
RecurSciBench shows recursive self-improvement gains are system-dependent and uneven, with half of evolved states regressing, yet experience can transfer across task types and domains in non-obvious ways.