File size: 9,012 Bytes
bebc663
 
 
 
 
 
 
 
 
62019a8
bebc663
 
 
 
 
 
 
 
 
 
 
62019a8
bebc663
62019a8
bebc663
62019a8
bebc663
 
 
 
 
 
 
 
62019a8
bebc663
 
 
 
 
d79bca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62019a8
d79bca7
 
 
bebc663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3e12341
d79bca7
bebc663
 
62019a8
bebc663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62019a8
 
 
bebc663
62019a8
bebc663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62019a8
bebc663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---

license: apache-2.0
task_categories:
- text-generation
- question-answering
language:
- en
pretty_name: Arithmetic-Reasoning
size_categories:
- 10M<n<100M
tags:
- math
- reasoning
- synthetic
- arithmetic
- chain-of-thought
- small-lm
configs:
- config_name: default
  data_files:
  - split: train
    path: parquet/train-*.parquet
  - split: validation
    path: parquet/validation-*.parquet
  - split: test
    path: parquet/test-*.parquet
---


![Banner](best_3440x1440.png)

# SagheerLab/Arithmetic-Reasoning

> A high-quality synthetic arithmetic and elementary mathematics reasoning dataset for training and evaluating small language models - not an "ultimate math" claim, but a clean, verified, tiered reasoning dataset where every answer is programmatically checked.

This dataset was built to train **100M-ish models** that benefit disproportionately from clean, unambiguous examples. At ~50M examples (~45M train / 2.5M val / 2.5M test, ~5GB parquet) it is designed as a *reasoning* dataset: every sample has an instruction, a step-by-step reasoning trace, and a final answer, all verified to be mathematically correct.

### Why this dataset?

Small models (25M-100M) trained on our earlier 5-minute budget went from 0.5% → 89.8% with scratchpad formats and to **98.3%** with `reverse-answers + scratchpad` - format and verification matter more than scale. This release distills those findings into a publishable, 100% verified dataset.

# Problem Types - Top 10 + 8 more

We cover 18+ operation families. Each `instruction` is sampled from 20+ phrasings with varied names/objects so at 1M tokens <1% duplicates.

| # | Operation | Example Instruction | Reasoning | Answer |
|---|-----------|---------------------|-----------|--------|
| 1 | **Addition** | `Calculate 313921 + 108618.` | `313921 + 108618 = 422539` | `422539` |
| 2 | **Subtraction** | `Please compute 964047 - 52578.9.` | `964047-50000=914047 | ... | 911468.1` | `911468.1` |
| 3 | **Multiplication** | `Calculate 3088 x 1685.` | `3088*5*10^0=15440 | running=15440 | ... | 5203280` | `5203280` |
| 4 | **Division** | `Divide 7763506128 by 8856.` | `77635/8856=8 | 8*8856=70848 | ... | 876638` | `876638` |
| 5 | **Percentages** | `What is 86 percent of 5.6.` | `5.6*86=481.6 | 481.6/100=4.816` | `4.816` |
| 6 | **Comparison** | `Which is smaller, 107473 or 709570?` | `107473 < 709570 | 107473 is smaller` | `107473 is smaller` |
| 7 | **Fractions** | `Find 3/4 of 8324.` | `8324/4=2081 | 2081*3=6243` | `6243` |
| 8 | **Word Problems** | `Layla has 95 bags with 608 lemons each and found 152 more lemons. How many lemons total?` | `95*608=57760 | 57760+152=57912` | `57912 lemons` |
| 9 | **Algebra** | `Solve for x: x + 39 = 150` | `x = 150 - 39 = 111` | `111` |
| 10 | **Geometry** | `What is the area of a rectangle 884 by 752?` | `884*752=664768` | `664768` |
| | *+ 8 more:* `ratios, powers/roots, decimals, halving/doubling, sequences, multi-step, hard arithmetic, quantitative reasoning` - see `operation` field for full list. | | | |

Full per-operation counts in `50M`:
`word problems 13.6% | multi-step 10.7% | ratios 9.7% | hard arithmetic 5.7% | algebra 7.4% | fractions 4.6% | sequences 5.3% | geometry 5.1% | ...` (see `Per-operation` in generation log)


## Quickstart

```python

from datasets import load_dataset

ds = load_dataset("SagheerLab/Arithmetic-Reasoning")

print(ds["train"][0])

# {'instruction': 'What is 86 percent of 5.6.', 'reasoning': '5.6*86=481.6 | 481.6/100=4.816', 'answer': '4.816', ...}



# pretraining text format

print(ds["train"][0]["text"])

# Calculate 86 percent of 5.6.

# 5.6*86=481.6 | 481.6/100=4.816

# Answer: 4.816

```

```python

from huggingface_hub import snapshot_download

snapshot_download("SagheerLab/Arithmetic-Reasoning", repo_type="dataset", local_dir="./arithmetic-reasoning")

```




# Dataset Summary

- **Size:** ~50M examples (~45M train / 2.5M val / 2.5M test, ~5GB parquet), 100% programmatically verified
- **Generation:** deterministic `src/generate_data_v4.py` with `NAMES 120 + OBJECTS 150 + VERBS 100` for lexical variation, de-duplicated (<1% dupes)
- **Tiers:** `easy 30% (1-2 digits, 1 step) | intermediate 35% (3-4 digits, 2-3 steps) | hard 25% (5-6 digits, 3-8 steps) | very hard 10% (competition/GSM8K-style)`
- **License:** Apache 2.0 - see [Licensing](#licensing-information)

# Dataset Structure

### Data Instances
```json

{

  "instruction": "What is 86 percent of 5.6.",

  "reasoning": "5.6*86=481.6 | 481.6/100=4.816",

  "answer": "4.816",

  "text": "What is 86 percent of 5.6.\n5.6*86=481.6 | 481.6/100=4.816\nAnswer: 4.816",

  "operation": "percentage",

  "difficulty": "easy",

  "num_steps": 1,

  "max_digits": 2

}

```

### Data Fields
- `instruction` (string): the question, varied phrasing with names/objects
- `reasoning` (string): step-by-step trace (`|` separates steps, `\n` for long division), last step is `answer`
- `answer` (string): final answer only (with unit for word problems, e.g. `57912 lemons`)
- `text` (string): `instruction + "\n" + reasoning + "\nAnswer: " + answer` for pretraining
- `operation` (string): `addition | subtraction | multiplication | division | percentage | comparison | fractions | ... | word problems`
- `difficulty` (string): `easy | intermediate | hard | very hard`
- `num_steps` (int): reasoning steps (1 for easy, 2-3 for intermediate, 3-8 for hard)
- `max_digits` (int): largest operand digits (1-6)

### Data Splits
| Split | Size | Path |
|-------|------|------|
| train | ~45M | `parquet/train-*.parquet` (sharded, ~4.5GB) |
| validation | ~2.5M | `parquet/validation-*.parquet` |
| test | ~2.5M | `parquet/test-*.parquet` |

All splits are IID from same generator, `seed 42`, `balanced-sizes`, `max_digits 6`, sharded for Viewer (`row_group_size=10000`, `write_page_index=True`).

# Dataset Creation

### Curation Rationale
Small LMs benefit from clean, unambiguous, verified reasoning traces. We built this to provide a tiered, diverse arithmetic reasoning dataset where `easy` teaches columns, `intermediate` teaches decomposition, `hard` teaches 3-8 step planning, and `very hard` teaches GSM8K-style 4-5 op word problems.

### Source Data
Synthetic - generated by `src/generate_data_v4.py` (deterministic, efficient, <30s for 150K). No web crawl.

Generation uses:
- `PROMPT_TEMPLATES` 20+ per op (so at 100K <1% duplicate instructions)
- `NAMES 120 + OBJECTS 150 + VERBS 100` for word problems (e.g., `Jaxson had 133 rainbows...` not just `Sarah had...`)
- `balanced-sizes` uniform 1-6 digits, `DIVISOR_MAX_DIGITS 4`, `scratchpad-mul v2`, `scratchpad-div v3`, `scratchpad-sub`

### Data processing steps
1. Generate 150K raw examples with `seed 42`
2. Verification pipeline (100%):
   ```python

   true = calc(instruction)  # independent python calc

   assert answer == true

   assert reasoning.split("|")[-1].strip().endswith(answer) or reasoning.split("\n")[-1].strip() == answer

   assert reasoning lines are arithmetically valid

   # else drop & regenerate (seen set ensures <1% dupes)

   ```
3. Deduplicate `instruction` strings via `seen` set
4. Shuffle and split 90/5/5, write `Parquet` shards (`row_group_size=10000`, `write_page_index=True`), copy `best_3440x1440.png` banner

### Personal and Sensitive Information
None - all synthetic. Names are sampled from common first names, no real PII.

# Considerations for Using the Data

### Social Impact
Helps make reasoning training accessible for small models without web-scale data. No harmful content.

### Discussion of Biases
Word problems sample `NAMES` uniformly from a US-centric list - not representative of global names. Objects are everyday items. No systematic bias in math, but phrasing reflects English templates.

### Other Known Limitations
- English only, 1-6 digit arithmetic (no logs, no negative numbers yet - planned for v2)
- Fractions are `a/b` where `a` divisible by `b` (exact)
- Division is exact or integer quotient (no decimal remainder except `very hard` GSM8K remainder)
- Sequences are `+step`, `*2`, `Fibonacci`, `+3/*2 alternating` - not full competition variety

# Additional Information

### Licensing Information
**Apache 2.0** - permissive, allows commercial use, modification, distribution, and private use with attribution and a patent grant. You must include copyright/license notices. See `LICENSE` file.

### Citation
No citation required, but if you use this dataset please cite:

```

@dataset{sagheerlab_arithmetic_reasoning_2026,

  title={Arithmetic-Reasoning: A High-Quality Synthetic Arithmetic Reasoning Dataset for Small LMs},

  author={SagheerLab},

  year={2026},

  url={https://huggingface.co/datasets/SagheerLab/Arithmetic-Reasoning}

}

```

### Contributions
Thanks to the synthetic data verification pipeline and tiered difficulty design. Banner image `best_3440x1440.png` included at repo root.