Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification

Joshua Ong Jun Leang, Haonan Li, Zheng Zhao, Xinyi Shang, Wenda Li, Zhengzhong Liu, Erix Xing, Shay Cohen, Eleonora GiunchigliaarXiv 2026

TL;DR

MAGENTA is a training-free, agentic pipeline that bridges the gap between informal mathematical reasoning and formal verification by automatically translating natural-language math problems into Lean 4 statements and verifying them with machine-checked proofs. By introducing a "statement judge" to ensure semantic alignment and an "error-attribution judge" to intelligently route failures, MAGENTA achieves 100% accuracy on challenging math olympiad benchmarks. Notably, it enables a compact 7B parameter open-weight model to solve all six problems of the prestigious International Mathematical Olympiad (IMO) 2026.

What Problem Does This Paper Address?

While Large Language Models (LLMs) have become remarkably adept at solving informal mathematical problems using chain-of-thought (CoT) reasoning, their outputs are still prone to subtle logical errors, hallucinations, and dead ends. Interactive theorem provers like Lean 4 offer a solution by providing absolute, machine-checkable certificates of correctness.

However, existing automated theorem-proving systems suffer from two major limitations:

  1. The Autoformalisation Gap: They typically assume a human has already translated the natural-language problem into a formal logic statement. If an LLM auto-formalizes a problem incorrectly, it might generate a valid proof for a trivialized or incorrect version of the question, creating a "false certificate."
  2. Underdetermined Rejection Loops: When a proof fails to compile or verify, standard systems struggle to determine why. Is the underlying mathematical logic flawed (requiring a new derivation), or is it simply a minor syntax/tactic error in the Lean code (requiring local code repair)?

Methods

MAGENTA addresses these challenges through a training-free multi-agent architecture that separates problem-solving into four distinct roles:

  1. Reasoner ($R$): Proposes an informal natural-language solution and a candidate answer.
  2. Formaliser ($F$): Translates the natural-language problem and the proposed answer into a Lean 4 theorem statement.
  3. Statement Judge ($J_s$): Acts as a semantic gatekeeper. It explicitly checks whether the generated Lean statement faithfully preserves the original problem's meaning, rejecting any attempts that drop constraints or bake the answer into the hypotheses.
  4. Prover ($P$): Uses the reasoner's informal text as a high-level "proof plan" to write the formal Lean 4 proof script.
Overview of the MAGENTA pipeline showing the interaction between the Reasoner, Formaliser, Prover, and Judges.

Crucially, MAGENTA introduces an Error-Attribution Judge ($J_e$). If the deterministic Lean verifier rejects a proof, $J_e$ classifies the failure:

  • SYNTAX Error: The math is fine, but the Lean code is broken. The pipeline loops back to the Prover for local repair.
  • MATH Error: The underlying logic is wrong. The pipeline routes the compiler feedback all the way back to the Reasoner to derive a fresh mathematical solution.

Datasets

The authors evaluated MAGENTA on highly competitive, numerical-answer math olympiad datasets that lack pre-existing formal statements:

  • AIME 2025 & AIME 2026 (American Invitational Mathematics Examination)
  • HMMT February 2026 (Harvard-MIT Mathematics Tournament)
  • IMO 2026 (International Mathematical Olympiad)

Key Insights and Ideas

  • Semantic Adjudication is Mandatory: Simply checking if a Lean statement compiles is a weak proxy for correctness. The authors found that without the Statement Judge ($J_s$), the pipeline's false certification rate skyrocketed to 45.5% because the model frequently proved weakened or "answer-baked" surrogate goals.
  • Smart Routing Beats Blind Resampling: Instead of independently sampling new proofs when a failure occurs, conditioning the next attempt on the specific compiler error and routing it to the correct component (math vs. syntax) significantly improves efficiency, especially on harder problems.
  • Compute-for-Scale Tradeoff: MAGENTA demonstrates that verification-guided test-time scaling can compensate for smaller model sizes. An agentic loop allows a 7B model to achieve results that previously required closed-source frontier models or massive search budgets.

Key Results

MAGENTA achieved a flawless 100% accuracy across all evaluated benchmarks (AIME 2025, AIME 2026, and HMMT Feb 2026) using various LLM backends (including K2-Horizon, Qwen, and GPT variants).

When paired with the open-weight K2-HORIZON-7B model as the reasoner, MAGENTA successfully solved all six problems of the IMO 2026. To the authors' knowledge, this is the smallest reported reasoner to achieve a perfect score on the IMO.

Furthermore, MAGENTA proved highly robust against data leakage concerns; when evaluated on answer-preserving paraphrases of the problems, standalone reasoners saw performance drops of up to 10%, while MAGENTA maintained its 100% success rate.

Figure 2: Self-corrections required by K2- HORIZON-7B+MAGENTA on IMO 2026.

Limitations and Future Work

Despite its perfect verification scores, the authors note a lingering "soft" dependency: the Statement Judge itself is an LLM. While judging alignment is an easier task than generating formal statements, it means the final guarantee relies on a learned proxy rather than an absolute mathematical guarantee.

Additionally, for multi-step proof problems like the IMO, a gap remains between achieving formal correctness in the Lean kernel and producing a fully aligned, easily communicable natural-language explanation. Future work will focus on tightening autoformalisation accuracy and exploring the theoretical limits of mistake-bound learning models in agentic loops.

Summary updated

BibTeX
@misc{leang2026magenta,
  author = {Joshua Ong Jun Leang and Haonan Li and Zheng Zhao and Xinyi Shang and Wenda Li and Zhengzhong Liu and Erix Xing and Shay Cohen and Eleonora Giunchiglia},
  title = {{Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification}},
  year = {2026},
  eprint = {2609.11319},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.11319},
}
Figure