smollm3-3b-sft-gsm8k
HuggingFaceTB/SmolLM3-3B-Base fine-tuned with QLoRA (4-bit base + LoRA adapters, TRL) on grade-school math word problems. Made for the Hugging Face smol-course, Unit 1 final project. The repo holds the merged fp16 weights; the LoRA adapter alone is in adapter/.
Results
| Benchmark | Setting | Metric | Score |
|---|---|---|---|
| GSM8K (1,319 test questions) | zero-shot, greedy | extractive_match | 75.8% ± 1.2 |
Per-example outputs: ShadyAdham0/details_ShadyAdham0__smollm3-3b-sft-gsm8k.
Evaluation command (lighteval, Kaggle T4):
lighteval accelerate "model_name=ShadyAdham0/smollm3-3b-sft-gsm8k" "gsm8k|0" --push-to-hub --results-org ShadyAdham0 --public-run --save-details
The untouched SmolLM3-3B-Base was not evaluated with this exact setup, so the gain from fine-tuning over the base model is not measured here. A 50-question partial check after only 10 training steps scored about 66% (large margin of error), which suggests the base model is already strong and the fine-tune mainly teaches the answer format.
Usage
The model was trained on a plain prompt format, not a chat template:
from transformers import pipeline
pipe = pipeline("text-generation", model="ShadyAdham0/smollm3-3b-sft-gsm8k", 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/SmolLM3-3B-Base, loaded in 4-bit NF4 (double quantization, fp16 compute)
- Method: QLoRA SFT with TRL
SFTTrainer, loss on the completion only. LoRA r=32, alpha=64, dropout 0.05, all linear layers (about 60M trainable parameters, 1.9% of the model); trainable weights kept in fp32 - Data: GSM8K train (7,473 examples, calculator annotations
<<...>>removed) + 20,000 GSM-derived examples from MetaMathQA (answers converted to the#### Nformat), shuffled; 1 epoch - Format: prompt
Question: {question}\nAnswer:, completion{reasoning}\n#### {answer}plus EOS - Hyperparameters: effective batch size 32 (4 x 8 accumulation), about 860 steps, learning rate 2e-4 with cosine schedule and 20 warmup steps, max length 512, fp16 mixed precision, gradient checkpointing
- Hardware: one Kaggle T4
- Final training loss: about 0.22
Limitations
- Trained for one task format. Chat-style prompts, other languages and non-math tasks are unsupported and may 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.
- Zero-shot greedy decoding only; scores with other prompts or sampling will differ.
- Not safety-tuned. Do not rely on its answers for anything important.