smol-sft-test
HuggingFaceTB/SmolLM2-360M fine-tuned with supervised fine-tuning (TRL) on grade-school math word problems. Made for the Hugging Face smol-course, Unit 1 final project.
Results
| Benchmark | Setting | Metric | Score |
|---|---|---|---|
| GSM8K (1,319 test questions) | zero-shot, greedy | extractive_match | 20.4% ± 1.1 |
GSM8K, base model HuggingFaceTB/SmolLM2-360M (baseline) | zero-shot, greedy | extractive_match | 3.0% ± 0.5 |
SFT improved GSM8K accuracy about sevenfold over the base model (3.0% to 20.4%). Both numbers use the same lighteval command and settings. For comparison, an earlier version of this repo (SFT on 2,000 Capybara chat examples, no math data) scored 3.18% on the same benchmark. Per-example outputs are in ShadyAdham0/details_ShadyAdham0__smol-sft-test (use the newest run, 2026-11-06).
Evaluation command (lighteval, Kaggle T4):
lighteval accelerate "model_name=ShadyAdham0/smol-sft-test" "gsm8k|0" --push-to-hub --results-org ShadyAdham0 --public-run --save-details
Usage
The model was trained on a plain prompt format, not a chat template. Use it like this:
from transformers import pipeline
pipe = pipeline("text-generation", model="ShadyAdham0/smol-sft-test", device_map="auto")
prompt = "Question: Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?\nAnswer:"
print(pipe(prompt, max_new_tokens=256, do_sample=False, return_full_text=False)[0]["generated_text"])
The model writes its reasoning and ends with #### <number>, then stops.
Training details
- Base model: HuggingFaceTB/SmolLM2-360M
- Method: full-parameter SFT with TRL
SFTTrainer, loss on the completion only - Data: GSM8K train (7,473 examples, calculator annotations
<<...>>removed) + 20,000 GSM-derived examples from MetaMathQA (answers converted to the#### Nformat), shuffled - Format: prompt
Question: {question}\nAnswer:, completion{reasoning}\n#### {answer}plus EOS - Hyperparameters: 2 epochs (1,718 steps), effective batch size 32 (8 x 4 accumulation), learning rate 2e-5 with cosine schedule and 50 warmup steps, max length 512, fp16 mixed precision, gradient checkpointing
- Hardware: one Kaggle T4, about 94 minutes
- Final training loss: about 0.29
Limitations
- A 360M model; 20% on GSM8K means most multi-step problems are still answered wrongly. Arithmetic errors are common.
- Trained for one task format. Chat-style prompts, other languages and non-math tasks are unsupported and will likely perform worse than the base model.
- GSM8K train is part of the training data; the GSM8K test set was not used for training. MetaMathQA is derived from the GSM8K and MATH training sets, but possible overlap with test items was not checked.
- Not safety-tuned. Do not rely on its answers for anything important.