sagheerlabs commited on
Commit
a2bc3fa
·
verified ·
1 Parent(s): 7d59a82

Initial release: 150K verified arithmetic reasoning (v4) with tiered difficulty

Browse files
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ data/train.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - text-generation
5
+ - question-answering
6
+ language:
7
+ - en
8
+ pretty_name: Arithmetic-Reasoning
9
+ size_categories:
10
+ - 100K<n<1M
11
+ tags:
12
+ - math
13
+ - reasoning
14
+ - synthetic
15
+ - arithmetic
16
+ - chain-of-thought
17
+ - small-lm
18
+ configs:
19
+ - config_name: default
20
+ data_files:
21
+ - split: train
22
+ path: data/train.parquet
23
+ - split: validation
24
+ path: data/val.parquet
25
+ - split: test
26
+ path: data/test.parquet
27
+ ---
28
+
29
+ ![Banner](best_3440x1440.png)
30
+
31
+ # SagheerLab/Arithmetic-Reasoning
32
+
33
+ > 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.
34
+
35
+ This dataset was built to train **100M-ish models** that benefit disproportionately from clean, unambiguous examples. At 150K examples (135K train / 7.5K val / 7.5K test) 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.
36
+
37
+ ### Why this dataset?
38
+
39
+ 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.
40
+
41
+ ## Quickstart
42
+
43
+ ```python
44
+ from datasets import load_dataset
45
+ ds = load_dataset("SagheerLab/Arithmetic-Reasoning")
46
+ print(ds["train"][0])
47
+ # {'instruction': 'What is 86 percent of 5.6.', 'reasoning': '5.6*86=481.6 | 481.6/100=4.816', 'answer': '4.816', ...}
48
+
49
+ # pretraining text format
50
+ print(ds["train"][0]["text"])
51
+ # Calculate 86 percent of 5.6.
52
+ # 5.6*86=481.6 | 481.6/100=4.816
53
+ # Answer: 4.816
54
+ ```
55
+
56
+ ```python
57
+ from huggingface_hub import snapshot_download
58
+ snapshot_download("SagheerLab/Arithmetic-Reasoning", repo_type="dataset", local_dir="./arithmetic-reasoning")
59
+ ```
60
+
61
+ Both `JSON` and `Parquet` are provided (`data/train.parquet` + `data/train.json`) — use either.
62
+
63
+ # Dataset Summary
64
+
65
+ - **Size:** 150,000 examples (135K train / 7.5K val / 7.5K test), 100% programmatically verified
66
+ - **Generation:** deterministic `src/generate_data_v4.py` with `NAMES 120 + OBJECTS 150 + VERBS 100` for lexical variation, de-duplicated (<1% dupes)
67
+ - **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)`
68
+ - **License:** Apache 2.0 — see [Licensing](#licensing-information)
69
+
70
+ # Problem Types — Top 10 + 8 more
71
+
72
+ We cover 18+ operation families. Each `instruction` is sampled from 20+ phrasings with varied names/objects so at 1M tokens <1% duplicates.
73
+
74
+ | # | Operation | Example Instruction | Reasoning | Answer |
75
+ |---|-----------|---------------------|-----------|--------|
76
+ | 1 | **Addition** | `Calculate 313921 + 108618.` | `313921 + 108618 = 422539` | `422539` |
77
+ | 2 | **Subtraction** | `Please compute 964047 - 52578.9.` | `964047-50000=914047 | ... | 911468.1` | `911468.1` |
78
+ | 3 | **Multiplication** | `Calculate 3088 x 1685.` | `3088*5*10^0=15440 | running=15440 | ... | 5203280` | `5203280` |
79
+ | 4 | **Division** | `Divide 7763506128 by 8856.` | `77635/8856=8 | 8*8856=70848 | ... | 876638` | `876638` |
80
+ | 5 | **Percentages** | `What is 86 percent of 5.6.` | `5.6*86=481.6 | 481.6/100=4.816` | `4.816` |
81
+ | 6 | **Comparison** | `Which is smaller, 107473 or 709570?` | `107473 < 709570 | 107473 is smaller` | `107473 is smaller` |
82
+ | 7 | **Fractions** | `Find 3/4 of 8324.` | `8324/4=2081 | 2081*3=6243` | `6243` |
83
+ | 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` |
84
+ | 9 | **Algebra** | `Solve for x: x + 39 = 150` | `x = 150 - 39 = 111` | `111` |
85
+ | 10 | **Geometry** | `What is the area of a rectangle 884 by 752?` | `884*752=664768` | `664768` |
86
+ | | *+ 8 more:* `ratios, powers/roots, decimals, halving/doubling, sequences, multi-step, hard arithmetic, quantitative reasoning` — see `operation` field for full list. | | | |
87
+
88
+ Full per-operation counts in `150K`:
89
+ `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)
90
+
91
+ # Dataset Structure
92
+
93
+ ### Data Instances
94
+ ```json
95
+ {
96
+ "instruction": "What is 86 percent of 5.6.",
97
+ "reasoning": "5.6*86=481.6 | 481.6/100=4.816",
98
+ "answer": "4.816",
99
+ "text": "What is 86 percent of 5.6.\n5.6*86=481.6 | 481.6/100=4.816\nAnswer: 4.816",
100
+ "operation": "percentage",
101
+ "difficulty": "easy",
102
+ "num_steps": 1,
103
+ "max_digits": 2
104
+ }
105
+ ```
106
+
107
+ ### Data Fields
108
+ - `instruction` (string): the question, varied phrasing with names/objects
109
+ - `reasoning` (string): step-by-step trace (`|` separates steps, `\n` for long division), last step is `answer`
110
+ - `answer` (string): final answer only (with unit for word problems, e.g. `57912 lemons`)
111
+ - `text` (string): `instruction + "\n" + reasoning + "\nAnswer: " + answer` for pretraining
112
+ - `operation` (string): `addition | subtraction | multiplication | division | percentage | comparison | fractions | ... | word problems`
113
+ - `difficulty` (string): `easy | intermediate | hard | very hard`
114
+ - `num_steps` (int): reasoning steps (1 for easy, 2-3 for intermediate, 3-8 for hard)
115
+ - `max_digits` (int): largest operand digits (1-6)
116
+
117
+ ### Data Splits
118
+ | Split | Size | Path |
119
+ |-------|------|------|
120
+ | train | 135,000 | `data/train.parquet` + `data/train.json` |
121
+ | validation | 7,500 | `data/val.parquet` |
122
+ | test | 7,500 | `data/test.parquet` |
123
+
124
+ All splits are IID from same generator, `seed 42`, `balanced-sizes`, `max_digits 6`.
125
+
126
+ # Dataset Creation
127
+
128
+ ### Curation Rationale
129
+ 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.
130
+
131
+ ### Source Data
132
+ Synthetic — generated by `src/generate_data_v4.py` (deterministic, efficient, <30s for 150K). No web crawl.
133
+
134
+ Generation uses:
135
+ - `PROMPT_TEMPLATES` 20+ per op (so at 100K <1% duplicate instructions)
136
+ - `NAMES 120 + OBJECTS 150 + VERBS 100` for word problems (e.g., `Jaxson had 133 rainbows...` not just `Sarah had...`)
137
+ - `balanced-sizes` uniform 1-6 digits, `DIVISOR_MAX_DIGITS 4`, `scratchpad-mul v2`, `scratchpad-div v3`, `scratchpad-sub`
138
+
139
+ ### Data processing steps
140
+ 1. Generate 150K raw examples with `seed 42`
141
+ 2. Verification pipeline (100%):
142
+ ```python
143
+ true = calc(instruction) # independent python calc
144
+ assert answer == true
145
+ assert reasoning.split("|")[-1].strip().endswith(answer) or reasoning.split("\n")[-1].strip() == answer
146
+ assert reasoning lines are arithmetically valid
147
+ # else drop & regenerate (seen set ensures <1% dupes)
148
+ ```
149
+ 3. Deduplicate `instruction` strings via `seen` set
150
+ 4. Shuffle and split 90/5/5, write `JSONL` + `Parquet`, copy `best_3440x1440.png` banner
151
+
152
+ ### Personal and Sensitive Information
153
+ None — all synthetic. Names are sampled from common first names, no real PII.
154
+
155
+ # Considerations for Using the Data
156
+
157
+ ### Social Impact
158
+ Helps make reasoning training accessible for small models without web-scale data. No harmful content.
159
+
160
+ ### Discussion of Biases
161
+ 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.
162
+
163
+ ### Other Known Limitations
164
+ - English only, 1-6 digit arithmetic (no logs, no negative numbers yet — planned for v2)
165
+ - Fractions are `a/b` where `a` divisible by `b` (exact)
166
+ - Division is exact or integer quotient (no decimal remainder except `very hard` GSM8K remainder)
167
+ - Sequences are `+step`, `*2`, `Fibonacci`, `+3/*2 alternating` — not full competition variety
168
+
169
+ # Additional Information
170
+
171
+ ### Licensing Information
172
+ **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.
173
+
174
+ *Why Apache 2.0 vs MIT vs CC-BY-4.0?*
175
+ - **MIT:** shortest, permissive, requires attribution, allows commercial, no explicit patent grant, no warranty.
176
+ - **Apache 2.0:** like MIT but adds explicit patent grant from contributors and requires preserving `NOTICE` — safer for organisations, still permissive and commercial-friendly. Recommended for code+data where patent concerns matter.
177
+ - **CC-BY-4.0:** designed for creative/data works, requires attribution, allows commercial/derivatives, no patent language, good for pure datasets. Also suitable, but Apache 2.0 is more standard on HF for synthetic code-like data and gives patent clarity.
178
+
179
+ We chose **Apache 2.0** for this dataset as it is commercial-friendly, attribution-only, and includes patent protection — same as many HF synthetic datasets. If you prefer `CC-BY-4.0` or `MIT`, you can relicense your derived model/data accordingly with attribution.
180
+
181
+ ### Citation
182
+ No citation required, but if you use this dataset please cite:
183
+
184
+ ```
185
+ @dataset{sagheerlab_arithmetic_reasoning_2026,
186
+ title={Arithmetic-Reasoning: A High-Quality Synthetic Arithmetic Reasoning Dataset for Small LMs},
187
+ author={SagheerLab},
188
+ year={2026},
189
+ url={https://huggingface.co/datasets/SagheerLab/Arithmetic-Reasoning}
190
+ }
191
+ ```
192
+
193
+ ### Contributions
194
+ Thanks to the synthetic data verification pipeline and tiered difficulty design. Banner image `best_3440x1440.png` included at repo root.
best_3440x1440.png ADDED

Git LFS Details

  • SHA256: e44d215af83e2bd06ce67eca8aac67ac1cbad5b5164dd9eedc4ae6ee8dfc6d3c
  • Pointer size: 132 Bytes
  • Size of remote file: 3.6 MB
data/test.json ADDED
The diff for this file is too large to render. See raw diff
 
data/test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d65467c71b5403237c70801a498aaaf9339c80035a65c87f83516e61d764884
3
+ size 746006
data/train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc1f3b05a45f4f91444982d7ed6a822d0dae2717cbaa5130e663a15b2b1f44bc
3
+ size 40159803
data/train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c3d5e4a5f9de6b6cd5f1f37fc93e47e5c855c1692ccc5de61e234bfab930a78
3
+ size 12574963
data/val.json ADDED
The diff for this file is too large to render. See raw diff
 
data/val.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e68483e98b570310d75d90c31066a0a891947562df5ed1fef28f46c065824159
3
+ size 742818