| --- |
| license: apache-2.0 |
| task_categories: |
| - text-generation |
| - question-answering |
| language: |
| - en |
| pretty_name: Arithmetic-Reasoning |
| size_categories: |
| - 100K<n<1M |
| tags: |
| - math |
| - reasoning |
| - synthetic |
| - arithmetic |
| - chain-of-thought |
| - small-lm |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: data/train.parquet |
| - split: validation |
| path: data/val.parquet |
| - split: test |
| path: data/test.parquet |
| --- |
| |
|  |
|
|
| # 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 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. |
|
|
| ### 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. |
|
|
| ## 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") |
| ``` |
|
|
| Both `JSON` and `Parquet` are provided (`data/train.parquet` + `data/train.json`) — use either. |
|
|
| # Dataset Summary |
|
|
| - **Size:** 150,000 examples (135K train / 7.5K val / 7.5K test), 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) |
|
|
| # 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 `150K`: |
| `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) |
|
|
| # 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 | 135,000 | `data/train.parquet` + `data/train.json` | |
| | validation | 7,500 | `data/val.parquet` | |
| | test | 7,500 | `data/test.parquet` | |
|
|
| All splits are IID from same generator, `seed 42`, `balanced-sizes`, `max_digits 6`. |
|
|
| # 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 `JSONL` + `Parquet`, 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. |
|
|
| *Why Apache 2.0 vs MIT vs CC-BY-4.0?* |
| - **MIT:** shortest, permissive, requires attribution, allows commercial, no explicit patent grant, no warranty. |
| - **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. |
| - **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. |
|
|
| 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. |
|
|
| ### 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. |
|
|