SmolLM3-3B · SFT → DPO (smol course)
A 3B chat model built in two stages as my project for the Hugging Face smol course:
HuggingFaceTB/SmolLM3-3B-Base
└─ SFT → Yousuf-Idrees-135/smollm3-3b-math-sft (Unit 1: instruction tuning)
└─ DPO → Yousuf-Idrees-135/smollm3-dpo-aligned (Unit 2: preference alignment) ← this model
- Developed by: Yousuf Idrees (@Yousuf-Idrees-135)
- Model type: Decoder-only causal LM (SmolLM3 architecture), 3B parameters
- Language: English
- License: Apache 2.0 (inherited from SmolLM3)
- Finetuned from:
Yousuf-Idrees-135/smollm3-3b-math-sft
Quick start
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Yousuf-Idrees-135/smollm3-dpo-aligned"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
msgs = [{"role": "user", "content": "How should I handle a disagreement with a friend?"}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=300)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
⚠️ Use bf16 or fp32. In pure fp16 (e.g. on a T4), activations overflow and generation degenerates into repeated tokens.
Training
Stage 1: SFT
LoRA SFT of SmolLM3-3B-Base on 3,000 MetaMathQA examples from HuggingFaceTB/smoltalk, trained on a Colab T4. Scored 0.740 on GSM8K (0-shot, full test set). Details: smollm3-3b-math-sft.
Stage 2: DPO (this repo)
Direct Preference Optimization with TRL's DPOTrainer + LoRA, trained on a free Kaggle T4.
| Setting | Value |
|---|---|
| Preference data | Anthropic/hh-rlhf, 2,000 shuffled pairs (seed 42) |
| Method | DPO, β = 0.1 |
| LoRA | r = 16, alpha = 32, dropout 0.05, all linear layers (merged into the weights after training) |
| Learning rate | 5e-5, cosine schedule, 20 warmup steps |
| Batch | 1 × 8 gradient accumulation (effective 8) |
| Steps | 200 (~0.8 epoch over the 2k subset) |
| Max length | 512 tokens |
| Precision | fp16 mixed, gradient checkpointing |
| Hardware | 1× NVIDIA T4 16GB (Kaggle), ~30 min |
Training loss moved from 0.693 (no preference) to ~0.67–0.70 and the reward accuracy averaged above 0.5. This is a light alignment pass, not a full DPO run.
Evaluation
LightEval 0.10, accelerate backend, fp32, 0-shot, first 200 samples per task (subset because of T4 compute limits, so expect roughly ±3% noise).
| Benchmark | Metric | Score |
|---|---|---|
| ARC-Challenge | acc / acc_norm | 0.51 / 0.57 |
| HellaSwag | acc / acc_norm | 0.58 / 0.76 |
| TruthfulQA (MC) | mc1 / mc2 | 0.325 / 0.512 |
For comparison, DPO applied directly to the official instruct model HuggingFaceTB/SmolLM3-3B (same settings) scored TruthfulQA mc1/mc2 = 0.415 / 0.605. The math-focused SFT stage appears to reduce TruthfulQA, and this short DPO run doesn't recover it.
Raw results: details_Yousuf-Idrees-135__smollm3-dpo-aligned_private (private).
Leaderboard submission: smol-course/leaderboard PR #106.
Limitations
- Course project, not production-ready. The DPO pass is small (200 steps on 2k pairs), so alignment gains are modest.
- The training data is English-only, and the model inherits the biases of SmolLM3 and
hh-rlhf. - Benchmarks use 200-sample subsets and are noisier than full evaluations.
- The model may emit a
<think>reasoning block before answering, inherited from SmolLM3.