Run this model with HF Jobs

Run jgalego/hilbert-prover-8b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/jgalego/hilbert-prover-8b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/jgalego/hilbert-prover-8b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/jgalego/hilbert-prover-8b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/jgalego/hilbert-prover-8b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

hilbert-prover-8b

Hilbert logo: a halftone portrait of David Hilbert in a panama hat, a grid of dots in cream, orange, magenta and violet

A Lean 4 prover for theorems in Physlib and CSLib, fine-tuned from Goedel-LM/Goedel-Prover-V2-8B. The base model was trained on competition maths with Lean 4.9; this one was trained on the proofs in Physlib and CSLib, which build with Lean 4.34 and later.

It is weaker than the base model on miniF2F (0.307 against 0.449) and VERINA (0.048 against 0.115), so use Goedel-Prover-V2-8B for competition maths and verified code.

🚀 Usage

The prompt is the one Goedel-Prover-V2-8B was trained on: a Lean file ending in a theorem whose proof is sorry.

from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "jgalego/hilbert-prover-8b"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype="auto", device_map="auto")

code = """import Mathlib

theorem two_mul_le (n : ℕ) : n ≤ 2 * n := by
  sorry
"""
prompt = "Complete the following Lean 4 code:\n\n```lean4\n{}```\n\nBefore producing the Lean 4 code to formally prove the given theorem, provide a detailed proof plan outlining the main proof steps and strategies.\nThe plan should highlight key ideas, intermediate lemmas, and proof structures that will guide the construction of the final formal proof."
messages = [{"role": "user", "content": prompt.format(code)}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)
out = model.generate(**inputs, max_new_tokens=32768, do_sample=True, temperature=0.6, top_p=0.95)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1] :], skip_special_tokens=True))

The answer ends in a lean4 block with the full proof. Check it with Lean before trusting it.

🏋️ Training

LoRA (r=16, alpha=32, all linear layers), merged into the base weights, on the 10,371 training theorems of jgalego/hilbert-libraries: 2 epochs at learning rate 0.0001, 4.6 h on an NVIDIA RTX PRO 6000 Blackwell Server Edition. The completions carry no proof plan, so the model learns to answer with an empty <think> block and go straight to the proof.

📊 Results

A proof counts only if the file compiles and #print axioms shows nothing beyond propext, Classical.choice and Quot.sound. Four samples per theorem at temperature 0.6.

Theorems from the modules held out of the training data:

Model Library Theorems pass@1 pass@4
Goedel-LM/Goedel-Prover-V2-8B cslib 283 0.101 0.205
Goedel-LM/Goedel-Prover-V2-8B physlib 972 0.106 0.195
jgalego/hilbert-prover-8b@sft-a cslib 283 0.306 0.399
jgalego/hilbert-prover-8b@sft-a physlib 972 0.237 0.311

Theorems added to Physlib after training. They come from 511abd5 (2026-12-01) and share no name or statement with anything at the training commit, d630c36 (2026-10-02). They are checked on Lean v4.36.0, and the library's own proof of each compiles. Up to 8,192 new tokens; a response cut off at the limit scores nothing. Plain automation is one fixed answer for every theorem, first | rfl | simp | grind | aesop | simp_all | norm_num | omega | linarith | positivity, which closes 194 of 1,251. The last column is pass@1 on the 1,057 it leaves open.

Model pass@1 pass@4 Difference to base pass@1 where automation fails Cut off
Goedel-LM/Goedel-Prover-V2-8B 0.117 0.230 n/a 0.075 33%
jgalego/hilbert-prover-8b@sft-a 0.310 0.362 +0.193 ± 0.011 0.216 1%
Plain automation, no model 0.155 n/a +0.038 ± 0.010 0.000 0%

The difference is the mean over theorems of the pass-rate gap to the base model, with its standard error.

⚠️ Limitations

  • It answers without reasoning and does best on short proofs; the gain over the base model shrinks as proofs get longer.
  • Trained on fixed library commits. On the newer Physlib theorems, 34% of its failed samples cite an unknown name, against 32% for the base model.
  • Scored on single theorems, not whole projects.

Logo: a portrait of David Hilbert from before 1912 (public domain, photographer unknown, retouched postcard on Wikimedia Commons), redrawn as a grid of dots and recoloured.

Downloads last month
268
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jgalego/hilbert-prover-8b

Finetuned
Qwen/Qwen3-8B
Finetuned
(7)
this model
Quantizations
1 model

Dataset used to train jgalego/hilbert-prover-8b

Collection including jgalego/hilbert-prover-8b