amd/SAND-MathScience-DeepSeek-Qwen32B
2120
1---2license: other3license_link: LICENSE4library_name: transformers5pipeline_tag: text-generation6datasets:7 - amd/SAND-Post-Training-Dataset8 9language:10 - en11base_model:12 - deepseek-ai/DeepSeek-R1-Distill-Qwen-32B13---14 15# State-of-the-art Large Reasoning Model Built Using Only Synthetic Data on AMD GPUs16 17<div align="center">18 19| [](https://arxiv.org/pdf/2507.20527) | [](https://huggingface.co/datasets/amd/SAND-Post-Training-Dataset) | [](https://github.com/AMD-AGI/sand-pipeline) | [](https://rocm.blogs.amd.com/artificial-intelligence/sand-math/README.html) |20| :---: | :---: | :---: | :---: |21</div>22 23## Model Summary24 25We introduce **SAND-Math-Qwen2.5-32B** and **SAND-MathScience-DeepSeek-Qwen32B**, state-of-the-art reasoning models in the 32B parameter range, built entirely using a synthetic data pipeline running on the **AMD ROCm™ stack** and **AMD Instinct™ MI325 GPUs**.26 27By prioritizing data difficulty along with quantity, we demonstrate that high-difficulty synthetic data can elevate prior-generation models to match or exceed modern proprietary models. `SAND-Math-Qwen2.5-32B` is fine-tuned from **Qwen2.5-32B-Instruct** on just **14k synthetic math samples**, achieving strong reasoning capabilities with minimal data outperforming other data distillation and post training approaches. `SAND-MathScience-DeepSeek-Qwen32B` is fine-tuned from **DeepSeek-R1-Distill-Qwen-32B** on a compact dataset of **27k samples** (15k Math + 12k Science), achieving a generational leap in performance that rivals **Qwen3-32B**.28 29We are releasing the models, datasets, and code to empower the community to build their own state-of-the-art reasoning models using AMD hardware.30 31## 📊 Benchmark Results32 33We conducted extensive experiments to validate that our pipeline yields superior results compared to models trained on significantly larger datasets.34 35### 1. Bridging the Generational Gap36Fine-tuning the Qwen2.5-based **DeepSeek-R1-Distill-Qwen-32B** on our mixed Math/Science dataset allows it to rival and even surpass the next-generation **Qwen3-32B** on key benchmarks.37 38| Model | AIME24 | AIME25 | MATH500 | GPQA |39| :--- | :---: | :---: | :---: | :---: |40| DeepSeek-Distilled-Qwen32B (Base) | 72.6 | 54.9 | 94.3 | 62.1 |41| EXAONE Deep 32B | 72.1 | 65.8 | 95.8 | 66.1 |42| Qwen3-32B (Thinking mode) | 81.4 | 72.9 | **97.0** | 68.4 |43| **SAND-MathScience-DeepSeek-Qwen32B (Ours)** | **83.85** | **78.33** | 93.85 | **68.72** |44 45### 2. Efficiency: Unlocking Reasoning with Less Data46Using only **14k synthetic math samples** and standard SFT (no RL), our approach outperforms models trained on datasets 5x to 50x larger.47 48| Model | Data Size | AIME24 | AIME25 | MATH500 | GPQA |49| :--- | :--- | :---: | :---: | :---: | :---: |50| Qwen2.5-32B-Instruct (Base) | - | 16.7 | 13.3 | 83.4 | 53.5 |51| DeepSeek-R1-Distill-Qwen-32B | 800k | 72.6 | 54.9 | **94.3** | **62.1** |52| Light-R1-32B | 79k | 73.0 | 64.3 | 93.3 | 60.6 |53| OpenThinker-32B | 114k | 66.0 | 53.3 | 89.4 | 57.6 |54| **SAND-Math-Qwen2.5-32B (Ours)** | **14k** | **74.01** | **68.18** | 92.05 | 60.8 |55 56---57 58## ⚙️ The Synthetic Data Pipeline59 60Our results are powered by a 4-stage automated pipeline running on AMD hardware that prioritizes **difficulty and novelty** over volume. Unlike datasets that recycle easy problems, our pipeline leverages a Teacher Model (`GPT-OSS120b`) to generate, validate, and systematically "hike" the difficulty of reasoning problems.61 6263 64### Pipeline Stages65 661. **Stage 1: QA Generation & Consistency** 🛠️67 - Generates novel problems from scratch68 - Enforces correctness by requiring the teacher to generate multiple independent solution paths69 - Only questions where all answers align are kept70 712. **Stage 2: De-duplication & Decontamination** 🧹72 - Removes internal duplicates via embedding similarity73 - **Crucial Step:** Scans against known test sets (AIME, MATH, GPQA) to ensure zero contamination74 753. **Stage 3: Difficulty Hiking** 🏔️76 - Moderately challenging questions are rewritten by the teacher model77 - Introduces deeper reasoning chains, added constraints, or cross-domain logic78 - Systematically elevates complexity79 - Configurable step primarily used when initial generation yields insufficient volume of high-difficulty samples80 81---82 83## 🚀 Quick Start84 85### Python Inference (Transformers)86 87```python88from transformers import AutoModelForCausalLM, AutoTokenizer89 90model_name = "amd/SAND-MathScience-DeepSeek-Qwen32B"91 92model = AutoModelForCausalLM.from_pretrained(93 model_name,94 torch_dtype="auto",95 device_map="auto"96)97tokenizer = AutoTokenizer.from_pretrained(model_name)98 99# Example prompt100prompt = "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost?"101messages = [102 {"role": "user", "content": prompt}103]104text = tokenizer.apply_chat_template(105 messages,106 tokenize=False,107 add_generation_prompt=True108)109model_inputs = tokenizer([text], return_tensors="pt").to(model.device)110 111generated_ids = model.generate(112 **model_inputs,113 max_new_tokens=4096,114 temperature=0.7, # Recommended temperature115 do_sample=True116)117generated_ids = [118 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)119]120 121response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]122print("Response:", response)123```124 125### Serving (vLLM & SGLang)126 127You can easily serve this model as an OpenAI-compatible API endpoint.128 129**Using SGLang:**130```bash131python -m sglang.launch_server --model-path amd/SAND-MathScience-DeepSeek-Qwen32B --max-model-len 32768132```133 134**Using vLLM:**135```bash136vllm serve amd/SAND-MathScience-DeepSeek-Qwen32B --max-model-len 32768137```138 139---140 141## 💡 Usage Recommendations142 143To replicate our performance benchmarks and achieve the best reasoning results, we strongly recommend the following configurations:144 145* **Temperature:** Set `temperature=0.7`. **DO NOT use greedy decoding**, as it can lead to performance degradation and repetitive loops.146* **Prompting:** For mathematical problems, include a directive to enforce structure:147 > "Please reason step by step, and put your final answer within \boxed{}."148* **Context Length:** We recommend allowing an output length of **32,768 tokens**. This ensures the model has sufficient space for long Chain-of-Thought (CoT) generation.149* **Thinking Token:** It is recommended to enforce the model to initiate its response with the `<think>\n` token to trigger the reasoning mode effectively.150* **Evaluation:** When benchmarking, conduct multiple passes (Pass@K) and average the results for stability.151 152---153 154## 📜 License155 156This project is licensed under the **Open RAIL-MSD** license. This is an open, royalty-free license that permits commercial use, modification, and distribution of the dataset, models, and source code.157 158The license includes standard use-based restrictions to prevent harmful applications (e.g., illegal activities, generating harmful content, high-risk applications). These restrictions are designed to promote responsible AI development while keeping the license permissive for legitimate use cases.159 160For full license terms and conditions, please see the [LICENSE](./LICENSE) file.161 162---163 164## Citation165 166If you use this model, dataset, or pipeline in your research, please cite our work:167 168```bibtex169@misc{manem025sandmathusingllmsgenerate,170 title={SAND-Math: Using LLMs to Generate Novel, Difficult and Useful Mathematics Questions and Answers},171 author={Chaitanya Manem and Pratik Prabhanjan Brahma and Prakamya Mishra and Zicheng Liu and Emad Barsoum},172 year={2025},173 eprint={2507.20527},174 archivePrefix={arXiv},175 primaryClass={cs.CL},176 url={https://arxiv.org/abs/2507.20527},177}178```179 180 