l3lab/llmlean-optimize-9B-v0.1
Lean 4 proof optimization adapter
2 min readupdated
The new l3lab/llmlean-optimize-9B-v0.1 model is a LoRA adapter (a small add-on over a base model) for the Qwen/Qwen3.5-9B language model. Trained using distillation and expert iteration, it specializes in shortening and optimizing mathematical proofs in the Lean 4 formal mathematics system. The model targets developers and researchers working with formal proofs, helping make them shorter and more efficient without losing rigor.
Key features
- Trained on 4,043 Lean-verified rewrite examples from Mathlib, Tau Ceti, Compfiles, Batteries, and CSLib.
- Used expert iteration with the selection of 17,749 successful improvements from nearly 40,000 theorems.
- Demonstrates an increase in the share of successful and shorter proofs (Greedy 18.5% vs. 1.6% for the base model).
- Built on top of the
Qwen3.5-9Barchitecture using thepeftlibrary.
What you can do
- Apply the adapter paired with
Qwen3.5-9Bto automatically shorten and simplify bulky Lean 4 proofs. - Integrate the model into formal verification environments to find more elegant proof paths for theorems.
- Test the generation of proof variants with
pass@8andpass@32parameters for complex mathematical modules.
Example
Example code for loading the adapter and base model:
import torch
from peft import PeftModel
from transformers import AutoTokenizer, Qwen3_5ForConditionalGeneration
repo = "l3lab/llmlean-optimize-9B-v0.1"
tokenizer = AutoTokenizer.from_pretrained(repo)
base = Qwen3_5ForConditionalGeneration.from_pretrained(
"Qwen/Qwen3.5-9B",
revision="c202236235762e1c871ad0ccb60c8ee5ba337b9a",
dtype=torch.bfloat16,
)
model = PeftModel.from_pretrained(base, repo).eval()Read more
DetailsBenchmarks (greedy / pass@32): Qwen3.5-9B base (0.2% / —), Distilled Qwen (9.6% / 37.7%), llmlean-optimize-9B-v0.1 (18.5% / 43.1%).
Validation was performed on 427 theorems from 211 Lean modules excluded from the training set.
Requires the Qwen3.5-9B base model and dtype=torch.bfloat16 support.










Comments