Large Language Models (LLMs) have demonstrated impressive capabilities in solving mathematical problems. However, they remain probabilistic "guessers" rather than logical "reasoners." Natural language ambiguity often leads to "hallucinations" where models provide correct answers through flawed logic or coherent-sounding proofs for incorrect results.
Researchers from the University of Illinois Urbana-Champaign have introduced FANS (Formal ANswer Selection), a framework designed to bridge the gap between natural language reasoning and formal logical rigor. By leveraging Lean4, a formal mathematical programming language, FANS enables computer-verifiable certainty for LLM-generated solutions.
The Challenge of Verifiability
Current methods for selecting the best answer from multiple LLM attempts typically rely on Majority Voting (picking the most common answer) or Outcome Reward Models (ORMs). While effective to a degree, Majority Voting fails when models are consistently incorrect on difficult problems. Reward Models, being probabilistic themselves, can be misled by "plausible-looking" but logically flawed steps. FANS introduces a symbolic "backbone": if a solution can be translated into Lean4 and successfully compiled, its mathematical validity is indisputable.
The FANS Framework
The FANS framework operates through a three-stage pipeline designed to move from probabilistic selection to deterministic verification.
- NL to FL Translation: A specialized "LeanTranslator," trained with a Long Chain-of-Thought (CoT) approach, converts the natural language (NL) problem and candidate answers into a formal language (FL) theorem statement in Lean4.
- Formal Proof & Verification: The Lean4 statement is passed to an automated prover (e.g., DeepSeek-Prover). The resulting formal code is then checked by the Lean4 compiler. Successful compilation guarantees logical soundness.
- Answer Selection: FANS filters candidate answers based on verification results. It can act as a standalone selector or complement an ORM. Answers verified by the formal system are prioritized.
Experimental Results
The researchers evaluated FANS across high-standard benchmarks including MATH500, AMC23, and competition-level datasets like Minerva Math. The framework was tested using several base models, including Mistral-7B, DeepSeek-Math-7B, and the Qwen-2.5-Math series.
Key Findings
- Significant Accuracy Gains: FANS consistently outperformed standard selection methods. It improved accuracy on MATH500 by up to 1.91% and provided a substantial 8.33% boost on the challenging AMC23 benchmark.
- Model Synergy: The most robust performance was achieved by combining FANS with traditional reward models (ORM + FANS), indicating that formal verification and probabilistic scoring are highly complementary.
- Domain Specificity: FANS showed particular strength in Algebra and Number Theory, fields where the Lean4 mathematical libraries (Mathlib) are most mature. In Number Theory, FANS achieved a relative improvement of nearly 8% over standard reward models.
- Impact on Smaller Models: For smaller models like Mistral-7B, FANS provided a massive 20% relative improvement on AMC23 compared to majority voting, effectively "leveling up" the model's reasoning capabilities.
Limitations and Future Directions
While FANS represents a significant step toward rigorous AI math, several challenges remain. The system is sensitive to translation errors; if the "LeanTranslator" misinterprets a problem constraint, the formal proof may verify an incorrect theorem. Additionally, current automated provers fail to find proofs for approximately 40% of correct formal statements.
Future work will focus on improving the robustness of NL-to-FL translation through iterative fine-tuning and expanding Lean4 library coverage to include more complex geometry and combinatorics problems. By tightening the loop between natural language and formal logic, FANS paves the way for truly reliable mathematical AI.
Summary updated