Training reasoning ability into a small model from scratch with reinforcement learning is expensive and finicky. The distillation shortcut — let a bigger model do the hard reasoning work once, capture its chain-of-thought as training data, then SFT a small model to imitate that pattern — is both cheaper and, per DeepSeek's own published results, more effective for small models specifically.
Generating and training on synthetic reasoning traces
1. Generate traces with a strong reasoning model. Prompt a capable reasoning model (locally via Ollama, or through an API) to solve problems representative of your target task step-by-step, and save the full chain-of-thought plus final answer as your training examples.
2. Format the traces as SFT training data. Each example becomes a prompt/completion pair where the completion is the full reasoning trace, not just the final answer — the model needs to learn the reasoning process, not memorize outputs.
3. Fine-tune the student model with Unsloth's QLoRA pipeline. Unsloth wraps 4-bit QLoRA training with kernel optimizations that reduce both VRAM use and wall-clock time versus a standard Hugging Face PEFT training loop, making this practical on a single consumer GPU.
# SFT a small student model on synthetic reasoning traces, via Unsloth
from unsloth import FastLanguageModel
from trl import SFTTrainer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="unsloth/Qwen2.5-7B-bnb-4bit",
max_seq_length=4096,
load_in_4bit=True,
)
# Add LoRA adapters -- only these small matrices get trained
model = FastLanguageModel.get_peft_model(
model, r=16, lora_alpha=16,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
)
# reasoning_traces_dataset: prompt + full CoT trace as completion
trainer = SFTTrainer(model=model, tokenizer=tokenizer, train_dataset=reasoning_traces_dataset)
trainer.train()
| Approach for Small-Model Reasoning | Result (per DeepSeek-R1 report) |
|---|---|
| Apply RL directly to the small model | Weaker — small models struggle to discover reasoning patterns via RL alone |
| SFT the small model on a larger model's synthetic reasoning traces | Stronger — the small model imitates already-discovered reasoning patterns |
The practical takeaway isn't just "distillation works" — it's that for a small model specifically, imitating a larger model's reasoning traces is the higher-leverage move compared to trying to train reasoning ability into it directly. That's exactly the workflow Unsloth's QLoRA tooling is built to make affordable on local hardware.
Practical Challenge
Generate 20 chain-of-thought traces from a reasoning model for a task you care about (e.g., math word problems), format them as prompt/completion pairs, and run a short Unsloth QLoRA fine-tune on a small student model.
Concept Check
Sources & Further Reading
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (arXiv:2501.12948) — Section 2.4 describes the 800k-sample (~600k reasoning + ~200k non-reasoning) distillation used to train the small Qwen/Llama variants via SFT only.
- Unsloth (GitHub) — the open-source QLoRA fine-tuning library used above to train the student model efficiently on consumer GPU hardware.
AI