Hilbert: Recursively Building Formal Proofs with Informal Reasoning

Sumanth Varambally, Thomas Voice, Yanchao Sun, Zhifeng Chen, Rose Yu, Ke Ye

TL;DR

HILBERT is a novel multi-agent framework that bridges the gap between informal mathematical reasoning and formal proof verification in Lean 4. By recursively decomposing complex mathematical problems into simpler subgoals and leveraging real-time verifier feedback, HILBERT achieves a groundbreaking 70.0% success rate on the ultra-challenging PutnamBench, vastly outperforming both open-source baselines and proprietary systems.

What Problem Does This Paper Address?

While large language models (LLMs) have gotten remarkably good at solving high-school and college-level math problems in natural language, they suffer from a fatal flaw: they frequently hallucinate, introducing subtle logical fallacies or calculation errors that are difficult to detect automatically.

To guarantee absolute correctness, researchers use formal theorem provers like Lean 4, which mathematically verify every step of a proof. However, specialized "prover LLMs" trained on formal code are brittle and struggle with the high-level conceptual planning required for complex problems. Conversely, general-purpose reasoning LLMs can sketch out a proof but fail at the rigorous syntax required by formal verifiers. HILBERT addresses this gap by combining the intuitive, informal reasoning of general LLMs with the precise, tactical execution of formal provers.

Methods

HILBERT orchestrates a multi-turn agentic workflow using four core components:

  1. An Informal Reasoner: A general-purpose LLM (like Gemini 2.5 Pro) that excels at conceptual mathematical planning and error interpretation.
  2. A Formal Prover: A specialized LLM (like Goedel-Prover-V2) optimized for generating Lean 4 tactics.
  3. A Verifier: The Lean 4 compiler, providing ground-truth correctness feedback.
  4. A Retriever: A semantic search engine that finds relevant theorems within Lean's standard library (Mathlib).
Figure 1: The HILBERT algorithm. Given a target theorem, HILBERT attempts formal proof generation with the prover. Upon failure, it decomposes the problem into subgoals and tries to solve them with the prover, followed by the reasoner (shallow solve). If both strategies fail, it resorts to recursive decomposition until all subgoals are resolved.

When given a target theorem, HILBERT first attempts a direct proof using the Prover. If that fails, it initiates a Subgoal Decomposition phase:

  • The Reasoner generates an informal proof strategy and translates it into a Lean 4 proof sketch using sorry placeholders for unproven steps.
  • These subgoals are extracted into independent theorem statements.
  • HILBERT then attempts to solve each subgoal using a two-stage approach: a direct Prover attempt, followed by a "shallow solve" fallback with the Reasoner if the Prover fails.
  • If a subgoal remains unsolved, the framework recursively decomposes it further (up to a maximum depth $D$), breaking the problem down until every piece can be formally verified.
Figure 2: Subgoal Decomposition: Given a theorem statement, HILBERT: (1) retrieves relevant theorems from Mathlib using semantic search, (2) generates a formal proof sketch with subgoals marked as have statements with sorry placeholders, (3) extracts these subgoals as independent theorem statements, and (4) assembles the proof by replacing sorry placeholders with calls to the subgoal theorems. Verifiers ensure correctness at each stage. The error correction loops are indicated by dotted lines.

Datasets

The authors evaluated HILBERT on two primary benchmarks:

  • miniF2F-Test: A benchmark consisting of 244 competition-level math problems drawn from the AMC, AIME, and IMO.
  • PutnamBench: A highly demanding benchmark containing 660 undergraduate-level problems from the prestigious William Lowell Putnam Mathematical Competition (evaluated on the September 2025 version).

Key Insights and Ideas

  • Bypassing Context Limits via Modularization: Traditional LLMs struggle to generate long formal proofs because errors compound over extended contexts. HILBERT's recursive decomposition acts as a divide-and-conquer strategy, allowing it to generate proofs spanning thousands of lines of code by isolating individual subproblems.
  • The Reasoner is the Captain: Interestingly, the choice of the informal reasoner model matters more than the strength of the formal prover. Upgrading from Gemini 2.5 Flash to Pro yielded a larger performance boost than switching between different formal prover models.
  • Retrieval Saves Compute: Integrating a semantic theorem retriever does more than just boost accuracy; it significantly reduces inference cost. By surfacing the exact theorem names from Mathlib, it prevents the models from wasting compute cycles guessing syntax or failing due to minor naming mismatches.

Key Results

HILBERT achieved state-of-the-art performance across both evaluated datasets:

miniF2F

When paired with Gemini 2.5 Pro and Goedel-Prover-V2-32B, HILBERT achieved a 99.2% pass rate on miniF2F, setting a new record for publicly available methods and failing on only two problems.

Table 1: Results on the MiniF2F-Test dataset. Improvements shown in brackets for HILBERT are calculated relative to the pass@4 baseline for each prover family. Note: Delta Prover and Seed Prover are proprietary methods and not publicly available to use. Gemini 2.5 Pro result obtained from Zhou et al. (2025b)

PutnamBench

On the notoriously difficult PutnamBench, HILBERT solved 462 out of 660 problems (70.0%). This represents a massive 422% relative improvement over the best previous publicly available baseline (Goedel-Prover-V2 at 13.4%) and comfortably beats proprietary state-of-the-art systems like Google's SeedProver (50.4%).

PutnamBench dataset results comparison

Limitations and Future Work

The primary trade-off for HILBERT's high accuracy is its inference-time compute cost. Solving the most complex Putnam problems required millions of tokens and thousands of sequential LLM calls per sample, exhibiting a pronounced long-tail distribution where a few hard problems consumed the vast majority of resources.

For future work, the authors propose a "virtuous cycle": using the massive, verified formal proofs generated by HILBERT as training data to fine-tune and improve the base Prover and Reasoner models, ultimately making the entire pipeline faster and more computationally efficient.

Summary updated

Abstract

Large Language Models (LLMs) demonstrate impressive mathematical reasoning abilities, but their solutions frequently contain errors that cannot be automatically checked. Formal theorem proving systems such as Lean 4 offer automated verification with complete accuracy, motivating recent efforts to build specialized prover LLMs that generate verifiable proofs in formal languages. However, a significant gap remains: current prover LLMs solve substantially fewer problems than general-purpose LLMs operating in natural language. We introduce Hilbert, an agentic framework that bridges this gap by combining the complementary strengths of informal reasoning and formal verification. Our system orchestrates four components: an informal LLM that excels at mathematical reasoning, a specialized prover LLM optimized for Lean 4 tactics, a formal verifier, and a semantic theorem retriever. Given a problem that the prover is unable to solve, Hilbert employs recursive decomposition to split the problem into subgoals that it solves with the prover or reasoner LLM. It leverages verifier feedback to refine incorrect proofs as necessary. Experimental results demonstrate that Hilbert substantially outperforms existing approaches on key benchmarks, achieving 99.2\% on miniF2F, 6.6\% points above the best publicly available method. Hilbert achieves the \textbf{strongest known result} from a publicly available model on PutnamBench. It solves 462/660 problems (70.0\%), outperforming proprietary approaches like SeedProver (50.4\%) and achieving a 422\% improvement over the best publicly available baseline. Thus, Hilbert effectively narrows the gap between informal reasoning and formal proof generation. Code is available at https://github.com/Rose-STL-Lab/ml-hilbert.
BibTeX
@inproceedings{varambally2026hilbert,
  author = {Sumanth Varambally and Thomas Voice and Yanchao Sun and Zhifeng Chen and Rose Yu and Ke Ye},
  title = {{Hilbert: Recursively Building Formal Proofs with Informal Reasoning}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=GN8OdkTo3B},
}
Figure