Ajay0728 commited on
Commit
df2dcff
·
verified ·
1 Parent(s): d419302

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +142 -0
README.md CHANGED
@@ -1,3 +1,145 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ task_categories:
4
+ - text-generation
5
+ tags:
6
+ - arithmetic
7
+ - compositional-generalization
8
+ - length-generalization
9
+ - synthetic
10
+ size_categories:
11
+ - 10K<n<100K
12
+ configs:
13
+ - config_name: study1
14
+ field: data
15
+ data_files:
16
+ - split: train
17
+ path: study1/train.json
18
+ - split: validation
19
+ path: study1/val.json
20
+ - split: test
21
+ path: study1/test.json
22
+ - split: ood_ops4
23
+ path: study1/ood_ops4.json
24
+ - split: ood_ops5
25
+ path: study1/ood_ops5.json
26
+ - split: ood_ops6
27
+ path: study1/ood_ops6.json
28
+ - split: ood_ops7
29
+ path: study1/ood_ops7.json
30
+ - config_name: study2
31
+ field: data
32
+ data_files:
33
+ - split: train
34
+ path: study2/train.json
35
+ - split: validation
36
+ path: study2/val.json
37
+ - split: test
38
+ path: study2/test.json
39
+ - split: ood
40
+ path: study2/ood.json
41
  ---
42
+
43
+ # Compositional Reasoning on Arithmetic: Datasets (v2)
44
+
45
+ These are synthetic arithmetic datasets for testing whether sequence-to-sequence models generalize to longer expressions (Study 1) and more deeply nested ones (Study 2). They were used in the paper *Partial Competence and Limited Transfer: Comparing LSTM and Transformer Generalization on Arithmetic Expressions* (arXiv ID pending).
46
+
47
+ Each example is a fully parenthesized integer expression paired with its value:
48
+
49
+ ```
50
+ input: (((15 - 3) + 10) + (17 * 20))
51
+ output: 362
52
+ ```
53
+
54
+ - **Code and generator:** https://github.com/bcode0127-debug/Compositional-Reasoning-Arithmetic (`data/generate_controlled.py`)
55
+ - **Trained models:** [Ajay0728/Compositional-reasoning-arithmetic](https://huggingface.co/Ajay0728/Compositional-reasoning-arithmetic)
56
+
57
+ ## Studies and splits
58
+
59
+ **Study 1: length generalization.** Models train on 2–3 operations and are tested on 4–7.
60
+
61
+ | Split | File | Size | Expressions |
62
+ |---|---|---|---|
63
+ | train | `study1/train.json` | 8,000 | 2 ops depth 2, 3 ops depth 2, 3 ops depth 3 chain (one third each) |
64
+ | validation | `study1/val.json` | 1,000 | same mix as train |
65
+ | test | `study1/test.json` | 1,000 | same mix as train |
66
+ | ood_ops4 | `study1/ood_ops4.json` | 1,000 | 4 ops, depth 3, balanced |
67
+ | ood_ops5 | `study1/ood_ops5.json` | 1,000 | 5 ops, depth 3, balanced |
68
+ | ood_ops6 | `study1/ood_ops6.json` | 1,000 | 6 ops, depth 3, balanced |
69
+ | ood_ops7 | `study1/ood_ops7.json` | 1,000 | 7 ops, depth 3, balanced |
70
+
71
+ **Study 2: depth generalization.** The number of operations stays at 3 while nesting depth goes from 2 to 3.
72
+
73
+ | Split | File | Size | Expressions |
74
+ |---|---|---|---|
75
+ | train | `study2/train.json` | 8,000 | 3 ops, depth 2, balanced |
76
+ | validation | `study2/val.json` | 1,000 | 3 ops, depth 2, balanced |
77
+ | test | `study2/test.json` | 1,000 | 3 ops, depth 2, balanced |
78
+ | ood | `study2/ood.json` | 1,000 | 3 ops, depth 3, chain |
79
+
80
+ Each split was generated with its own random seed. The test splits were generated after the models were trained, from generator commit `f636492`, so they were never used for model selection. Every other split comes from commit `f504457`.
81
+
82
+ ## Usage
83
+
84
+ ```python
85
+ from datasets import load_dataset
86
+
87
+ s1 = load_dataset("Ajay0728/Compositional-reasoning-arithmetic-datasets", "study1")
88
+ print(s1["train"][0]["input"], "->", s1["train"][0]["output"])
89
+ ood7 = load_dataset("Ajay0728/Compositional-reasoning-arithmetic-datasets", "study1", split="ood_ops7")
90
+ ```
91
+
92
+ You can also download the raw JSON files directly. Each file is a JSON object with the examples under `"data"` and the generation metadata in the other top-level keys.
93
+
94
+ ## Fields
95
+
96
+ Each example has these fields:
97
+
98
+ | Field | Type | Description |
99
+ |---|---|---|
100
+ | `input` | string | Model input: the fully parenthesized expression, with spaces around operators |
101
+ | `output` | string | Target: the integer result as a string |
102
+ | `expression` | string | Same as `input` |
103
+ | `result` | int | Integer value of the expression |
104
+ | `num_operations` | int | Number of binary operators |
105
+ | `depth` | int | Depth of the expression tree |
106
+ | `intermediate_max` | int | Largest absolute intermediate value during evaluation |
107
+ | `operator_counts` | dict | Count of each of `+ - * /` |
108
+ | `seed_id` | int | Index of the generator seed this example came from |
109
+
110
+ Each file also has these top-level metadata keys:
111
+
112
+ - `study`, `split`, `seed`, `generator_commit`, `timestamp`
113
+ - `buckets`: the operation count, depth, tree shape and rejection rate for each group of expressions
114
+ - `operator_distribution_actual`: how often each operator actually appears
115
+
116
+ ## How the data was generated
117
+
118
+ Each expression is built as a random binary expression tree with a target operation count, depth, and shape. A shape is either *balanced* or *chain*, where a chain nests to one side only. Candidates are rejected unless:
119
+
120
+ - every division is exact (integer result, no remainder, no division by zero)
121
+ - the final result satisfies |result| ≤ 10,000
122
+
123
+ All inputs are at most 51 characters long. Outputs are at most 6 characters (e.g. `-10000`).
124
+
125
+ **Operator balance:** division is rare in every split, about 3–5% of operators, because the exact-division requirement rejects most division candidates. The other three operators make up roughly 28–35% each. Results broken down by operator, especially for division, should account for these small counts.
126
+
127
+ ## Integrity
128
+
129
+ `CHECKSUMS.txt` lists the SHA-256 hash of each file. Its paths start with `datasets_v2/`, so to verify, put the files in a folder named `datasets_v2` and run `shasum -a 256 -c CHECKSUMS.txt` from that folder's parent.
130
+
131
+ ## Superseded version
132
+
133
+ An earlier version of these datasets, `datasets/` in the GitHub repo, was used with an evaluation path that silently cut inputs to 20 characters. Results from that version are retired. This v2 release is the one used for every number reported in the paper.
134
+
135
+ ## Citation
136
+
137
+ ```bibtex
138
+ @misc{jamanjyothi2026partial,
139
+ title = {Partial Competence and Limited Transfer: Comparing LSTM and Transformer
140
+ Generalization on Arithmetic Expressions},
141
+ author = {Jamanjyothi, Ajay},
142
+ year = {2026},
143
+ note = {arXiv preprint (ID pending)}
144
+ }
145
+ ```