Instructions to use towardtype1/qwen2.5-0.5b-gsm8k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use towardtype1/qwen2.5-0.5b-gsm8k with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("towardtype1/qwen2.5-0.5b-gsm8k") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use towardtype1/qwen2.5-0.5b-gsm8k with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "towardtype1/qwen2.5-0.5b-gsm8k"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "towardtype1/qwen2.5-0.5b-gsm8k" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use towardtype1/qwen2.5-0.5b-gsm8k with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "towardtype1/qwen2.5-0.5b-gsm8k"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default towardtype1/qwen2.5-0.5b-gsm8k
Run Hermes
hermes
- OpenClaw new
How to use towardtype1/qwen2.5-0.5b-gsm8k with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "towardtype1/qwen2.5-0.5b-gsm8k"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "towardtype1/qwen2.5-0.5b-gsm8k" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use towardtype1/qwen2.5-0.5b-gsm8k with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "towardtype1/qwen2.5-0.5b-gsm8k"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "towardtype1/qwen2.5-0.5b-gsm8k" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "towardtype1/qwen2.5-0.5b-gsm8k", "messages": [ {"role": "user", "content": "Hello"} ] }'
qwen2.5-0.5b-gsm8k
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:
- SFT on GSM8K's worked solutions (900 steps, lr 1e-4).
- GRPO with verifiable rewards - 1.0 if the extracted
#### answermatches 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).
Results (GSM8K test, zero-shot, greedy, strict #### <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.
Usage
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")
Limitations
- Single-task specialist: trained and evaluated only on GSM8K-style word problems in the exact format above. It is not aligned, not a chat assistant, and inherits any base-model limitations and biases.
- 0.5B parameters: arithmetic slips are common; verify answers.
Training write-up
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.
- Downloads last month
- 201
Quantized
Model tree for towardtype1/qwen2.5-0.5b-gsm8k
Base model
Qwen/Qwen2.5-0.5BDataset used to train towardtype1/qwen2.5-0.5b-gsm8k
Evaluation results
- GSM8K test, zero-shot, strict `#### answer` match on GSM8Kself-reported0.416