| --- |
| license: mit |
| language: |
| - en |
| tags: |
| - arithmetic |
| - process-supervision |
| - scratchpad |
| - chain-of-thought |
| - synthetic |
| task_categories: |
| - text-generation |
| size_categories: |
| - 100K<n<1M |
| --- |
| |
| # Contents |
|
|
| | Split | Rows | |
| |-------|-----:| |
| | train | 100,000 | |
| | validation | 4,000 | |
| | test | 4,000 | |
| | **total** | **108,000** | |
|
|
| Splits are **prompt-disjoint** — no expression appears in more than one split, |
| and commutative swaps and trace keys are de-duplicated across splits to prevent |
| split leakage. |
|
|
| | Operation | Rows | |
| |-----------|-----:| |
| | `×` | 32,000 | |
| | `÷` | 32,000 | |
| | `+` | 22,000 | |
| | `−` | 22,000 | |
|
|
| Operands lie in **[−999, 999]**. Division answers use a fixed `DDD.ddd` form |
| (round-half-up to three decimals); division by zero is an atomic `<nan>`. |
|
|
| ## Schema |
|
|
| One JSON object per line. Key fields: |
|
|
| | Field | Description | |
| |-------|-------------| |
| | `prompt` | the question, e.g. `842/37=` | |
| | `text` | the full serialized string: prompt + scratchpad + answer | |
| | `operation` | `+`, `-`, `*`, `/` | |
| | `effective_operation` | canonical magnitude op after sign planning (`add`/`sub`/`mul`/`div`) | |
| | `result_sign` | `positive` / `negative` | |
| | `state` | the normalized operands the scratchpad works over | |
| | `steps` | list of structured step records (each with a `serialized` string) | |
| | `internal_answer` | canonical internal answer (e.g. `022.757`, or `<nan>`) | |
| | `natural_answer` | human-readable answer (e.g. `22.757`) | |
| | `scenario` | difficulty/skill bucket (e.g. `rounded_ge_one_up`, `high_column_sum`) | |
| | `split` | `train` / `val` / `test` | |
| | `encoded_tokens` | actual row length including `<bos>` and `<eos>` (max 162) | |
|
|
| ### The scratchpad grammar |
|
|
| Every row begins with the original expression and then a normalized arithmetic |
| plan: |
|
|
| ``` |
| <prompt><effective-op><result-sign><state><six-digit-state>...<ans><answer> |
| ``` |
|
|
| `<effective-op>` is one of `<add>`, `<sub>`, `<mul>`, or `<div>`, and |
| `<result-sign>` is `<pos>` or `<neg>`. For signed `+` and `-` expressions, the |
| effective magnitude operation can differ from the prompt operator. For example, |
| adding operands with opposite signs uses the subtraction grammar after their |
| magnitudes are ordered. |
|
|
| #### Addition (`<add>`) |
|
|
| The six-digit state contains two zero-padded, three-digit magnitudes in reversed |
| (units-first) order: |
|
|
| ``` |
| <state><left-reversed:3><right-reversed:3> |
| ``` |
|
|
| Exactly three `<step>` records follow, one each for the units, tens, and |
| hundreds columns. Every record has five digits: |
|
|
| ``` |
| <step><left-digit><right-digit><carry-in><output-digit><carry-out> |
| ``` |
|
|
| The answer is a four-digit, units-first magnitude; the fourth position holds |
| the final carry: |
|
|
| ``` |
| 457+386=<add><pos><state>754683<step>76031<step>58141<step>43180<ans>3480 |
| ``` |
|
|
| Here, `<ans>3480` decodes to `843`. |
|
|
| #### Subtraction (`<sub>`) |
|
|
| The state contains the larger magnitude followed by the smaller magnitude, both |
| zero-padded to three digits and reversed: |
|
|
| ``` |
| <state><larger-reversed:3><smaller-reversed:3> |
| ``` |
|
|
| Exactly three five-digit `<step>` records describe the units, tens, and |
| hundreds columns: |
|
|
| ``` |
| <step><minuend-digit><subtrahend-digit><borrow-in><output-digit><borrow-out> |
| ``` |
|
|
| The answer is a four-digit, units-first magnitude. Its sign comes from |
| `<result-sign>`: |
|
|
| ``` |
| 312-748=<sub><neg><state>847213<step>82060<step>41030<step>73040<ans>6340 |
| ``` |
|
|
| Here, `<neg>` and `<ans>6340` decode to `-436`. |
|
|
| #### Multiplication (`<mul>`) |
|
|
| The state contains the two zero-padded magnitudes in reversed, units-first |
| order. Five output columns are processed from least significant to most |
| significant. Across those columns the grammar contains nine term records, |
| distributed `1, 2, 3, 2, 1`, and five column-finalization records: |
|
|
| ``` |
| <step><left-digit><right-digit><product:2><running-total:3> |
| <col><output-digit><carry-out:2> |
| ``` |
|
|
| Each `<step>` therefore has seven digits and each `<col>` has three. The answer |
| is a six-digit, units-first product: |
|
|
| ``` |
| 213*145=<mul><pos><state>312541<step>3515015<col>501 … <col>300<ans>588030 |
| ``` |
|
|
| Here, `<ans>588030` decodes to `30885`. |
|
|
| #### Division (`<div>`) |
|
|
| Division retains ordinary most-significant-digit-first order. The state is the |
| zero-padded numerator followed by the zero-padded divisor: |
|
|
| ``` |
| <state><numerator:3><divisor:3> |
| ``` |
|
|
| For a nonzero divisor, long division has seven positions: three integer |
| positions, three retained decimal positions, and one guard position used for |
| round-half-up. Each position is decomposed into three records: |
|
|
| ``` |
| <step><remainder-in:3><incoming-digit><partial-dividend:4> |
| <qmul><quotient-digit><quotient-product:4> |
| <rem><remainder-out:3> |
| ``` |
|
|
| The fixed answer format is `DDD.ddd`: |
|
|
| ``` |
| 842/37=<div><pos><state>842037<step>00080008<qmul>00000<rem>008<step>00840084<qmul>20074<rem>010 … <ans>022.757 |
| ``` |
|
|
| Division by zero contains no arithmetic records and ends with the atomic |
| `<nan>` answer: |
|
|
| ``` |
| 12/0=<div><pos><state>012000<ans><nan> |
| ``` |
|
|
| ## How it was generated (and verified) |
|
|
| The complete dataset was generated deterministically with seed `20260722`. |
| Operands and sign patterns were sampled according to per-operation scenario |
| quotas so that each split contains its requested mix of identity cases, |
| carry/borrow patterns, multiplication column-sum bands, and exact or rounded |
| quotients. |
|
|
| Every accepted row passed the same structured validation pipeline: |
|
|
| 1. Parse and validate both signed operands and the requested operation. |
| 2. Construct the canonical magnitude operation, result sign, and normalized |
| six-digit state. |
| 3. Generate every structured arithmetic record and the serialized scratchpad. |
| 4. Reconstruct the internal answer from the step records and compare it with the |
| exact arithmetic result. |
| 5. Verify the serialized form, fixed field widths, token count, scenario label, |
| and row metadata. |
|
|
| The test split was generated first, followed by validation and training. |
| Prompts, canonical trace keys, sign-equivalent traces, and commutative swaps were |
| reserved before sampling later splits. The final integrity audit confirmed: |
|
|
| - 108,000 rows and 108,000 unique prompts; |
| - zero prompt overlap across train, validation, and test; |
| - zero canonical-trace overlap across splits; |
| - zero swapped-commutative leakage into held-out splits; |
| - every row successfully verified and within the declared token limit. |
|
|
| ## License |
|
|
| MIT. |
|
|