DeepMath is a lightweight math reasoning agent built on Qwen3-4B Thinking and fine‑tuned with Group Relative Policy Optimization (GRPO). It generates short Python snippets for intermediate steps, executes them in a secure sandbox, and folds the results back into its reasoning, cutting output length by up to 66% while often improving accuracy. The agent is implemented with the smolagents library and evaluated on MATH500, AIME, HMMT, and HLE datasets. GRPO training rewards code generation and shorter outputs, and temperature scheduling balances exploration and stability during training. The project includes code and evaluation scripts on GitHub and the model on Hugging Face.
DeepMath is an aligned math reasoning agent built on Qwen3-4B Thinking and fine-tuned with GRPO (Group Relative Policy Optimization) . Instead of verbose text, the model emits tiny Python snippets for intermediate steps, runs them in a secure sandbox, and folds the results back into its reasoning, reducing errors and output length. The agent is implemented using the smolagents library .
We evaluate DeepMath on four math datasets: MATH500 , AIME , HMMT , and HLE , and show that:
🤖 The math agent alone reduces output lengths by up to 66%, while often improving accuracy.
[2] Liu, Mingjie, Shizhe Diao, Ximing Lu, et al. 2025. “ProRL: Prolonged Reinforcement Learning Expands Reasoning Boundaries in Large Language Models.” arXiv:2505.24864. Preprint, arXiv, May 30. https://doi.org/10.48550/arXiv.2505.24864
⚡ GRPO training improves the agent performance even further, in almost all benchmarks.
👉 Code and evaluation scripts: https://github.com/IntelLabs/DeepMath 👉 Model: https://huggingface.co/Intel/deepmath-v1
Large language models (LLMs) have advanced reasoning capabilities, but mathematical problem-solving remains challenging; chain-of-thought traces can be lengthy and prone to arithmetic mistakes. Recent works[^1][^2] demonstrate that small models can reach strong performance, and other studies[^3] investigate tool use to improve reliability. What those papers generally do not emphasize is reducing trace verbosity or explicitly training models to prefer short, computation-oriented traces executed in a constrained, auditable environment.
By demonstrating that small models can achieve strong math reasoning with concise, computation‑driven traces, DeepMath shows a path to more efficient, interpretable, and safer AI agents without large‑scale models or heavyweight tools.