QED-Nano SFT is a 4B parameter mathematical reasoning model fine-tuned on olympiad-level proof problems. This is the supervised fine-tuning (SFT) checkpoint trained via knowledge distillation from
deepseek-ai/DeepSeek-Math-V2 (685B parameters). The model generates mathematical proofs with explicit chain-of-thought reasoning enclosed in
<think> tags.
This model serves as the foundation for the full QED-Nano pipeline, which includes subsequent reinforcement learning and reasoning cache extensions. For the complete trained model, see
lm-provers/QED-Nano.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "lm-provers/QED-Nano-SFT"
4device = "cuda" # for GPU usage or "cpu" for CPU usage
5
6# load the tokenizer and the model
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10).to(device)
11
12# prepare the model input
13prompt = "Generate a rigorous proof to the following question: is \sqrt{2} rational or irrational?"
14messages_think = [
15 {"role": "user", "content": prompt}
16]
17
18text = tokenizer.apply_chat_template(
19 messages_think,
20 tokenize=False,
21 add_generation_prompt=True,
22)
23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
25# Generate the output
26generated_ids = model.generate(**model_inputs, max_new_tokens=32768)
27
28# Get and decode the output
29output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :]
30print(tokenizer.decode(output_ids, skip_special_tokens=True))
You can use vLLM and SGLang to deploy the model in an API compatible with OpenAI format.
In this section, we report the evaluation results of QED-Nano on IMO-ProofBench, ProofBench, and IMO-AnswerBench. All evaluations except those on IMO-AnswerBench are reported as avg@3 unless stated otherwise.
Note: This is the SFT-only checkpoint. Performance improves significantly with RL training and reasoning cache. See the full
lm-provers/QED-Nano model for complete results.
1from datasets import load_dataset
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from trl import SFTConfig, SFTTrainer
4
5# Load model and tokenizer
6model = AutoModelForCausalLM.from_pretrained(
7 "Qwen/Qwen3-4B-Thinking-2507",
8 torch_dtype="auto",
9 attn_implementation="kernels-community/vllm-flash-attn3",
10)
11tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B-Thinking-2507")
12
13# Load dataset
14dataset = load_dataset("lm-provers/Olympiads-SFT", split="train")
15
16# Training configuration
17training_args = SFTConfig(
18 output_dir="./qed-nano-sft",
19 max_steps=620,
20 per_device_train_batch_size=2,
21 gradient_accumulation_steps=2,
22 learning_rate=3.0e-5,
23 lr_scheduler_type="cosine",
24 warmup_ratio=0.03,
25 max_length=45056,
26 bf16=True,
27 gradient_checkpointing=True,
28 logging_steps=1,
29 save_steps=62,
30 push_to_hub=True,
31)
32
33# Train
34trainer = SFTTrainer(model=model, tokenizer=tokenizer, args=training_args, train_dataset=dataset)
35trainer.train()
QED-Nano SFT is a supervised fine-tuning checkpoint with several important limitations:
-
Length Explosion: This SFT-only model suffers from uncontrolled reasoning length growth. It frequently generates responses exceeding 100k tokens, often meandering or repeating steps without converging to a solution. This is a known limitation of pure supervised learning on long-form reasoning tasks.
-
Correctness Issues: While the model produces fluent mathematical text, it may generate incorrect proofs. The SFT stage does not directly optimize for correctness—only for imitating the teacher's reasoning style.
-
No Self-Correction: Unlike the full QED-Nano model with RL training, this checkpoint lacks the ability to verify and refine its solutions.
These models should be used as assistive tools rather than definitive sources of information. Users should always verify important information and critically evaluate any generated content.
1@model{qed_nano_sft_2026,
2 title={QED-Nano SFT: Distilling Olympiad Mathematical Reasoning to 4B Parameters},
3 author={Edward Beeching and Jasper Dekoninck and Jia Li and Yuxiao Qu and Amrith Setlur and Ian Wu and Aviral Kumar and Lewis Tunstall},
4 year={2026},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/lm-provers/QED-Nano-SFT}}
7}
1@dataset{fineproofs_sft_dataset_2026,
2 title={FineProofs SFT Dataset: Mathematical Olympiad Problems with Chain-of-Thought Reasoning},
3 author={Edward Beeching and Jasper Dekoninck and Jia Li and Yuxiao Qu and Amrith Setlur and Ian Wu and Aviral Kumar and Lewis Tunstall},
4 year={2026},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/datasets/lm-provers/FineProofs-SFT}}
7}