Qwen2.5-7B-Math-QFFT-R1
a model for solving complex math problems
2 min readupdated
This is a full-parameter fine-tune (updating all weights) of the base Qwen2.5-7B-Instruct model, trained on 1,000 high-quality DeepSeek-R1 math reasoning trajectories. It excels at Olympiad-level and complex math with a solid boost in accuracy, while keeping responses concise on simpler benchmarks like GSM8K—unlike standard full SFT (supervised fine-tuning). It is a great fit for researchers and engineers who need a capable, relatively compact LLM for mathematical computations.
Key features
- Accuracy boost: Delivers a +7.56 pp gain on a 100-problem Olympiad benchmark over the base model.
- Inference-ready config: Pre-configured to use caching out of the box for faster decoding.
- Consistent performance: Matches the results of official QFFT repositories with less verbose output.
- Plug-and-play setup: Fully compatible with standard libraries like transformers and vLLM.
What you can do
- Solve Olympiad math: Use the model for automated, step-by-step breakdowns of complex equations and competition problems.
- Build a math bot: Deploy it via vLLM or Hugging Face Transformers to power a STEM assistant.
- Run benchmarks: Evaluate its accuracy against your own custom math test suites.
- Pair with adapters: Combine it with a companion LoRA adapter to further customize generation.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "XDE10/Qwen2.5-7B-Math-QFFT-R1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
{"role": "user", "content": "Find all real values of x such that x^2 - 5x + 6 = 0."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=4096,
do_sample=True,
temperature=0.6,
top_p=0.95,
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Read more
DetailsBenchmarks: Comp100 — 33.63% (+7.56 pp vs. base), MATH-500 — 80.50%, GSM8K — 91.43%.
Hardware: Trained on a single GPU with 96 GB VRAM using DeepSpeed ZeRO-2 CPU Offload.
Limitations: Strictly specialized in math reasoning; general instruction following outside of math has not been tested.
License: Apache 2.0 (inherited from the base Qwen model).










Comments