Qwen3-0.6B: multiplying three-digit numbers with precise GRPO fine-tuning
2 min readupdated
A specialized version of the compact Qwen3-0.6B language model, fine-tuned using reinforcement learning (GRPO, group relative policy optimization) for a single specific task: multiplying two three-digit integers. The base model failed this test in about 38% of cases, whereas the new version produces the correct result in nearly 95% of tests. The training even changed the model's internal strategy: it has started breaking down operands by place value much more frequently. A useful example of how narrow fine-tuning fixes the mathematical blindness of small LLMs.
Key features
- Accuracy on the test dataset increased from 61.7% to 94.9% compared to the base Qwen3-0.6B.
- Trained using GRPO (group relative policy optimization) with a verifiable reward for the correct answer.
- Improved calculation strategy: in 97% of cases, the model began logically breaking down operands by place value.
- Precise response format: the final result is placed in a special
\boxed{}tag.
What you can do
- Integrate the model into local pipelines or scripts to verify precise mathematical calculations with three-digit numbers.
- Use the GRPO approach and the author's dataset to fine-tune other compact language models for arithmetic tasks.
- Test the model in non-thinking mode with fixed sampling parameters (temperature 0.7, top-p 0.8).
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "puravmanot/qwen3-0.6b-three-digit-multiplication-grpo"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "system", "content": r"Calculate the requested result. Put the final integer inside one \boxed{}."},
{"role": "user", "content": r"What is 467 * 924? Put your final answer inside \boxed{}."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(text, return_tensors="pt", add_special_tokens=False).to(model.device)
output = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.8, top_k=20)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))Read more
DetailsBenchmarks: validation dataset — 94.9% (vs. 62.6% for the base), test dataset — 94.9% (vs. 61.7% for the base).
Hardware requirements: training took about 75 minutes on a single NVIDIA L40S GPU.
Training details: used the TRL 0.24.0 library (loss_type="dapo"), 100 steps, learning rate 1e-6.
Limitations: other capabilities of the base model were not tested; about 5% of answers still contain errors in intermediate calculations.










Comments