Introduction: Solving the Math Data Trilemma
Large Language Models (LLMs) frequently struggle with logical consistency in multi-step mathematical reasoning, often leading to "hallucinations." Addressing this requires high-quality, step-by-step data, which currently faces a "trilemma": manual annotation is expensive and unscalable, rule-based synthesis lacks natural complexity, and pure LLM synthesis often produces logically flawed steps.
The MUSTARD framework (Mastering Uniform Synthesis of Theorem and Proof Data) overcomes these hurdles by combining the creative generation of LLMs with the rigorous validation of formal proof assistants like Lean. Unlike previous methods, MUSTARD ensures high correctness through formal verification while maintaining the scalability and reusability of synthetic data.
The MUSTARD Framework
The framework operates through a "generate-verify-refine" loop consisting of three main stages:
- Concept Seeding: Mathematical concepts are sampled from a curated pool (e.g., Khan Academy) to ensure broad coverage, from elementary arithmetic to multivariable calculus.
- Solution Generation: An LLM (such as GPT-4) generates a natural language problem, an informal step-by-step proof, and a corresponding formal proof in the Lean programming language.
- Proof Filtering & Self-Correction: The Lean code is verified by the Lean Prover. If errors occur, the feedback is returned to the LLM for revision. Only proofs that pass formal verification are included in the final dataset.
The MUSTARDSAUCE Dataset
The authors produced MUSTARDSAUCE, a benchmark containing 5,866 validated theorem-and-proof pairs. Each entry includes an informal statement, an informal proof, and a verified formal Lean proof. The dataset spans educational levels from elementary to higher education, providing a diverse training ground for mathematical reasoning.
Key Insights: Formal Validation as a Quality Proxy
A central finding of the research is that formal validation serves as an effective proxy for natural language quality. If an LLM can successfully auto-formalize a proof that passes the Lean compiler, the underlying informal reasoning is significantly more likely to be logically sound.
Furthermore, the study highlights the power of self-correction. For simpler problems, providing error feedback allowed the model to fix initial mistakes, increasing pass rates by over 30%. However, this effectiveness diminishes for higher-education mathematics, marking the current frontier of LLM capabilities.
Results and Impact
Fine-tuning a Llama 2-7B model on MUSTARDSAUCE yielded significant performance boosts across multiple benchmarks:
- Automated Theorem Proving (ATP): A 15.41% average relative performance gain.
- Math Word Problems (MWP): An 8.18% improvement in solving natural language problems.
- Zero-Shot GSM8K: A 20.9% improvement over the base model.
Human evaluation corroborated these results, showing that the "Valid" group (those passing the Lean prover) exhibited much higher logical consistency (72%) compared to the "Invalid" group (54%).
Conclusion
MUSTARD demonstrates that formal logic can act as a scalable quality filter for synthetic natural language data. By bridging the gap between informal reasoning and formal verification, the framework provides a path toward more reliable and capable mathematical AI models. Future work will focus on scaling the dataset and refining the alignment between informal and formal representations.
Summary updated