Downloads · 30 days
33
11% of all-time downloads
towardtype1/qwen2.5-0.5b-gsm8k
qwen2.5-0.5b-gsm8k is a text generation model from towardtype1. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as apache-2.0.
Qwen/Qwen2.5-0.5B (base) post-trained for grade-school math on a MacBook Pro, with every training loop written by hand in MLX as a learning exercise.
Downloads · 30 days
33
11% of all-time downloads
All-time downloads
308
Public
Parameters
494M
988 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors988 MB · 99%
From the Hugging Face model README
Qwen/Qwen2.5-0.5B (base) post-trained for grade-school math on a MacBook Pro, with every training loop written by hand in MLX as a learning exercise.
Two stages, both via rank-16 LoRA on the attention q/v projections (1,081,344 trainable parameters, 0.2% of the model), adapters merged into the weights afterwards:
#### answer matches gold, else 0.0 - with a k3 KL penalty against the frozen SFT reference (100 steps, groups of 8 at temperature 0.8, lr 1e-5, kl 0.1, grad clip 1.0).#### <number> match)| Model | Accuracy |
|---|---|
| Qwen2.5-0.5B base | 0.000 (0.305 with 4-shot prompting) |
| + LoRA SFT | 0.345 |
| + LoRA GRPO (this model) | 0.416 |
| full-fine-tune SFT, for comparison | 0.325 |
| full-fine-tune GRPO, for comparison | 0.303 |
Full test set (1,319 questions) for all rows. The interesting finding: the same GRPO recipe that stalled on full fine-tuning gained 7 points under the low-rank constraint - the small trainable space acts as a structural leash on noisy small-batch policy gradients.
Prompt format (the model is a narrow GSM8K-format specialist, not a chat model):
Question: <your word problem>
Answer:
It emits step-by-step reasoning ending in #### <number>.
With mlx-lm:
from mlx_lm import load, generate
model, tokenizer = load("towardtype1/qwen2.5-0.5b-gsm8k")
print(generate(model, tokenizer, prompt="Question: Tom has 3 boxes of 12 pencils. He gives away 5. How many are left?\nAnswer:", max_tokens=200))
With transformers (weights are standard Qwen2 layout):
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("towardtype1/qwen2.5-0.5b-gsm8k")
The full story - including two instructive GRPO failure modes (format collapse without a KL penalty, gradient-noise drift without clipping) and why the LoRA constraint fixed them - is in the blog post Post-training from scratch and the code repo towardtype1/grade-school-math.