TL;DR
MathForm introduces a novel framework for mathematical autoformalization that combines external library knowledge retrieval with verification-guided iterative refinement. By constructing the 367K-sample FormalVerse dataset and training an 8B model via supervised fine-tuning and reinforcement learning, the authors outperform specialized models more than four times its size.
What Problem Does This Paper Address?
Autoformalization—the process of translating natural language mathematics into machine-verifiable code (such as Lean 4)—is a crucial bottleneck for scaling automated theorem proving systems. Currently, models struggle with this task because they rely entirely on their internal parametric memory to navigate the massive, complex, and evolving type hierarchies of formal libraries like Lean's Mathlib.
Furthermore, standard data generation pipelines rely on a simple "Best-of-N" filtering strategy, which caps data difficulty at the model's single-pass generation capability. This often results in formal statements that compile successfully but subtly alter or drop key mathematical assumptions, rendering them useless for downstream proof assistants.
Methods
The authors propose MathForm, a closed-loop data construction and training framework that replaces one-shot translation with an iterative, grounded process:
- Knowledge Retrieval: A Retrieval Planner analyzes the natural language statement and queries Mathlib via
LeanExploreto fetch relevant definitions and existing formalizations, grounding the generation process. - Verification-Guided Iterative Refinement: Instead of discarding failed single-pass attempts, candidates undergo a multi-round loop. They face a format check, a syntax check (Lean compiler diagnostics), and a semantic consistency check (using QwQ-32B as a judge). Failures trigger corrective feedback and re-retrieval for up to three rounds.
- Trajectory Reconstruction: The messy multi-round histories are retrospectively synthesized into clean, structured Chain-of-Thought (CoT) formalization trajectories.
- Training Recipe: They fine-tune a Qwen3-8B model using Supervised Fine-Tuning (SFT) on these clean trajectories, followed by Reinforcement Learning (RL) using the DAPO algorithm with a joint compilation and semantic consistency reward.
Datasets
- FormalVerse: A newly constructed large-scale Lean 4 dataset containing approximately 367K verified examples. Its sources include Lean-Workbook (32.8%), NuminaMath (26.0%), DeepMath (11.4%), and other diverse mathematical corpora.
- Evaluation Benchmarks: The model was evaluated across six diverse benchmarks: FormalMATH-Lite, DeepSeek-ProverBench, CombiBench, and the highly abstract FATE series (FATE-M, FATE-H, FATE-X), which cover advanced abstract algebra and algebraic geometry.
Key Insights and Ideas
- The Power of Iteration: Multi-round refinement recovered an additional 31% of verified data that single-pass generation completely missed, effectively raising the ceiling of data difficulty the pipeline could handle.
- Syntax $\neq$ Semantics: A statement can compile successfully while still being mathematically incorrect (e.g., swapping quantifiers or dropping preconditions). Incorporating an LLM semantic consistency judge is critical for high-fidelity data.
- Pipeline Compression: Training an 8B model on these multi-round trajectories effectively "compresses" the complex retrieval-and-refinement pipeline's capabilities into the model's single-pass generation, realizing a form of data-model co-evolution.
Key Results
- MathForm-8B achieved a macro-average Pass@8 rate of 88.06% under Syntax Check (SC) and 72.37% under Consistency Check (CC) across six benchmarks.
- It consistently outperformed specialized 32B models like ReForm-32B (68.41% CC) and Goedel-Formalizer-V2-32B (63.74% CC).
- On highly abstract benchmarks like FATE-H and FATE-X, MathForm-8B achieved CC pass rates of 63% and 37%, outperforming the strongest specialized baselines by 10 to 12 percentage points.
Limitations and Future Work
While MathForm-8B dominates specialized autoformalizers, frontier general-purpose models (like Qwen3.7-Plus or DeepSeek-V4-Pro) still hold an edge in semantic fidelity (higher CC scores), indicating a capability-efficiency trade-off. Additionally, the authors plan to explore larger-scale test-time scaling methods to further boost performance on highly complex mathematical problems.
Summary updated