smollm3-3b-gsm8k-sft
SmolLM3-3B-Base fine-tuned for grade-school math word problems with supervised fine-tuning (LoRA, merged) on the GSM8K train split. Built for Unit 1 (Instruction Tuning) of the Hugging Face smol course.
The model answers in short step-by-step reasoning and ends with The final answer is N.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "INSTANTDOOM/smollm3-3b-gsm8k-sft"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "A baker makes 24 muffins and sells 3 boxes of 6. How many are left?"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
Training
| Base model | HuggingFaceTB/SmolLM3-3B-Base |
| Tokenizer / chat template | HuggingFaceTB/SmolLM3-3B (ChatML, EOS `< |
| Data | GSM8K main train: 7,273 train / 200 held out |
| Format | Conversational prompt/completion; loss on completion only |
| Preprocessing | Calculator annotations (<<...>>) removed; #### N rewritten as The final answer is N. |
| Method | LoRA r=16, alpha=32, dropout 0.05, all linear layers; merged into base weights |
| Optimization | lr 2e-4, cosine schedule, 5% warmup, effective batch 16, 1 epoch(s), max length 1024, bf16, gradient checkpointing |
| Hardware | 1x NVIDIA A10G (Hugging Face Jobs) |
| Framework | TRL SFTTrainer, PEFT, Transformers |
In a 2-epoch trial run, held-out loss stopped improving after the first epoch while training loss kept falling, so the final model uses 1 epoch.
Evaluation
| Benchmark | Score |
|---|---|
| GSM8K (test, 0-shot) | 62.00% |
Evaluated with lighteval (vLLM backend), task lighteval|gsm8k|0|0:
hf jobs uv run --flavor a10g-large --timeout 1h --secrets HF_TOKEN \
--with "lighteval[vllm]" --with "huggingface_hub<1.0" \
lighteval vllm "model_name=INSTANTDOOM/smollm3-3b-gsm8k-sft" "lighteval|gsm8k|0|0" \
--push-to-hub --results-org INSTANTDOOM
Raw results: INSTANTDOOM/
Limitations
- Specialized for GSM8K-style arithmetic word problems. General chat, coding and multilingual ability are not trained and may be weaker than the official SmolLM3-3B instruct model.
- Single-pass reasoning with no self-verification; multi-step arithmetic errors still occur.
- No safety or preference alignment beyond what the base model has.
License
Apache 2.0, following the base model. GSM8K is released under the MIT license.