qwen3-1.7b-base-gsm8k-opd
Qwen/Qwen3-1.7B-Base post-trained for grade-school math (GSM8K) in a one-day course on post-training
beyond SFT with Hugging Face TRL. GSM8K test accuracy: 80.1% (greedy, exact match on the
#### <number> line, 1,319 questions).
Data
GSM8K (openai/gsm8k, main). SFT warm-up: 1,500 human solutions (train[2000:3500]). On-policy distillation: prompts only from train[:2000] (40 steps x 32 questions = 1,280 questions); no reference solutions are used, the teacher scores the student's own answers.
Method
Two stages. (1) LoRA SFT of Qwen3-1.7B-Base on human solutions (1 epoch, lr 2e-4). (2) Fully on-policy distillation from Qwen/Qwen3-8B (thinking off) with TRL DistillationTrainer: the student samples answers (vLLM, max 256 tokens, T=1.0), the frozen teacher scores every token, loss = per-token reverse KL (beta=1.0); LoRA rank 16, lr 5e-5, 40 steps, 4x A40, ~3 min.
Every method in the course started from the same LoRA-SFT checkpoint (1,500 GSM8K human solutions) and used LoRA (rank 16, all linear layers) with deliberately short runs (~5-10 min). The adapter is merged into the weights, so no PEFT is needed to load this model.
Evaluation
vLLM, same prompt for every model, greedy decoding, max 512 new tokens, full GSM8K test set.
Teacher used as a reference / for distillation: Qwen/Qwen3-8B (thinking off).
| model | test acc (greedy, 512 tok) | ±95% CI | acc within 256 tok | format | incl. boxed | avg tokens | pass@1 (T=0.7) | pass@8 | train GPU-min |
|---|---|---|---|---|---|---|---|---|---|
| base | 15.7% | ±2.0% | 12.3% | 77.9% | 17.5% | 177 | - | - | 0.0 |
| sft | 67.3% | ±2.5% | 67.1% | 99.3% | 67.3% | 95 | 60.5% | 91.7% | 3.0 |
| dpo | 68.3% | ±2.5% | 68.1% | 99.5% | 68.3% | 95 | 60.9% | 93.0% | 13.1 |
| grpo | 70.5% | ±2.5% | 70.4% | 99.8% | 70.5% | 96 | 66.2% | 93.7% | 20.9 |
| grpo-hack | 72.3% | ±2.4% | 63.2% | 98.9% | 72.3% | 187 | - | - | 7.2 |
| opd | 80.1% | ±2.2% | 52.5% | 98.6% | 80.1% | 247 | 81.5% | 93.3% | 11.9 |
| teacher | 92.6% | ±1.4% | 51.1% | 98.3% | 92.9% | 262 | - | - | 0.0 |
Training curves, eval runs and sample outputs: W&B.
Prompt format
Qwen3 chat template with thinking disabled (enable_thinking=False):
messages = [{"role": "system", "content": 'You are a helpful assistant.'},
{"role": "user", "content": 'Solve the following math problem. Reason step by step, then give the final answer on its own line in the form "#### <number>".\n\nProblem: {question}'.format(question=question)}]
Stop on <|im_end|>.
Limitations
Small, short training runs on English grade-school arithmetic only; not a general chat model, no safety tuning beyond the base model; it still makes arithmetic mistakes.