Instructions to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF", filename="Qwen2.5-0.5B-Instruct.Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Use Docker
docker model run hf.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
- Ollama
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Ollama:
ollama run hf.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
- Unsloth Studio new
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF to start chatting
- Pi new
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
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 saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Docker Model Runner:
docker model run hf.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
- Lemonade
How to use saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Q-SS-0.5B-Reasoning-Math-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)Q-SS-0.5B-Reasoning-Math-GGUF
The same structured math reasoning model — quantized and ready for instant local CPU inference.
Q-SS-0.5B-Reasoning-Math-GGUF is the quantized GGUF version of Q-SS-0.5B-Reasoning-Math, a fine-tuned Qwen/Qwen2.5-0.5B-Instruct trained with GRPO reinforcement learning on mathematical reasoning tasks. At just ~300MB with Q4_K_M quantization, it runs instantly on any CPU with no GPU required.
🔧 Want the full precision model for GPU or fine-tuning? See Q-SS-0.5B-Reasoning-Math.
✨ Highlights
- ⚡ Instant CPU inference — ~300MB Q4_K_M, runs on any machine
- 🧠 Thinks out loud — explicit step-by-step reasoning inside
<thought>tags - 🎯 Clean structured output — final answer always isolated in
<answer>tags - 🖥️ No GPU required — perfect for local, offline, and edge deployments
- 🔓 Apache 2.0 — free for personal and commercial use
📋 Model Details
| Property | Details |
|---|---|
| Model Name | Q-SS-0.5B-Reasoning-Math-GGUF |
| Base Model | Qwen/Qwen2.5-0.5B-Instruct |
| Parameters | 500M |
| Quantization | Q4_K_M |
| File Size | ~300MB |
| Training Method | SFT Warm-up + GRPO Reinforcement Learning |
| Trained On | GSM8K + OpenR1-Math-220k |
| License | Apache 2.0 |
| Developer | Saad Salman |
💬 Output Format
Every response follows this strict structure:
<thought>
[Step-by-step reasoning and calculations]
</thought>
<answer>
[Final numerical answer only]
</answer>
🚀 Quick Start
llama.cpp
# Download the model
huggingface-cli download saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF \\
--local-dir ./Q-SS-0.5B-Reasoning-Math-GGUF
# Run inference
./llama-cli \\
-m Q-SS-0.5B-Reasoning-Math-GGUF/model-q4_k_m.gguf \\
--temp 0.1 \\
-n 384 \\
-p "You are a mathematical reasoning engine. Solve the problem step-by-step inside <thought> tags, then give ONLY the final answer inside <answer> tags.\\n\\nProblem: Janet has 3 cats. Each cat eats 2 cans per day. How many cans for 7 days?"
Ollama
ollama run hf.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF
Python with llama-cpp-python
from llama_cpp import Llama
llm = Llama(
model_path = "./Q-SS-0.5B-Reasoning-Math-GGUF/model-q4_k_m.gguf",
n_ctx = 2048,
n_threads = 4,
)
SYSTEM_PROMPT = \"\"\"You are a mathematical reasoning engine.
Solve the problem step-by-step inside <thought> tags, then give ONLY the
final numerical or LaTeX result inside <answer> tags.
<thought>
[Your internal reasoning and calculations here]
</thought>
<answer>
[Final answer only]
</answer>\"\"\"
def solve(problem):
response = llm.create_chat_completion(
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": problem},
],
max_tokens = 384,
temperature = 0.1,
)
answer = response["choices"][0]["message"]["content"]
if "<answer>" in answer:
return answer.split("<answer>")[-1].split("</answer>")[0].strip()
return answer
print(solve("Janet has 3 cats. Each cat eats 2 cans of food per day. How many cans does she need for 7 days?"))
# Output: 42
📝 Example Outputs
Problem: Janet has 3 cats. Each cat eats 2 cans of food per day. How many cans does she need for 7 days?
<thought>
Each cat eats 2 cans per day.
Janet has 3 cats, so they eat 3 × 2 = 6 cans per day together.
For 7 days: 6 × 7 = 42 cans total.
</thought>
<answer>
42
</answer>
Problem: Tom has $50. He buys a book for $12 and a pen for $3. How much money does he have left?
<thought>
Tom starts with $50.
He spends $12 on a book and $3 on a pen.
Total spent: 12 + 3 = $15.
Money remaining: 50 - 15 = $35.
</thought>
<answer>
35
</answer>
✅ What It's Good At
| Problem Type | Support |
|---|---|
| Basic arithmetic | ✅ Reliable |
| Multi-step word problems | ✅ Reliable |
| Problems with units and currency | ✅ Reliable |
| Basic algebra | ⚠️ Partial |
| Competition math (AMC/AIME) | ❌ Beyond capacity |
🖥️ Performance on CPU
| Hardware | Estimated Speed |
|---|---|
| Modern laptop (8-core) | ~5–10 tokens/sec |
| Desktop (16-core) | ~15–20 tokens/sec |
| Apple Silicon (M1/M2/M3) | ~20–30 tokens/sec |
| Raspberry Pi 4 | ~1–2 tokens/sec |
Speeds are approximate and depend on system load and memory bandwidth.
📦 Related Models
| Repo | Format | Size | Best For |
|---|---|---|---|
| Q-SS-0.5B-Reasoning-Math | FP16 | ~988MB | GPU inference & further fine-tuning |
| Q-SS-0.5B-Reasoning-Math-GGUF | Q4_K_M | ~300MB | Local CPU inference |
⚠️ Limitations
- Optimized for English language math problems only
- Complex abstract reasoning, geometry, and calculus are beyond reliable capacity at 0.5B scale
- Q4_K_M quantization introduces minor precision loss vs full FP16 — negligible for most use cases
- Always verify critical calculations — the model may occasionally produce confident but incorrect answers
🙏 Acknowledgements
- Unsloth — efficient fine-tuning framework
- Qwen Team — Qwen2.5-0.5B-Instruct base model
- HuggingFace TRL — GRPO implementation
- llama.cpp — GGUF conversion and inference
- OpenR1 — OpenR1-Math-220k dataset
- OpenAI — GSM8K dataset
📄 Citation
@misc{qss-reasoning-math-gguf-2025,
author = {Saad Salman},
title = {Q-SS-0.5B-Reasoning-Math-GGUF},
year = {2025},
publisher = {HuggingFace},
howpublished = {\\url{https://huggingface.co/saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF}},
}
- Downloads last month
- 178
4-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="saadxsalman/Q-SS-0.5B-Reasoning-Math-GGUF", filename="Qwen2.5-0.5B-Instruct.Q4_K_M.gguf", )