sagheerlabs commited on
Commit
bebc663
·
verified ·
1 Parent(s): d24e80a

Reorganize into parquet/ and json/ folders + remove em dashes - verified dual configs

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