The dataset focuses on easy–medium difficulty:
basic arithmetic, fractions, percentages, rate problems, simple algebra, and simple combinatorics – the kind of tasks a 1–3B model can genuinely master.
Training Setup (Summary)
Fine-tuning was done with Unsloth + TRL on a single RTX 4090, using full BF16 fine-tuning (no LoRA).
where </s> is the tokenizer EOS token.
Adding eos_token at the end of each sample teaches the model when to stop, which greatly reduces “Answer: 36 / Answer: 36 / …” loops during inference.
Prompting & Templates
Recommended system prompt (optional but useful)
text
1You are a math reasoning assistant.
23For every question, answer in exactly this format:
45Problem:
6<restate the problem in your own words>
78Reasoning:
9<step-by-step reasoning showing all intermediate steps>
1011Answer:
12<final numeric answer only, on its own line>
1314Do not add any extra commentary before or after the answer.
15Do not repeat the answer multiple times.
16Stop after writing the final answer.
On top of the EOS token, you can add stop strings in your UI:
### Instruction:
### Response:
Many frontends (LM Studio, text-generation-webui, KoboldCpp, etc.) let you configure these so the model stops cleanly when it tries to start the next turn.
Quantization & Hardware Tips
The three variants in this repo roughly behave as follows (ballpark):
Q4_K_M (~1.1 GB) – best for:
4–6 GB GPUs or pure CPU inference.
Fast experimentation / local tools / “math assistant on a laptop”.
Q8_0 (~1.8 GB) – good compromise:
8–12 GB GPUs.
Often slightly more stable than Q4 on harder problems.
F16 (~3.5 GB) – highest fidelity:
12+ GB GPUs (4090, 4080, 4070 12GB, A4000 etc.).
Recommended if VRAM allows and you care about maximum accuracy.
As a rule of thumb, choose a file that is 1–2 GB smaller than your available VRAM.
Usage Examples
llama.cpp
Once you have built llama.cpp, you can run the model like this (replace with your path):
bash
1./llama-cli \2 -m Qwen3-1.7B-Magistral-Math-Q4_K_M.gguf \3 -p "### Instruction:
4Albert buys 2 large pizzas and 2 small pizzas. A large pizza has 16 slices and a small pizza has 8 slices. If he eats it all, how many pieces does he eat that day?
56### Response:
7"\8 -n 256\9 --temp 0.1\10 --top-p 0.9\11 --repeat-penalty 1.05
Suggested decoding for math:
temperature: 0.0–0.2
top_p: 0.9
repeat_penalty: 1.05–1.1
top_k: 20–40 (optional tweak)
LM Studio / other UIs
Set the prompt template to:
text
1### Instruction:
2{{prompt}}
34### Response:
Add stop strings:
### Instruction:
### Response:
and keep temperature low for math benchmarks.
Intended Uses & Limitations
Intended uses
Solving GSM8K-style and OpenMath-style word problems.
Training / evaluating small-scale math reasoning pipelines.
Serving as a local math tutor for grade-school / early high-school algebra & arithmetic.
Limitations
Not a general chat/instruction model; it is biased toward math.
CoT is learned from synthetic teacher traces, not human-written solutions.
Not suitable for high-stakes educational or decision-making without human oversight.
Performance on very hard competition math (Olympiad-level, deep proofs) will be limited – the training data explicitly focuses on easy–medium difficulty.
Users are responsible for ensuring there is no data leakage if they evaluate on GSM8K/OpenMath-derived benchmarks.