DataAlchemy / README.md
chengshuaizhao's picture
Add dataset card
bab6828 verified
metadata
license: mit
task_categories:
  - text-generation
tags:
  - chain-of-thought
  - reasoning
  - controlled-environment
  - symbolic
  - LLM
  - DataAlchemy
language:
  - en
pretty_name: >-
  DataAlchemy: A controllable laboratory for the science of Chain-of-Thought
  reasoning
size_categories:
  - 1M<n<10M
configs:
  - config_name: F1
    data_files: F1.jsonl
  - config_name: F2
    data_files: F2.jsonl
  - config_name: F1F1
    data_files: F1F1.jsonl
  - config_name: F1F2
    data_files: F1F2.jsonl
  - config_name: F2F1
    data_files: F2F1.jsonl
  - config_name: F2F2
    data_files: F2F2.jsonl
  - config_name: F1F1F1
    data_files: F1F1F1.jsonl
  - config_name: F2F2F2
    data_files: F2F2F2.jsonl

DataAlchemy: A Controllable Laboratory for the Science of Chain-of-Thought Reasoning

Paper Code Daily Dataset

Supplementary data collection for the paper "Is Chain-of-Thought Reasoning of LLMs a Mirage? A Data Distribution Lens" (ACL 2026). Full generator, trainer, and evaluator live in the GitHub repo.

TL;DR

A symbolic data collection for controlled study of Chain-of-Thought (CoT) reasoning in LLMs. Each record pairs a prompt with a step-by-step reasoning trace and a final answer, produced under the DataAlchemy framework. The files span multiple compositions of base transformations at varying reasoning depths, enabling systematic probes of how CoT behavior shifts as the test distribution drifts from the training distribution.

File inventory

All 8 files share identical generation settings: every element is a 4-atom sequence drawn from {A…Z}, [F1] is ROT-13 (shift each atom by 13 positions), [F2] is a cyclic left shift by one position, reasoning traces are enabled, and no noise or subsampling is applied. Enumerating every possible 4-atom element gives 456,976 records per file (≈ 3.66 M records total).

File Composition k # records CoT What the transformation does
F1.jsonl [F1] 1 456,976 ROT-13 on each atom
F2.jsonl [F2] 1 456,976 cyclic left shift by 1
F1F1.jsonl [F1] [F1] 2 456,976 ROT-13 twice (identity on atoms)
F1F2.jsonl [F1] [F2] 2 456,976 ROT-13, then cyclic shift
F2F1.jsonl [F2] [F1] 2 456,976 cyclic shift, then ROT-13
F2F2.jsonl [F2] [F2] 2 456,976 cyclic shift by 2 (equivalently)
F1F1F1.jsonl [F1] [F1] [F1] 3 456,976 ROT-13 three times
F2F2F2.jsonl [F2] [F2] [F2] 3 456,976 cyclic shift three times

How to load

from datasets import load_dataset

ds = load_dataset("ChengshuaiZhao0/DataAlchemy", name="F1F2", split="train")
print(ds[0])
# {'input': 'A A A A [F1] [F2] <think>',
#  'output': 'N N N N [F2] <answer> N N N N',
#  'element': 'A A A A', 'transformation': '[F1] [F2]',
#  'instruction': '<think>', 'reasoning': 'N N N N [F2]',
#  'answer': 'N N N N'}

Or load any file directly as raw JSONL:

import json
with open("F1F2.jsonl") as f:
    records = [json.loads(line) for line in f]

Record schema

One JSON object per line. Invariant: input == element + " " + transformation + " " + instruction, and the full rendered line is input + " " + output.

Field Type Meaning
input str What the LM conditions on: element + " " + transformation + " " + instruction.
output str What the LM should produce: reasoning trace (if any) + <answer> + final element.
element str Input element atoms, space-joined.
transformation str Transformation tokens, e.g. [F1] [F2].
instruction str Output-start marker: <think> for CoT, <answer> for no-CoT.
reasoning str Trace inside output before the final <answer>. Empty for k=1.
answer str Final element after <answer>.

Intended use

Two common usage examples:

  • Task generalization — pick subsets of the k=2 files (F1F1, F1F2, F2F1, F2F2) as training and test set. This probes how well CoT reasoning transfers to an unseen task of primitives.
  • Length / reasoning-depth generalization — use the single-primitive chains F1 → F1F1 → F1F1F1 (and analogously F2 → F2F2 → F2F2F2) to train at one depth k and evaluate at another. This probes whether CoT reasoning extrapolates to deeper reasoning chain than the model saw at training time.

Refer to experiments/ and the GitHub README for pre-wired launchers.

How the data was generated

Every file in this collection was produced with scripts/generate_data.py from the GitHub repo:

# k=1
python scripts/generate_data.py --transformations "[F1]" --element-length 4 --output data/F1.jsonl
python scripts/generate_data.py --transformations "[F2]" --element-length 4 --output data/F2.jsonl

# k=2
python scripts/generate_data.py --transformations "[F1]" "[F1]" --element-length 4 --output data/F1F1.jsonl
python scripts/generate_data.py --transformations "[F1]" "[F2]" --element-length 4 --output data/F1F2.jsonl
python scripts/generate_data.py --transformations "[F2]" "[F1]" --element-length 4 --output data/F2F1.jsonl
python scripts/generate_data.py --transformations "[F2]" "[F2]" --element-length 4 --output data/F2F2.jsonl

# k=3
python scripts/generate_data.py --transformations "[F1]" "[F1]" "[F1]" --element-length 4 --output data/F1F1F1.jsonl
python scripts/generate_data.py --transformations "[F2]" "[F2]" "[F2]" --element-length 4 --output data/F2F2F2.jsonl

Reproducibility & provenance

Every record is deterministic given --element-length, --rot-n, --pos-n, and the transformation list — no randomness is involved for these 8 base files. Re-running the commands above with the stated flags reproduces every file byte-for-byte.

License

Released under the MIT License.

Citation

If our data helped you out, we'd love it if you gave us a citation!

@article{zhao2025chain,
  title={Is Chain-of-Thought Reasoning of LLMs a Mirage? A Data Distribution Lens},
  author={Zhao, Chengshuai and Tan, Zhen and Ma, Pingchuan and Li, Dawei and Jiang, Bohan and Wang, Yancheng and Yang, Yingzhen and Liu, Huan},
  journal={arXiv preprint arXiv:2508.01191},
  year={2025}
}