Research

MachinoAI Research

IMPORTANTAI Agents

Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification

A training-free agentic loop uses Lean verification as feedback to repair mathematical reasoning and formal proof generation.

Joshua Ong Jun Leang, Haonan Li, Zheng Zhao, Xinyi Shang, Wenda Li, Zhengzhong Liu, Eric Xing, Shay Cohen, Eleonora GiunchigliaSep 10, 2026arXiv preprint12 min read
AI AgentsLLM AgentsFormal VerificationLean 4Mathematical ReasoningAutoformalizationTest-Time Scalingverification-guided reasoningstatement adjudicationerror attribution

TL;DR

Magenta reports 100% on AIME 2025, AIME 2026, and HMMT February 2026, and all six IMO 2026 problems with K2-Horizon-7B.

Why It Matters

The engineering lesson is to make verification a control signal inside the agent loop while separating semantic statement faithfulness from deterministic proof checking.

Research Brief

The shortest useful explanation.

Magenta reports 100% on AIME 2025, AIME 2026, and HMMT February 2026, and all six IMO 2026 problems with K2-Horizon-7B.

verification-guided reasoningstatement adjudicationerror attributionmachine-checked proofagentic theorem provingLLM AgentsFormal VerificationLean 4

Core Explanation

We introduce Magenta, a training-free agentic pipeline that produces an answer, expresses it as a Lean 4 statement, and constructs a machine-checked proof. A statement judge checks whether the formalisation preserves the original problem, while an error-attribution judge routes failures to mathematical re-derivation or local Lean repair.

Why It Matters

The engineering lesson is to make verification a control signal inside the agent loop while separating semantic statement faithfulness from deterministic proof checking.

Magenta pipeline from natural-language problem through reasoning, Lean formalisation, statement adjudication, proof verification and error-attribution feedback.

Figure 1 — Magenta pipeline

Original paper architecture diagram showing reasoning, Lean formalisation, statement adjudication, proof verification and error-attribution feedback.

Section 01

Problem

01 The Problem

Natural-language mathematical reasoning can be persuasive while still containing silent errors. Formal theorem proving provides deterministic proof checking, but conventional formal benchmarks often assume the theorem statement is already correct. Magenta targets the missing bridge: derive an answer, formalise the problem, check statement faithfulness, prove it in Lean, and route failures to the component that should be repaired.

1Informal reasoning is not a deterministic correctness guarantee.2Lean cannot tell whether a generated theorem faithfully represents the natural-language problem.3A failed proof does not by itself identify mathematical versus implementation error.

Section 02

How It Works

03 How It Works

The loop is reason -> formalise -> adjudicate -> prove -> verify -> attribute -> repair. Syntax failures regenerate the Lean proof while holding mathematical content fixed. Math failures return verification feedback to the reasoner for re-derivation. Rejected formal statements are resampled before proof search.

1Reasoner maps problem and feedback to reasoning and answer.2Formaliser maps problem and answer to a Lean statement.3Verifier is deterministic for the accepted statement.4Judges provide probabilistic semantic and failure-routing decisions.

Section 03

Architecture

05 Architecture

Magenta separates Reasoner, Formaliser, Prover, Verifier and Judge roles. The Judge implements statement adjudication and error attribution. SafeVerify rejects forbidden constructs such as sorry, admit, native_decide and undeclared axioms.

1Input: natural-language competition problem.2Artifacts: reasoning, answer, Lean statement, Lean proof and diagnostics.3Output: machine-checked proof and answer subject to statement-faithfulness judging.

Section 04

Experiments

06 Experiments

The main evaluation covers 93 problems from AIME 2025, AIME 2026 and HMMT February 2026. Claude Opus 5, Gemini 3.7 Flash and Kimi K3 are answer-only pass@1 baselines. K2-Horizon-7B rises from 74.19% overall to 100.00% with Magenta (+25.81); K2-Horizon-375B from 84.95% to 100.00% (+15.05); Qwen3.8-27B from 91.40% to 100.00% (+8.60); GPT-5.6-Sol (Codex) from 84.95% to 100.00% (+15.05). K2-Horizon-7B + Magenta solves all six IMO 2026 problems. On paraphrased AIME 2026, K2-Horizon-7B and K2-Horizon-375B with Magenta remain at 100.0%; standalone models fall to 70.0% and 86.7%. The 7B model averages 5 correction rounds on AIME 2026 and 5.7 on IMO 2026 versus 2 for 375B on AIME 2026.

1Datasets: AIME 2025, AIME 2026, HMMT February 2026; 93 total.2Baselines: Claude Opus 5, Gemini 3.7 Flash, Kimi K3.3Verification: Lean 4 with SafeVerify.

Formulas

Error routing

ell=textscSyntaxRightarrowpi′simP(q,c,s,epsilon),qquadell=textscmathRightarrow(c′,a′)simR(q,varphi)\\ell=\\textsc{Syntax}\\Rightarrow \\pi'\\sim P(q,c,s,\\epsilon),\\qquad \\ell=\\textsc{math}\\Rightarrow (c',a')\\sim R(q,\\varphi)

Syntax failures trigger local proof regeneration; mathematical failures trigger new reasoning conditioned on verification feedback.

creasoning chain
qproblem
sLean statement
piproof
phimath feedback
epsilondiagnostic

Statement adjudication

Js(q,a,s)in0,1J_s(q,a,s)\\in\\{0,1\\}

The statement judge accepts or rejects whether the generated Lean statement faithfully represents the original problem and answer.

aanswer
qproblem
sLean statement

Related Research

References