Datasets:
Twist Shan commited on
Publish v1.0.1 raw snapshot and reproducible build process
Browse filesAdd the complete 1,415,420-row raw candidate pool used by the v1 protocol, raw provenance and license notices, exact build and verification scripts, and metadata manifests. Processed Parquet split contents remain byte-identical to v1.0.0.
- .gitattributes +6 -0
- RAW_DATA_LICENSES.md +25 -0
- README.md +18 -4
- docs/BUILDING.md +36 -0
- metadata/audit.json +1 -1
- metadata/manifest.json +74 -6
- metadata/raw_manifest.json +67 -0
- metadata/split_spec.json +1 -1
- raw/README.md +23 -0
- raw/processed/sudoku_extreme_test_r0.csv +3 -0
- raw/processed/sudoku_extreme_test_r1_4.csv +3 -0
- raw/processed/sudoku_extreme_test_r5_19.csv +3 -0
- raw/processed/sudoku_extreme_train_r0.csv +3 -0
- raw/processed/sudoku_extreme_train_r1_4.csv +3 -0
- raw/sudoku_test.csv +0 -0
- raw/sudoku_train.csv +3 -0
- raw/upstream_processed_manifest.json +22 -0
- scripts/build_dataset.py +206 -31
- scripts/verify_dataset.py +275 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
raw/processed/sudoku_extreme_test_r0.csv filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
raw/processed/sudoku_extreme_test_r1_4.csv filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
raw/processed/sudoku_extreme_test_r5_19.csv filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
raw/processed/sudoku_extreme_train_r0.csv filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
raw/processed/sudoku_extreme_train_r1_4.csv filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
raw/sudoku_train.csv filter=lfs diff=lfs merge=lfs -text
|
RAW_DATA_LICENSES.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Raw data licensing and provenance notice
|
| 2 |
+
|
| 3 |
+
This dataset repository uses `license: other` because the included raw data does
|
| 4 |
+
not have one uniform declared license.
|
| 5 |
+
|
| 6 |
+
- Construction code in `hengyuf/diffusion-vs-ar` is distributed under the
|
| 7 |
+
Apache License 2.0. That software license does not automatically relicense all
|
| 8 |
+
third-party puzzle data.
|
| 9 |
+
- The original easy Sudoku CSV files are mirrored from the pinned
|
| 10 |
+
`fhyfhy/diffusion-vs-ar-hard-sudoku` dataset snapshot.
|
| 11 |
+
- The `sudoku_extreme_*` files derive from `sapientinc/sudoku-extreme`, which
|
| 12 |
+
combines several community benchmark sources and does not declare one uniform
|
| 13 |
+
dataset license.
|
| 14 |
+
|
| 15 |
+
Files under `raw/` are unmodified research mirrors with byte-level provenance in
|
| 16 |
+
`metadata/raw_manifest.json`. Their inclusion here does not grant rights beyond
|
| 17 |
+
those provided by their respective upstream sources. Users are responsible for
|
| 18 |
+
reviewing and complying with the upstream terms before redistribution or use,
|
| 19 |
+
especially outside research contexts.
|
| 20 |
+
|
| 21 |
+
Upstream references:
|
| 22 |
+
|
| 23 |
+
- https://huggingface.co/datasets/fhyfhy/diffusion-vs-ar-hard-sudoku
|
| 24 |
+
- https://huggingface.co/datasets/sapientinc/sudoku-extreme
|
| 25 |
+
- https://github.com/hengyuf/diffusion-vs-ar/tree/hard-sudoku-datasets
|
README.md
CHANGED
|
@@ -25,10 +25,22 @@ configs:
|
|
| 25 |
# Sudoku DLM Reasoning
|
| 26 |
|
| 27 |
`stwistzz/Sudoku_DLM_Reasoning` is a deterministic 9x9 Sudoku benchmark for studying masked
|
| 28 |
-
diffusion language models, depth, and iterative decoding. Version 1.0.
|
| 29 |
trains only on `original`, `r0`, and `r1_4`; `r5_19` is held out for adjacent
|
| 30 |
difficulty extrapolation.
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
## Splits
|
| 33 |
|
| 34 |
| split | original | r0 | r1_4 | r5_19 | total |
|
|
@@ -99,17 +111,18 @@ cell in `puzzle`.
|
|
| 99 |
|
| 100 |
## Rebuild
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
```bash
|
| 105 |
python scripts/build_dataset.py \
|
| 106 |
-
--source-dir
|
| 107 |
--output-dir /path/to/release \
|
| 108 |
--dataset-id stwistzz/Sudoku_DLM_Reasoning \
|
| 109 |
--seed 20260815
|
| 110 |
```
|
| 111 |
|
| 112 |
-
The builder requires Python 3.10+ and PyArrow.
|
|
|
|
| 113 |
|
| 114 |
## Attribution and license
|
| 115 |
|
|
@@ -120,3 +133,4 @@ which packages the original Sudoku data from
|
|
| 120 |
[`sapientinc/sudoku-extreme`](https://huggingface.co/datasets/sapientinc/sudoku-extreme)
|
| 121 |
corpus. Please consult and comply with the licenses and attribution requirements
|
| 122 |
of all upstream sources. This derived release does not grant rights beyond them.
|
|
|
|
|
|
| 25 |
# Sudoku DLM Reasoning
|
| 26 |
|
| 27 |
`stwistzz/Sudoku_DLM_Reasoning` is a deterministic 9x9 Sudoku benchmark for studying masked
|
| 28 |
+
diffusion language models, depth, and iterative decoding. Version 1.0.1
|
| 29 |
trains only on `original`, `r0`, and `r1_4`; `r5_19` is held out for adjacent
|
| 30 |
difficulty extrapolation.
|
| 31 |
|
| 32 |
+
## Repository layout
|
| 33 |
+
|
| 34 |
+
- `raw/`: complete 1,415,420-row candidate snapshot used by this protocol
|
| 35 |
+
- `data/`: selected, leakage-audited Parquet splits used for experiments
|
| 36 |
+
- `metadata/`: source/release hashes, split specification, and audits
|
| 37 |
+
- `scripts/`: deterministic builder and independent verifier
|
| 38 |
+
- `docs/BUILDING.md`: end-to-end reconstruction instructions
|
| 39 |
+
|
| 40 |
+
Files under `raw/` are explicitly source data and are not loaded as extra splits.
|
| 41 |
+
Only the four `data/*.parquet` paths declared in the card metadata form the
|
| 42 |
+
`default` dataset config.
|
| 43 |
+
|
| 44 |
## Splits
|
| 45 |
|
| 46 |
| split | original | r0 | r1_4 | r5_19 | total |
|
|
|
|
| 111 |
|
| 112 |
## Rebuild
|
| 113 |
|
| 114 |
+
The pinned source CSV files are included under `raw/`. Run:
|
| 115 |
|
| 116 |
```bash
|
| 117 |
python scripts/build_dataset.py \
|
| 118 |
+
--source-dir raw \
|
| 119 |
--output-dir /path/to/release \
|
| 120 |
--dataset-id stwistzz/Sudoku_DLM_Reasoning \
|
| 121 |
--seed 20260815
|
| 122 |
```
|
| 123 |
|
| 124 |
+
The builder requires Python 3.10+ and PyArrow. See `docs/BUILDING.md`, then run
|
| 125 |
+
`scripts/verify_dataset.py` against the rebuilt release.
|
| 126 |
|
| 127 |
## Attribution and license
|
| 128 |
|
|
|
|
| 133 |
[`sapientinc/sudoku-extreme`](https://huggingface.co/datasets/sapientinc/sudoku-extreme)
|
| 134 |
corpus. Please consult and comply with the licenses and attribution requirements
|
| 135 |
of all upstream sources. This derived release does not grant rights beyond them.
|
| 136 |
+
See `RAW_DATA_LICENSES.md` for the raw-snapshot notice.
|
docs/BUILDING.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Building the processed dataset from `raw/`
|
| 2 |
+
|
| 3 |
+
The repository is self-contained for reconstructing the processed release.
|
| 4 |
+
|
| 5 |
+
## Inputs
|
| 6 |
+
|
| 7 |
+
- Raw snapshot: `raw/`
|
| 8 |
+
- Dataset ID: `stwistzz/Sudoku_DLM_Reasoning`
|
| 9 |
+
- Release seed: `20260815`
|
| 10 |
+
- Upstream revision: `527859f62c745c16833aded130ad9f9ddddb76af`
|
| 11 |
+
|
| 12 |
+
First verify that the raw files match `metadata/raw_manifest.json`. Then run the
|
| 13 |
+
builder from the repository root:
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
python scripts/build_dataset.py \
|
| 17 |
+
--source-dir raw \
|
| 18 |
+
--output-dir rebuilt-release \
|
| 19 |
+
--dataset-id stwistzz/Sudoku_DLM_Reasoning \
|
| 20 |
+
--seed 20260815
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
The builder performs two full source scans. It validates formats and clues,
|
| 24 |
+
protects all upstream test IDs, removes exact and digit-renaming-equivalent
|
| 25 |
+
cross-split overlap, allocates metadata-stratified quotas, selects by seeded
|
| 26 |
+
SHA-256 rank, validates every selected Sudoku solution, and writes Parquet plus
|
| 27 |
+
machine-readable audits.
|
| 28 |
+
|
| 29 |
+
Verify the result independently:
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
python scripts/verify_dataset.py rebuilt-release --expected-version 1.0.1
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
The expected processed split hashes are recorded in `metadata/manifest.json`.
|
| 36 |
+
Timestamp fields may differ across rebuilds; the Parquet content hashes must not.
|
metadata/audit.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"dataset_version": "1.0.
|
| 3 |
"pairwise_overlap": {
|
| 4 |
"test__vs__test_ood_confirm": {
|
| 5 |
"digit_normalized_id": 0,
|
|
|
|
| 1 |
{
|
| 2 |
+
"dataset_version": "1.0.1",
|
| 3 |
"pairwise_overlap": {
|
| 4 |
"test__vs__test_ood_confirm": {
|
| 5 |
"digit_normalized_id": 0,
|
metadata/manifest.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
| 1 |
{
|
| 2 |
"audit_file": "metadata/audit.json",
|
| 3 |
"dataset_id": "stwistzz/Sudoku_DLM_Reasoning",
|
| 4 |
-
"dataset_version": "1.0.
|
| 5 |
"files": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"data/test.parquet": {
|
| 7 |
"bytes": 742254,
|
| 8 |
"rows": 4000,
|
|
@@ -23,20 +31,80 @@
|
|
| 23 |
"rows": 6144,
|
| 24 |
"sha256": "2d63592476956148d5ae836d21ff19b5a7962bcb3caf3e4147e77faa2e09b688"
|
| 25 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
"metadata/audit.json": {
|
| 27 |
"bytes": 5465,
|
| 28 |
-
"sha256": "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
},
|
| 30 |
"metadata/split_spec.json": {
|
| 31 |
"bytes": 849,
|
| 32 |
-
"sha256": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
},
|
| 34 |
"scripts/build_dataset.py": {
|
| 35 |
-
"bytes":
|
| 36 |
-
"sha256": "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
}
|
| 38 |
},
|
| 39 |
-
"generated_at_utc": "2026-08-
|
|
|
|
| 40 |
"schema": [
|
| 41 |
{
|
| 42 |
"name": "example_id",
|
|
|
|
| 1 |
{
|
| 2 |
"audit_file": "metadata/audit.json",
|
| 3 |
"dataset_id": "stwistzz/Sudoku_DLM_Reasoning",
|
| 4 |
+
"dataset_version": "1.0.1",
|
| 5 |
"files": {
|
| 6 |
+
"RAW_DATA_LICENSES.md": {
|
| 7 |
+
"bytes": 1252,
|
| 8 |
+
"sha256": "4749d8f59f442d90f1241e37ee2a6de27e0de0bc9b2712ec8a44a5a64e4a0c95"
|
| 9 |
+
},
|
| 10 |
+
"README.md": {
|
| 11 |
+
"bytes": 5349,
|
| 12 |
+
"sha256": "812dc60c7543bd923a04eac5ef12391996063137966b1d717c9344cf0f309e6f"
|
| 13 |
+
},
|
| 14 |
"data/test.parquet": {
|
| 15 |
"bytes": 742254,
|
| 16 |
"rows": 4000,
|
|
|
|
| 31 |
"rows": 6144,
|
| 32 |
"sha256": "2d63592476956148d5ae836d21ff19b5a7962bcb3caf3e4147e77faa2e09b688"
|
| 33 |
},
|
| 34 |
+
"docs/BUILDING.md": {
|
| 35 |
+
"bytes": 1228,
|
| 36 |
+
"sha256": "5c4d605f33bfc700afba5a37ce8049ea48a24e64e0e6eb9b3cce2c18d103fa87"
|
| 37 |
+
},
|
| 38 |
"metadata/audit.json": {
|
| 39 |
"bytes": 5465,
|
| 40 |
+
"sha256": "970bd16c1120344e1eb04a5325b0ba45d592b79b4360317b35da9a099b0b030d"
|
| 41 |
+
},
|
| 42 |
+
"metadata/raw_manifest.json": {
|
| 43 |
+
"bytes": 2592,
|
| 44 |
+
"sha256": "d061c6a3e1b29e796cd8e5a2daae1180efbdde67a78f351ec3f6d254bfb91971"
|
| 45 |
},
|
| 46 |
"metadata/split_spec.json": {
|
| 47 |
"bytes": 849,
|
| 48 |
+
"sha256": "18e4e6ffe8dbd843a9882ad78164da7152532a214ef7d9dcd4460a59c6f775e1"
|
| 49 |
+
},
|
| 50 |
+
"raw/README.md": {
|
| 51 |
+
"bytes": 1187,
|
| 52 |
+
"sha256": "101942ebbc7a1550e9a304d89e29dcd771e036d377eb73cfe94f5decd92c1be5"
|
| 53 |
+
},
|
| 54 |
+
"raw/processed/sudoku_extreme_test_r0.csv": {
|
| 55 |
+
"bytes": 13913402,
|
| 56 |
+
"rows": 61127,
|
| 57 |
+
"sha256": "37c7b2dae5a09341bfc8dbd3c674d7671d7bf5df8a2dedcc69992e7202796bd6"
|
| 58 |
+
},
|
| 59 |
+
"raw/processed/sudoku_extreme_test_r1_4.csv": {
|
| 60 |
+
"bytes": 13545003,
|
| 61 |
+
"rows": 58717,
|
| 62 |
+
"sha256": "398d806a65818104b2696e1363aded5d1b4d328789547bd2b68a263735282cf8"
|
| 63 |
+
},
|
| 64 |
+
"raw/processed/sudoku_extreme_test_r5_19.csv": {
|
| 65 |
+
"bytes": 26407097,
|
| 66 |
+
"rows": 111831,
|
| 67 |
+
"sha256": "93852c0de8b7c6731a247ad6b28d4f64bfd33aa752a121b989180a7a767d7b5b"
|
| 68 |
+
},
|
| 69 |
+
"raw/processed/sudoku_extreme_train_r0.csv": {
|
| 70 |
+
"bytes": 126425169,
|
| 71 |
+
"rows": 553009,
|
| 72 |
+
"sha256": "c2d1930e4ca1d857943042e7ea0396bb7de29d4f793ac9e9cc304ed3de80f035"
|
| 73 |
+
},
|
| 74 |
+
"raw/processed/sudoku_extreme_train_r1_4.csv": {
|
| 75 |
+
"bytes": 122726060,
|
| 76 |
+
"rows": 529736,
|
| 77 |
+
"sha256": "b7f8701f34aba3003298d03580a53d1ac73c1f5930704d621b11781977f891b8"
|
| 78 |
+
},
|
| 79 |
+
"raw/sudoku_test.csv": {
|
| 80 |
+
"bytes": 165019,
|
| 81 |
+
"rows": 1000,
|
| 82 |
+
"sha256": "36779035c7278bef48f1f4edba67def0d463195ca333ce1857c0bf79e48153c4"
|
| 83 |
+
},
|
| 84 |
+
"raw/sudoku_train.csv": {
|
| 85 |
+
"bytes": 16500019,
|
| 86 |
+
"rows": 100000,
|
| 87 |
+
"sha256": "b9c13489f2a68af96074c12feccaf90bb9e87e0589df41bef4922b0ebe219a4e"
|
| 88 |
+
},
|
| 89 |
+
"raw/upstream_processed_manifest.json": {
|
| 90 |
+
"bytes": 806,
|
| 91 |
+
"sha256": "4fe25596a1845e6033e1ffbf787fe640529cf4b4ffead313e38ddfbeccd01cd4"
|
| 92 |
+
},
|
| 93 |
+
"requirements.txt": {
|
| 94 |
+
"bytes": 13,
|
| 95 |
+
"sha256": "1842dad6fc80950a344e79b6831aeacf39f51f9949742de90114bccb350a26a9"
|
| 96 |
},
|
| 97 |
"scripts/build_dataset.py": {
|
| 98 |
+
"bytes": 44856,
|
| 99 |
+
"sha256": "1133254160b1496d6bc017753247c98acf8dc06d5ab494db15a98f19bfd75090"
|
| 100 |
+
},
|
| 101 |
+
"scripts/verify_dataset.py": {
|
| 102 |
+
"bytes": 10838,
|
| 103 |
+
"sha256": "1cc3a341225c6aa700ec6d675e675d75982ee6325682d643112000010e6571bd"
|
| 104 |
}
|
| 105 |
},
|
| 106 |
+
"generated_at_utc": "2026-08-15T17:06:43.211264+00:00",
|
| 107 |
+
"raw_snapshot_file": "metadata/raw_manifest.json",
|
| 108 |
"schema": [
|
| 109 |
{
|
| 110 |
"name": "example_id",
|
metadata/raw_manifest.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"candidate_rows": 1415420,
|
| 3 |
+
"files": {
|
| 4 |
+
"raw/processed/sudoku_extreme_test_r0.csv": {
|
| 5 |
+
"bytes": 13913402,
|
| 6 |
+
"difficulty_bucket": "r0",
|
| 7 |
+
"rows": 61127,
|
| 8 |
+
"sha256": "37c7b2dae5a09341bfc8dbd3c674d7671d7bf5df8a2dedcc69992e7202796bd6",
|
| 9 |
+
"upstream_path": "processed/sudoku_extreme_test_r0.csv",
|
| 10 |
+
"upstream_split": "test"
|
| 11 |
+
},
|
| 12 |
+
"raw/processed/sudoku_extreme_test_r1_4.csv": {
|
| 13 |
+
"bytes": 13545003,
|
| 14 |
+
"difficulty_bucket": "r1_4",
|
| 15 |
+
"rows": 58717,
|
| 16 |
+
"sha256": "398d806a65818104b2696e1363aded5d1b4d328789547bd2b68a263735282cf8",
|
| 17 |
+
"upstream_path": "processed/sudoku_extreme_test_r1_4.csv",
|
| 18 |
+
"upstream_split": "test"
|
| 19 |
+
},
|
| 20 |
+
"raw/processed/sudoku_extreme_test_r5_19.csv": {
|
| 21 |
+
"bytes": 26407097,
|
| 22 |
+
"difficulty_bucket": "r5_19",
|
| 23 |
+
"rows": 111831,
|
| 24 |
+
"sha256": "93852c0de8b7c6731a247ad6b28d4f64bfd33aa752a121b989180a7a767d7b5b",
|
| 25 |
+
"upstream_path": "processed/sudoku_extreme_test_r5_19.csv",
|
| 26 |
+
"upstream_split": "test"
|
| 27 |
+
},
|
| 28 |
+
"raw/processed/sudoku_extreme_train_r0.csv": {
|
| 29 |
+
"bytes": 126425169,
|
| 30 |
+
"difficulty_bucket": "r0",
|
| 31 |
+
"rows": 553009,
|
| 32 |
+
"sha256": "c2d1930e4ca1d857943042e7ea0396bb7de29d4f793ac9e9cc304ed3de80f035",
|
| 33 |
+
"upstream_path": "processed/sudoku_extreme_train_r0.csv",
|
| 34 |
+
"upstream_split": "train"
|
| 35 |
+
},
|
| 36 |
+
"raw/processed/sudoku_extreme_train_r1_4.csv": {
|
| 37 |
+
"bytes": 122726060,
|
| 38 |
+
"difficulty_bucket": "r1_4",
|
| 39 |
+
"rows": 529736,
|
| 40 |
+
"sha256": "b7f8701f34aba3003298d03580a53d1ac73c1f5930704d621b11781977f891b8",
|
| 41 |
+
"upstream_path": "processed/sudoku_extreme_train_r1_4.csv",
|
| 42 |
+
"upstream_split": "train"
|
| 43 |
+
},
|
| 44 |
+
"raw/sudoku_test.csv": {
|
| 45 |
+
"bytes": 165019,
|
| 46 |
+
"difficulty_bucket": "original",
|
| 47 |
+
"rows": 1000,
|
| 48 |
+
"sha256": "36779035c7278bef48f1f4edba67def0d463195ca333ce1857c0bf79e48153c4",
|
| 49 |
+
"upstream_path": "sudoku_test.csv",
|
| 50 |
+
"upstream_split": "test"
|
| 51 |
+
},
|
| 52 |
+
"raw/sudoku_train.csv": {
|
| 53 |
+
"bytes": 16500019,
|
| 54 |
+
"difficulty_bucket": "original",
|
| 55 |
+
"rows": 100000,
|
| 56 |
+
"sha256": "b9c13489f2a68af96074c12feccaf90bb9e87e0589df41bef4922b0ebe219a4e",
|
| 57 |
+
"upstream_path": "sudoku_train.csv",
|
| 58 |
+
"upstream_split": "train"
|
| 59 |
+
}
|
| 60 |
+
},
|
| 61 |
+
"label": "raw",
|
| 62 |
+
"license_notice": "RAW_DATA_LICENSES.md",
|
| 63 |
+
"scope": "complete candidate pool used by the v1 protocol",
|
| 64 |
+
"source_repo": "fhyfhy/diffusion-vs-ar-hard-sudoku",
|
| 65 |
+
"source_revision": "527859f62c745c16833aded130ad9f9ddddb76af",
|
| 66 |
+
"upstream_processed_manifest": "raw/upstream_processed_manifest.json"
|
| 67 |
+
}
|
metadata/split_spec.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
"train_per_bucket": 65536,
|
| 15 |
"validation_per_bucket": 2048
|
| 16 |
},
|
| 17 |
-
"dataset_version": "1.0.
|
| 18 |
"ood_bucket": "r5_19",
|
| 19 |
"seed": "20260815",
|
| 20 |
"selection": "metadata-stratified bottom-k SHA-256 rank",
|
|
|
|
| 14 |
"train_per_bucket": 65536,
|
| 15 |
"validation_per_bucket": 2048
|
| 16 |
},
|
| 17 |
+
"dataset_version": "1.0.1",
|
| 18 |
"ood_bucket": "r5_19",
|
| 19 |
"seed": "20260815",
|
| 20 |
"selection": "metadata-stratified bottom-k SHA-256 rank",
|
raw/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Raw source snapshot
|
| 2 |
+
|
| 3 |
+
This directory is explicitly labeled **raw**. It contains unmodified copies of
|
| 4 |
+
the seven upstream CSV files scanned by the `1.0.1` builder:
|
| 5 |
+
|
| 6 |
+
| raw path | upstream split | difficulty | rows |
|
| 7 |
+
|---|---|---|---:|
|
| 8 |
+
| `sudoku_train.csv` | train | original | 100,000 |
|
| 9 |
+
| `sudoku_test.csv` | test | original | 1,000 |
|
| 10 |
+
| `processed/sudoku_extreme_train_r0.csv` | train | r0 | 553,009 |
|
| 11 |
+
| `processed/sudoku_extreme_test_r0.csv` | test | r0 | 61,127 |
|
| 12 |
+
| `processed/sudoku_extreme_train_r1_4.csv` | train | r1_4 | 529,736 |
|
| 13 |
+
| `processed/sudoku_extreme_test_r1_4.csv` | test | r1_4 | 58,717 |
|
| 14 |
+
| `processed/sudoku_extreme_test_r5_19.csv` | test | r5_19 | 111,831 |
|
| 15 |
+
|
| 16 |
+
Total: **1,415,420 rows**. This is the complete candidate pool for the v1
|
| 17 |
+
protocol, not the complete 8.1M-row upstream repository. Unused difficulty
|
| 18 |
+
buckets and unrelated dataset families are intentionally excluded.
|
| 19 |
+
|
| 20 |
+
These files are not additional Hugging Face splits. The dataset card explicitly
|
| 21 |
+
maps only `data/*.parquet` into the `default` config. See
|
| 22 |
+
`metadata/raw_manifest.json` for SHA-256 hashes and exact provenance, and
|
| 23 |
+
`RAW_DATA_LICENSES.md` before redistributing the raw files.
|
raw/processed/sudoku_extreme_test_r0.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37c7b2dae5a09341bfc8dbd3c674d7671d7bf5df8a2dedcc69992e7202796bd6
|
| 3 |
+
size 13913402
|
raw/processed/sudoku_extreme_test_r1_4.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:398d806a65818104b2696e1363aded5d1b4d328789547bd2b68a263735282cf8
|
| 3 |
+
size 13545003
|
raw/processed/sudoku_extreme_test_r5_19.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:93852c0de8b7c6731a247ad6b28d4f64bfd33aa752a121b989180a7a767d7b5b
|
| 3 |
+
size 26407097
|
raw/processed/sudoku_extreme_train_r0.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2d1930e4ca1d857943042e7ea0396bb7de29d4f793ac9e9cc304ed3de80f035
|
| 3 |
+
size 126425169
|
raw/processed/sudoku_extreme_train_r1_4.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7f8701f34aba3003298d03580a53d1ac73c1f5930704d621b11781977f891b8
|
| 3 |
+
size 122726060
|
raw/sudoku_test.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
raw/sudoku_train.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9c13489f2a68af96074c12feccaf90bb9e87e0589df41bef4922b0ebe219a4e
|
| 3 |
+
size 16500019
|
raw/upstream_processed_manifest.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"sudoku_exchange_train_diabolical": 119681,
|
| 3 |
+
"sudoku_exchange_train_easy": 100000,
|
| 4 |
+
"sudoku_exchange_train_hard": 321592,
|
| 5 |
+
"sudoku_exchange_train_medium": 352643,
|
| 6 |
+
"sudoku_extreme_test_r0": 61127,
|
| 7 |
+
"sudoku_extreme_test_r100_plus": 4364,
|
| 8 |
+
"sudoku_extreme_test_r1_4": 58717,
|
| 9 |
+
"sudoku_extreme_test_r20_49": 143851,
|
| 10 |
+
"sudoku_extreme_test_r50_99": 42896,
|
| 11 |
+
"sudoku_extreme_test_r5_19": 111831,
|
| 12 |
+
"sudoku_extreme_train_r0": 553009,
|
| 13 |
+
"sudoku_extreme_train_r100_plus": 40656,
|
| 14 |
+
"sudoku_extreme_train_r1_4": 529736,
|
| 15 |
+
"sudoku_extreme_train_r20_49": 1306567,
|
| 16 |
+
"sudoku_extreme_train_r50_99": 382534,
|
| 17 |
+
"sudoku_extreme_train_r5_19": 1019492,
|
| 18 |
+
"sudoku_kaggle3m_train_r0": 1294081,
|
| 19 |
+
"sudoku_kaggle3m_train_r1_2": 812419,
|
| 20 |
+
"sudoku_kaggle3m_train_r2_4": 816076,
|
| 21 |
+
"sudoku_kaggle3m_train_r4_plus": 77424
|
| 22 |
+
}
|
scripts/build_dataset.py
CHANGED
|
@@ -32,7 +32,7 @@ import pyarrow as pa
|
|
| 32 |
import pyarrow.parquet as pq
|
| 33 |
|
| 34 |
|
| 35 |
-
DATASET_VERSION = "1.0.
|
| 36 |
DEFAULT_DATASET_ID = "stwistzz/Sudoku_DLM_Reasoning"
|
| 37 |
DEFAULT_SEED = "20260815"
|
| 38 |
SOURCE_REPO = "fhyfhy/diffusion-vs-ar-hard-sudoku"
|
|
@@ -596,6 +596,134 @@ def source_metadata(source_dir: Path, specs: Iterable[PoolSpec]) -> dict[str, ob
|
|
| 596 |
return result
|
| 597 |
|
| 598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
def render_readme(dataset_id: str, seed: str) -> str:
|
| 600 |
return f"""---
|
| 601 |
license: other
|
|
@@ -628,6 +756,18 @@ diffusion language models, depth, and iterative decoding. Version {DATASET_VERSI
|
|
| 628 |
trains only on `original`, `r0`, and `r1_4`; `r5_19` is held out for adjacent
|
| 629 |
difficulty extrapolation.
|
| 630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
## Splits
|
| 632 |
|
| 633 |
| split | original | r0 | r1_4 | r5_19 | total |
|
|
@@ -698,17 +838,18 @@ cell in `puzzle`.
|
|
| 698 |
|
| 699 |
## Rebuild
|
| 700 |
|
| 701 |
-
|
| 702 |
|
| 703 |
```bash
|
| 704 |
python scripts/build_dataset.py \\
|
| 705 |
-
--source-dir
|
| 706 |
--output-dir /path/to/release \\
|
| 707 |
--dataset-id {dataset_id} \\
|
| 708 |
--seed {seed}
|
| 709 |
```
|
| 710 |
|
| 711 |
-
The builder requires Python 3.10+ and PyArrow.
|
|
|
|
| 712 |
|
| 713 |
## Attribution and license
|
| 714 |
|
|
@@ -719,6 +860,7 @@ which packages the original Sudoku data from
|
|
| 719 |
[`sapientinc/sudoku-extreme`](https://huggingface.co/datasets/sapientinc/sudoku-extreme)
|
| 720 |
corpus. Please consult and comply with the licenses and attribution requirements
|
| 721 |
of all upstream sources. This derived release does not grant rights beyond them.
|
|
|
|
| 722 |
"""
|
| 723 |
|
| 724 |
|
|
@@ -737,17 +879,19 @@ def build_dataset(
|
|
| 737 |
data_dir = output_dir / "data"
|
| 738 |
metadata_dir = output_dir / "metadata"
|
| 739 |
scripts_dir = output_dir / "scripts"
|
|
|
|
| 740 |
data_dir.mkdir()
|
| 741 |
metadata_dir.mkdir()
|
| 742 |
scripts_dir.mkdir()
|
|
|
|
| 743 |
|
| 744 |
test_specs = ordered_specs("test", TEST_PRIORITY)
|
| 745 |
train_specs = ordered_specs("train", TRAIN_PRIORITY)
|
| 746 |
|
| 747 |
-
print("[1/
|
| 748 |
test_scan = scan_pools(source_dir, test_specs, collect_all_ids=True)
|
| 749 |
|
| 750 |
-
print("[2/
|
| 751 |
train_scan = scan_pools(
|
| 752 |
source_dir,
|
| 753 |
train_specs,
|
|
@@ -805,7 +949,7 @@ def build_dataset(
|
|
| 805 |
test_quota_all = add_allocations(*test_allocations.values())
|
| 806 |
confirm_quota_all = add_allocations(*confirm_allocations.values())
|
| 807 |
|
| 808 |
-
print("[3/
|
| 809 |
selected_train = collect_ranked_candidates(
|
| 810 |
source_dir,
|
| 811 |
train_specs,
|
|
@@ -823,7 +967,7 @@ def build_dataset(
|
|
| 823 |
second_split="validation",
|
| 824 |
)
|
| 825 |
|
| 826 |
-
print("[4/
|
| 827 |
selected_test = collect_ranked_candidates(
|
| 828 |
source_dir,
|
| 829 |
test_specs,
|
|
@@ -856,12 +1000,12 @@ def build_dataset(
|
|
| 856 |
raise AssertionError(f"{split}: got {len(rows)}, expected {expected_sizes[split]}")
|
| 857 |
stable_output_order(rows, seed, split)
|
| 858 |
|
| 859 |
-
print("[5/
|
| 860 |
for rows in splits.values():
|
| 861 |
strict_validate_selected(rows)
|
| 862 |
overlaps = overlap_audit(splits)
|
| 863 |
|
| 864 |
-
print("[6/
|
| 865 |
parquet_paths: dict[str, Path] = {}
|
| 866 |
for split, rows in splits.items():
|
| 867 |
path = data_dir / f"{split}.parquet"
|
|
@@ -919,35 +1063,65 @@ def build_dataset(
|
|
| 919 |
}
|
| 920 |
write_json(metadata_dir / "split_spec.json", split_spec)
|
| 921 |
|
| 922 |
-
print("[7/
|
| 923 |
(output_dir / "README.md").write_text(render_readme(dataset_id, seed), encoding="utf-8")
|
| 924 |
-
(output_dir / "requirements.txt").write_text(
|
| 925 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 926 |
)
|
| 927 |
shutil.copy2(Path(__file__), scripts_dir / "build_dataset.py")
|
| 928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 929 |
all_specs = list(POOLS.values())
|
| 930 |
source_files = source_metadata(source_dir, all_specs)
|
| 931 |
-
|
| 932 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 933 |
"bytes": path.stat().st_size,
|
| 934 |
"sha256": sha256_file(path),
|
| 935 |
-
"rows": len(splits[split]),
|
| 936 |
}
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
"sha256": sha256_file(metadata_dir / "audit.json"),
|
| 942 |
-
}
|
| 943 |
-
release_files["metadata/split_spec.json"] = {
|
| 944 |
-
"bytes": (metadata_dir / "split_spec.json").stat().st_size,
|
| 945 |
-
"sha256": sha256_file(metadata_dir / "split_spec.json"),
|
| 946 |
-
}
|
| 947 |
-
release_files["scripts/build_dataset.py"] = {
|
| 948 |
-
"bytes": (scripts_dir / "build_dataset.py").stat().st_size,
|
| 949 |
-
"sha256": sha256_file(scripts_dir / "build_dataset.py"),
|
| 950 |
-
}
|
| 951 |
manifest = {
|
| 952 |
"dataset_id": dataset_id,
|
| 953 |
"dataset_version": DATASET_VERSION,
|
|
@@ -963,10 +1137,11 @@ def build_dataset(
|
|
| 963 |
"files": release_files,
|
| 964 |
"audit_file": "metadata/audit.json",
|
| 965 |
"split_spec_file": "metadata/split_spec.json",
|
|
|
|
| 966 |
}
|
| 967 |
write_json(metadata_dir / "manifest.json", manifest)
|
| 968 |
|
| 969 |
-
print("[
|
| 970 |
print(json.dumps({"output_dir": str(output_dir), "splits": expected_sizes}, indent=2))
|
| 971 |
|
| 972 |
|
|
|
|
| 32 |
import pyarrow.parquet as pq
|
| 33 |
|
| 34 |
|
| 35 |
+
DATASET_VERSION = "1.0.1"
|
| 36 |
DEFAULT_DATASET_ID = "stwistzz/Sudoku_DLM_Reasoning"
|
| 37 |
DEFAULT_SEED = "20260815"
|
| 38 |
SOURCE_REPO = "fhyfhy/diffusion-vs-ar-hard-sudoku"
|
|
|
|
| 596 |
return result
|
| 597 |
|
| 598 |
|
| 599 |
+
def render_raw_readme() -> str:
|
| 600 |
+
return f"""# Raw source snapshot
|
| 601 |
+
|
| 602 |
+
This directory is explicitly labeled **raw**. It contains unmodified copies of
|
| 603 |
+
the seven upstream CSV files scanned by the `{DATASET_VERSION}` builder:
|
| 604 |
+
|
| 605 |
+
| raw path | upstream split | difficulty | rows |
|
| 606 |
+
|---|---|---|---:|
|
| 607 |
+
| `sudoku_train.csv` | train | original | 100,000 |
|
| 608 |
+
| `sudoku_test.csv` | test | original | 1,000 |
|
| 609 |
+
| `processed/sudoku_extreme_train_r0.csv` | train | r0 | 553,009 |
|
| 610 |
+
| `processed/sudoku_extreme_test_r0.csv` | test | r0 | 61,127 |
|
| 611 |
+
| `processed/sudoku_extreme_train_r1_4.csv` | train | r1_4 | 529,736 |
|
| 612 |
+
| `processed/sudoku_extreme_test_r1_4.csv` | test | r1_4 | 58,717 |
|
| 613 |
+
| `processed/sudoku_extreme_test_r5_19.csv` | test | r5_19 | 111,831 |
|
| 614 |
+
|
| 615 |
+
Total: **1,415,420 rows**. This is the complete candidate pool for the v1
|
| 616 |
+
protocol, not the complete 8.1M-row upstream repository. Unused difficulty
|
| 617 |
+
buckets and unrelated dataset families are intentionally excluded.
|
| 618 |
+
|
| 619 |
+
These files are not additional Hugging Face splits. The dataset card explicitly
|
| 620 |
+
maps only `data/*.parquet` into the `default` config. See
|
| 621 |
+
`metadata/raw_manifest.json` for SHA-256 hashes and exact provenance, and
|
| 622 |
+
`RAW_DATA_LICENSES.md` before redistributing the raw files.
|
| 623 |
+
"""
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
def render_building_guide(dataset_id: str, seed: str) -> str:
|
| 627 |
+
return f"""# Building the processed dataset from `raw/`
|
| 628 |
+
|
| 629 |
+
The repository is self-contained for reconstructing the processed release.
|
| 630 |
+
|
| 631 |
+
## Inputs
|
| 632 |
+
|
| 633 |
+
- Raw snapshot: `raw/`
|
| 634 |
+
- Dataset ID: `{dataset_id}`
|
| 635 |
+
- Release seed: `{seed}`
|
| 636 |
+
- Upstream revision: `{SOURCE_REVISION}`
|
| 637 |
+
|
| 638 |
+
First verify that the raw files match `metadata/raw_manifest.json`. Then run the
|
| 639 |
+
builder from the repository root:
|
| 640 |
+
|
| 641 |
+
```bash
|
| 642 |
+
python scripts/build_dataset.py \\
|
| 643 |
+
--source-dir raw \\
|
| 644 |
+
--output-dir rebuilt-release \\
|
| 645 |
+
--dataset-id {dataset_id} \\
|
| 646 |
+
--seed {seed}
|
| 647 |
+
```
|
| 648 |
+
|
| 649 |
+
The builder performs two full source scans. It validates formats and clues,
|
| 650 |
+
protects all upstream test IDs, removes exact and digit-renaming-equivalent
|
| 651 |
+
cross-split overlap, allocates metadata-stratified quotas, selects by seeded
|
| 652 |
+
SHA-256 rank, validates every selected Sudoku solution, and writes Parquet plus
|
| 653 |
+
machine-readable audits.
|
| 654 |
+
|
| 655 |
+
Verify the result independently:
|
| 656 |
+
|
| 657 |
+
```bash
|
| 658 |
+
python scripts/verify_dataset.py rebuilt-release --expected-version {DATASET_VERSION}
|
| 659 |
+
```
|
| 660 |
+
|
| 661 |
+
The expected processed split hashes are recorded in `metadata/manifest.json`.
|
| 662 |
+
Timestamp fields may differ across rebuilds; the Parquet content hashes must not.
|
| 663 |
+
"""
|
| 664 |
+
|
| 665 |
+
|
| 666 |
+
def render_raw_license_notice() -> str:
|
| 667 |
+
return """# Raw data licensing and provenance notice
|
| 668 |
+
|
| 669 |
+
This dataset repository uses `license: other` because the included raw data does
|
| 670 |
+
not have one uniform declared license.
|
| 671 |
+
|
| 672 |
+
- Construction code in `hengyuf/diffusion-vs-ar` is distributed under the
|
| 673 |
+
Apache License 2.0. That software license does not automatically relicense all
|
| 674 |
+
third-party puzzle data.
|
| 675 |
+
- The original easy Sudoku CSV files are mirrored from the pinned
|
| 676 |
+
`fhyfhy/diffusion-vs-ar-hard-sudoku` dataset snapshot.
|
| 677 |
+
- The `sudoku_extreme_*` files derive from `sapientinc/sudoku-extreme`, which
|
| 678 |
+
combines several community benchmark sources and does not declare one uniform
|
| 679 |
+
dataset license.
|
| 680 |
+
|
| 681 |
+
Files under `raw/` are unmodified research mirrors with byte-level provenance in
|
| 682 |
+
`metadata/raw_manifest.json`. Their inclusion here does not grant rights beyond
|
| 683 |
+
those provided by their respective upstream sources. Users are responsible for
|
| 684 |
+
reviewing and complying with the upstream terms before redistribution or use,
|
| 685 |
+
especially outside research contexts.
|
| 686 |
+
|
| 687 |
+
Upstream references:
|
| 688 |
+
|
| 689 |
+
- https://huggingface.co/datasets/fhyfhy/diffusion-vs-ar-hard-sudoku
|
| 690 |
+
- https://huggingface.co/datasets/sapientinc/sudoku-extreme
|
| 691 |
+
- https://github.com/hengyuf/diffusion-vs-ar/tree/hard-sudoku-datasets
|
| 692 |
+
"""
|
| 693 |
+
|
| 694 |
+
|
| 695 |
+
def copy_raw_snapshot(
|
| 696 |
+
source_dir: Path, output_dir: Path, specs: Iterable[PoolSpec]
|
| 697 |
+
) -> dict[str, object]:
|
| 698 |
+
raw_dir = output_dir / "raw"
|
| 699 |
+
raw_dir.mkdir()
|
| 700 |
+
files: dict[str, object] = {}
|
| 701 |
+
for spec in sorted(set(specs), key=lambda item: item.relative_path):
|
| 702 |
+
source = source_dir / spec.relative_path
|
| 703 |
+
destination = raw_dir / spec.relative_path
|
| 704 |
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
| 705 |
+
shutil.copy2(source, destination)
|
| 706 |
+
relative = destination.relative_to(output_dir).as_posix()
|
| 707 |
+
source_hash = sha256_file(source)
|
| 708 |
+
destination_hash = sha256_file(destination)
|
| 709 |
+
if source_hash != destination_hash:
|
| 710 |
+
raise IOError(f"raw copy hash mismatch: {spec.relative_path}")
|
| 711 |
+
files[relative] = {
|
| 712 |
+
"bytes": destination.stat().st_size,
|
| 713 |
+
"sha256": destination_hash,
|
| 714 |
+
"rows": spec.expected_rows,
|
| 715 |
+
"upstream_path": spec.relative_path,
|
| 716 |
+
"upstream_split": spec.upstream_split,
|
| 717 |
+
"difficulty_bucket": spec.bucket,
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
upstream_manifest = source_dir / "processed/manifest.json"
|
| 721 |
+
if upstream_manifest.is_file():
|
| 722 |
+
shutil.copy2(upstream_manifest, raw_dir / "upstream_processed_manifest.json")
|
| 723 |
+
(raw_dir / "README.md").write_text(render_raw_readme(), encoding="utf-8")
|
| 724 |
+
return files
|
| 725 |
+
|
| 726 |
+
|
| 727 |
def render_readme(dataset_id: str, seed: str) -> str:
|
| 728 |
return f"""---
|
| 729 |
license: other
|
|
|
|
| 756 |
trains only on `original`, `r0`, and `r1_4`; `r5_19` is held out for adjacent
|
| 757 |
difficulty extrapolation.
|
| 758 |
|
| 759 |
+
## Repository layout
|
| 760 |
+
|
| 761 |
+
- `raw/`: complete 1,415,420-row candidate snapshot used by this protocol
|
| 762 |
+
- `data/`: selected, leakage-audited Parquet splits used for experiments
|
| 763 |
+
- `metadata/`: source/release hashes, split specification, and audits
|
| 764 |
+
- `scripts/`: deterministic builder and independent verifier
|
| 765 |
+
- `docs/BUILDING.md`: end-to-end reconstruction instructions
|
| 766 |
+
|
| 767 |
+
Files under `raw/` are explicitly source data and are not loaded as extra splits.
|
| 768 |
+
Only the four `data/*.parquet` paths declared in the card metadata form the
|
| 769 |
+
`default` dataset config.
|
| 770 |
+
|
| 771 |
## Splits
|
| 772 |
|
| 773 |
| split | original | r0 | r1_4 | r5_19 | total |
|
|
|
|
| 838 |
|
| 839 |
## Rebuild
|
| 840 |
|
| 841 |
+
The pinned source CSV files are included under `raw/`. Run:
|
| 842 |
|
| 843 |
```bash
|
| 844 |
python scripts/build_dataset.py \\
|
| 845 |
+
--source-dir raw \\
|
| 846 |
--output-dir /path/to/release \\
|
| 847 |
--dataset-id {dataset_id} \\
|
| 848 |
--seed {seed}
|
| 849 |
```
|
| 850 |
|
| 851 |
+
The builder requires Python 3.10+ and PyArrow. See `docs/BUILDING.md`, then run
|
| 852 |
+
`scripts/verify_dataset.py` against the rebuilt release.
|
| 853 |
|
| 854 |
## Attribution and license
|
| 855 |
|
|
|
|
| 860 |
[`sapientinc/sudoku-extreme`](https://huggingface.co/datasets/sapientinc/sudoku-extreme)
|
| 861 |
corpus. Please consult and comply with the licenses and attribution requirements
|
| 862 |
of all upstream sources. This derived release does not grant rights beyond them.
|
| 863 |
+
See `RAW_DATA_LICENSES.md` for the raw-snapshot notice.
|
| 864 |
"""
|
| 865 |
|
| 866 |
|
|
|
|
| 879 |
data_dir = output_dir / "data"
|
| 880 |
metadata_dir = output_dir / "metadata"
|
| 881 |
scripts_dir = output_dir / "scripts"
|
| 882 |
+
docs_dir = output_dir / "docs"
|
| 883 |
data_dir.mkdir()
|
| 884 |
metadata_dir.mkdir()
|
| 885 |
scripts_dir.mkdir()
|
| 886 |
+
docs_dir.mkdir()
|
| 887 |
|
| 888 |
test_specs = ordered_specs("test", TEST_PRIORITY)
|
| 889 |
train_specs = ordered_specs("train", TRAIN_PRIORITY)
|
| 890 |
|
| 891 |
+
print("[1/9] Scanning and de-duplicating all protected upstream test pools...")
|
| 892 |
test_scan = scan_pools(source_dir, test_specs, collect_all_ids=True)
|
| 893 |
|
| 894 |
+
print("[2/9] Scanning train pools and excluding all test-equivalent rows...")
|
| 895 |
train_scan = scan_pools(
|
| 896 |
source_dir,
|
| 897 |
train_specs,
|
|
|
|
| 949 |
test_quota_all = add_allocations(*test_allocations.values())
|
| 950 |
confirm_quota_all = add_allocations(*confirm_allocations.values())
|
| 951 |
|
| 952 |
+
print("[3/9] Selecting deterministic train and validation rows...")
|
| 953 |
selected_train = collect_ranked_candidates(
|
| 954 |
source_dir,
|
| 955 |
train_specs,
|
|
|
|
| 967 |
second_split="validation",
|
| 968 |
)
|
| 969 |
|
| 970 |
+
print("[4/9] Selecting deterministic ID/OOD test and OOD confirmation rows...")
|
| 971 |
selected_test = collect_ranked_candidates(
|
| 972 |
source_dir,
|
| 973 |
test_specs,
|
|
|
|
| 1000 |
raise AssertionError(f"{split}: got {len(rows)}, expected {expected_sizes[split]}")
|
| 1001 |
stable_output_order(rows, seed, split)
|
| 1002 |
|
| 1003 |
+
print("[5/9] Strictly validating every selected puzzle and solution...")
|
| 1004 |
for rows in splits.values():
|
| 1005 |
strict_validate_selected(rows)
|
| 1006 |
overlaps = overlap_audit(splits)
|
| 1007 |
|
| 1008 |
+
print("[6/9] Writing Parquet splits and processed-split audits...")
|
| 1009 |
parquet_paths: dict[str, Path] = {}
|
| 1010 |
for split, rows in splits.items():
|
| 1011 |
path = data_dir / f"{split}.parquet"
|
|
|
|
| 1063 |
}
|
| 1064 |
write_json(metadata_dir / "split_spec.json", split_spec)
|
| 1065 |
|
| 1066 |
+
print("[7/9] Writing dataset card, documentation, and reproducibility scripts...")
|
| 1067 |
(output_dir / "README.md").write_text(render_readme(dataset_id, seed), encoding="utf-8")
|
| 1068 |
+
(output_dir / "requirements.txt").write_text("pyarrow>=17\n", encoding="utf-8")
|
| 1069 |
+
(output_dir / "RAW_DATA_LICENSES.md").write_text(
|
| 1070 |
+
render_raw_license_notice(), encoding="utf-8"
|
| 1071 |
+
)
|
| 1072 |
+
(docs_dir / "BUILDING.md").write_text(
|
| 1073 |
+
render_building_guide(dataset_id, seed), encoding="utf-8"
|
| 1074 |
)
|
| 1075 |
shutil.copy2(Path(__file__), scripts_dir / "build_dataset.py")
|
| 1076 |
|
| 1077 |
+
verifier_candidates = (
|
| 1078 |
+
Path(__file__).with_name("verify_sudoku_dlm_reasoning_dataset.py"),
|
| 1079 |
+
Path(__file__).with_name("verify_dataset.py"),
|
| 1080 |
+
)
|
| 1081 |
+
verifier_source = next((path for path in verifier_candidates if path.is_file()), None)
|
| 1082 |
+
if verifier_source is None:
|
| 1083 |
+
raise FileNotFoundError("independent dataset verifier is missing")
|
| 1084 |
+
shutil.copy2(verifier_source, scripts_dir / "verify_dataset.py")
|
| 1085 |
+
|
| 1086 |
all_specs = list(POOLS.values())
|
| 1087 |
source_files = source_metadata(source_dir, all_specs)
|
| 1088 |
+
|
| 1089 |
+
print("[8/9] Copying the complete v1 candidate pool under raw/...")
|
| 1090 |
+
raw_files = copy_raw_snapshot(source_dir, output_dir, all_specs)
|
| 1091 |
+
raw_manifest = {
|
| 1092 |
+
"label": "raw",
|
| 1093 |
+
"scope": "complete candidate pool used by the v1 protocol",
|
| 1094 |
+
"candidate_rows": sum(spec.expected_rows for spec in all_specs),
|
| 1095 |
+
"source_repo": SOURCE_REPO,
|
| 1096 |
+
"source_revision": SOURCE_REVISION,
|
| 1097 |
+
"files": raw_files,
|
| 1098 |
+
"upstream_processed_manifest": "raw/upstream_processed_manifest.json",
|
| 1099 |
+
"license_notice": "RAW_DATA_LICENSES.md",
|
| 1100 |
+
}
|
| 1101 |
+
write_json(metadata_dir / "raw_manifest.json", raw_manifest)
|
| 1102 |
+
|
| 1103 |
+
row_counts = {
|
| 1104 |
+
path.relative_to(output_dir).as_posix(): len(splits[split])
|
| 1105 |
+
for split, path in parquet_paths.items()
|
| 1106 |
+
}
|
| 1107 |
+
row_counts.update(
|
| 1108 |
+
{relative: int(details["rows"]) for relative, details in raw_files.items()}
|
| 1109 |
+
)
|
| 1110 |
+
release_files: dict[str, object] = {}
|
| 1111 |
+
for path in sorted(output_dir.rglob("*")):
|
| 1112 |
+
if not path.is_file():
|
| 1113 |
+
continue
|
| 1114 |
+
relative = path.relative_to(output_dir).as_posix()
|
| 1115 |
+
if relative == "metadata/manifest.json":
|
| 1116 |
+
continue
|
| 1117 |
+
entry: dict[str, object] = {
|
| 1118 |
"bytes": path.stat().st_size,
|
| 1119 |
"sha256": sha256_file(path),
|
|
|
|
| 1120 |
}
|
| 1121 |
+
if relative in row_counts:
|
| 1122 |
+
entry["rows"] = row_counts[relative]
|
| 1123 |
+
release_files[relative] = entry
|
| 1124 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1125 |
manifest = {
|
| 1126 |
"dataset_id": dataset_id,
|
| 1127 |
"dataset_version": DATASET_VERSION,
|
|
|
|
| 1137 |
"files": release_files,
|
| 1138 |
"audit_file": "metadata/audit.json",
|
| 1139 |
"split_spec_file": "metadata/split_spec.json",
|
| 1140 |
+
"raw_snapshot_file": "metadata/raw_manifest.json",
|
| 1141 |
}
|
| 1142 |
write_json(metadata_dir / "manifest.json", manifest)
|
| 1143 |
|
| 1144 |
+
print("[9/9] Build complete.")
|
| 1145 |
print(json.dumps({"output_dir": str(output_dir), "splits": expected_sizes}, indent=2))
|
| 1146 |
|
| 1147 |
|
scripts/verify_dataset.py
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independently verify a built Sudoku_DLM_Reasoning release."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import argparse
|
| 6 |
+
import csv
|
| 7 |
+
import hashlib
|
| 8 |
+
import json
|
| 9 |
+
from collections import Counter
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
import pyarrow as pa
|
| 13 |
+
import pyarrow.parquet as pq
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
EXPECTED_BUCKETS = {
|
| 17 |
+
"train": {"original": 65_536, "r0": 65_536, "r1_4": 65_536},
|
| 18 |
+
"validation": {"original": 2_048, "r0": 2_048, "r1_4": 2_048},
|
| 19 |
+
"test": {"original": 1_000, "r0": 1_000, "r1_4": 1_000, "r5_19": 1_000},
|
| 20 |
+
"test_ood_confirm": {"r5_19": 4_000},
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
EXPECTED_SUBBUCKETS = {
|
| 24 |
+
"test": {
|
| 25 |
+
"original": 1_000,
|
| 26 |
+
"r0": 1_000,
|
| 27 |
+
"r1_2": 250,
|
| 28 |
+
"r2_3": 250,
|
| 29 |
+
"r3_4": 250,
|
| 30 |
+
"r4_5": 250,
|
| 31 |
+
"r5_7": 250,
|
| 32 |
+
"r8_11": 250,
|
| 33 |
+
"r12_15": 250,
|
| 34 |
+
"r16_19": 250,
|
| 35 |
+
},
|
| 36 |
+
"test_ood_confirm": {
|
| 37 |
+
"r5_7": 1_000,
|
| 38 |
+
"r8_11": 1_000,
|
| 39 |
+
"r12_15": 1_000,
|
| 40 |
+
"r16_19": 1_000,
|
| 41 |
+
},
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
EXPECTED_SCHEMA = pa.schema(
|
| 45 |
+
[
|
| 46 |
+
pa.field("example_id", pa.string(), nullable=False),
|
| 47 |
+
pa.field("puzzle_id", pa.string(), nullable=False),
|
| 48 |
+
pa.field("digit_normalized_id", pa.string(), nullable=False),
|
| 49 |
+
pa.field("puzzle", pa.string(), nullable=False),
|
| 50 |
+
pa.field("solution", pa.string(), nullable=False),
|
| 51 |
+
pa.field("difficulty_bucket", pa.string(), nullable=False),
|
| 52 |
+
pa.field("difficulty_subbucket", pa.string(), nullable=False),
|
| 53 |
+
pa.field("source_family", pa.string(), nullable=False),
|
| 54 |
+
pa.field("source_collection", pa.string(), nullable=False),
|
| 55 |
+
pa.field("official_rating", pa.float64(), nullable=True),
|
| 56 |
+
pa.field("rating_type", pa.string(), nullable=False),
|
| 57 |
+
pa.field("clues", pa.int16(), nullable=False),
|
| 58 |
+
pa.field("upstream_split", pa.string(), nullable=False),
|
| 59 |
+
pa.field("release_split", pa.string(), nullable=False),
|
| 60 |
+
pa.field("evaluation_role", pa.string(), nullable=False),
|
| 61 |
+
pa.field("is_ood", pa.bool_(), nullable=False),
|
| 62 |
+
pa.field("source_file", pa.string(), nullable=False),
|
| 63 |
+
pa.field("source_row_index", pa.int64(), nullable=False),
|
| 64 |
+
pa.field("stratum", pa.string(), nullable=False),
|
| 65 |
+
]
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
VERIFY_COLUMNS = [
|
| 69 |
+
"example_id",
|
| 70 |
+
"puzzle_id",
|
| 71 |
+
"digit_normalized_id",
|
| 72 |
+
"puzzle",
|
| 73 |
+
"solution",
|
| 74 |
+
"difficulty_bucket",
|
| 75 |
+
"difficulty_subbucket",
|
| 76 |
+
"clues",
|
| 77 |
+
"upstream_split",
|
| 78 |
+
"release_split",
|
| 79 |
+
"evaluation_role",
|
| 80 |
+
"is_ood",
|
| 81 |
+
"source_row_index",
|
| 82 |
+
]
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def sha256_text(value: str) -> str:
|
| 86 |
+
return hashlib.sha256(value.encode("utf-8")).hexdigest()
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def sha256_file(path: Path) -> str:
|
| 90 |
+
digest = hashlib.sha256()
|
| 91 |
+
with path.open("rb") as handle:
|
| 92 |
+
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
| 93 |
+
digest.update(chunk)
|
| 94 |
+
return digest.hexdigest()
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def digit_normalized_id(puzzle: str, solution: str) -> str:
|
| 98 |
+
mapping: dict[str, str] = {}
|
| 99 |
+
for digit in solution:
|
| 100 |
+
mapping.setdefault(digit, str(len(mapping) + 1))
|
| 101 |
+
if len(mapping) != 9:
|
| 102 |
+
raise AssertionError("solution does not contain all digits")
|
| 103 |
+
normalized_puzzle = "".join("0" if digit == "0" else mapping[digit] for digit in puzzle)
|
| 104 |
+
normalized_solution = "".join(mapping[digit] for digit in solution)
|
| 105 |
+
return sha256_text(f"{normalized_puzzle}|{normalized_solution}")
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def validate_sudoku(puzzle: str, solution: str) -> None:
|
| 109 |
+
assert len(puzzle) == 81 and set(puzzle) <= set("0123456789")
|
| 110 |
+
assert len(solution) == 81 and set(solution) <= set("123456789")
|
| 111 |
+
assert all(clue == "0" or clue == solution[index] for index, clue in enumerate(puzzle))
|
| 112 |
+
expected = set("123456789")
|
| 113 |
+
units = [solution[index : index + 9] for index in range(0, 81, 9)]
|
| 114 |
+
units.extend(solution[index::9] for index in range(9))
|
| 115 |
+
for box_row in range(3):
|
| 116 |
+
for box_col in range(3):
|
| 117 |
+
units.append(
|
| 118 |
+
"".join(
|
| 119 |
+
solution[row * 9 + box_col * 3 : row * 9 + box_col * 3 + 3]
|
| 120 |
+
for row in range(box_row * 3, box_row * 3 + 3)
|
| 121 |
+
)
|
| 122 |
+
)
|
| 123 |
+
assert all(set(unit) == expected for unit in units)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
def expected_role(split: str, bucket: str) -> tuple[str, bool]:
|
| 127 |
+
if split == "train":
|
| 128 |
+
return "train_id", False
|
| 129 |
+
if split == "validation":
|
| 130 |
+
return "validation_id", False
|
| 131 |
+
if split == "test":
|
| 132 |
+
return ("test_ood", True) if bucket == "r5_19" else ("test_id", False)
|
| 133 |
+
return "confirm_ood", True
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def verify_split(path: Path, split: str) -> tuple[dict[str, set[str]], dict[str, object]]:
|
| 137 |
+
file_schema = pq.read_schema(path)
|
| 138 |
+
if not file_schema.equals(EXPECTED_SCHEMA, check_metadata=False):
|
| 139 |
+
raise AssertionError(f"{split}: schema mismatch\n{file_schema}\n!=\n{EXPECTED_SCHEMA}")
|
| 140 |
+
table = pq.read_table(path, columns=VERIFY_COLUMNS)
|
| 141 |
+
expected_rows = sum(EXPECTED_BUCKETS[split].values())
|
| 142 |
+
assert table.num_rows == expected_rows, (split, table.num_rows, expected_rows)
|
| 143 |
+
columns = table.to_pydict()
|
| 144 |
+
ids = {name: set() for name in ("example_id", "puzzle_id", "digit_normalized_id")}
|
| 145 |
+
buckets: Counter[str] = Counter()
|
| 146 |
+
subbuckets: Counter[str] = Counter()
|
| 147 |
+
expected_upstream = "train" if split in {"train", "validation"} else "test"
|
| 148 |
+
|
| 149 |
+
for index in range(table.num_rows):
|
| 150 |
+
puzzle = columns["puzzle"][index]
|
| 151 |
+
solution = columns["solution"][index]
|
| 152 |
+
bucket = columns["difficulty_bucket"][index]
|
| 153 |
+
validate_sudoku(puzzle, solution)
|
| 154 |
+
assert columns["example_id"][index] == sha256_text(f"{puzzle}|{solution}")
|
| 155 |
+
assert columns["puzzle_id"][index] == sha256_text(puzzle)
|
| 156 |
+
assert columns["digit_normalized_id"][index] == digit_normalized_id(puzzle, solution)
|
| 157 |
+
assert columns["clues"][index] == sum(value != "0" for value in puzzle)
|
| 158 |
+
assert columns["upstream_split"][index] == expected_upstream
|
| 159 |
+
assert columns["release_split"][index] == split
|
| 160 |
+
role, is_ood = expected_role(split, bucket)
|
| 161 |
+
assert columns["evaluation_role"][index] == role
|
| 162 |
+
assert columns["is_ood"][index] is is_ood
|
| 163 |
+
assert columns["source_row_index"][index] >= 0
|
| 164 |
+
buckets[bucket] += 1
|
| 165 |
+
subbuckets[columns["difficulty_subbucket"][index]] += 1
|
| 166 |
+
for name in ids:
|
| 167 |
+
value = columns[name][index]
|
| 168 |
+
if value in ids[name]:
|
| 169 |
+
raise AssertionError(f"{split}: duplicate {name} {value}")
|
| 170 |
+
ids[name].add(value)
|
| 171 |
+
|
| 172 |
+
assert dict(buckets) == EXPECTED_BUCKETS[split], (split, buckets)
|
| 173 |
+
if split in EXPECTED_SUBBUCKETS:
|
| 174 |
+
assert dict(subbuckets) == EXPECTED_SUBBUCKETS[split], (split, subbuckets)
|
| 175 |
+
return ids, {
|
| 176 |
+
"rows": table.num_rows,
|
| 177 |
+
"difficulty_buckets": dict(sorted(buckets.items())),
|
| 178 |
+
"difficulty_subbuckets": dict(sorted(subbuckets.items())),
|
| 179 |
+
"sha256": sha256_file(path),
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def count_csv_rows(path: Path) -> int:
|
| 184 |
+
with path.open("r", encoding="utf-8", newline="") as handle:
|
| 185 |
+
reader = csv.reader(handle)
|
| 186 |
+
next(reader)
|
| 187 |
+
return sum(1 for _ in reader)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
def verify_raw_snapshot(root: Path, manifest: dict[str, object]) -> dict[str, object] | None:
|
| 191 |
+
raw_manifest_name = manifest.get("raw_snapshot_file")
|
| 192 |
+
if raw_manifest_name is None:
|
| 193 |
+
return None
|
| 194 |
+
raw_manifest = json.loads((root / str(raw_manifest_name)).read_text(encoding="utf-8"))
|
| 195 |
+
assert raw_manifest["label"] == "raw"
|
| 196 |
+
rows = 0
|
| 197 |
+
for relative_path, declared in raw_manifest["files"].items():
|
| 198 |
+
path = root / relative_path
|
| 199 |
+
assert relative_path.startswith("raw/"), relative_path
|
| 200 |
+
assert path.is_file(), relative_path
|
| 201 |
+
assert path.stat().st_size == declared["bytes"], relative_path
|
| 202 |
+
assert sha256_file(path) == declared["sha256"], relative_path
|
| 203 |
+
observed_rows = count_csv_rows(path)
|
| 204 |
+
assert observed_rows == declared["rows"], relative_path
|
| 205 |
+
release_declared = manifest["files"][relative_path]
|
| 206 |
+
assert release_declared["sha256"] == declared["sha256"], relative_path
|
| 207 |
+
assert release_declared["rows"] == observed_rows, relative_path
|
| 208 |
+
rows += observed_rows
|
| 209 |
+
assert rows == raw_manifest["candidate_rows"]
|
| 210 |
+
return {"label": "raw", "files": len(raw_manifest["files"]), "rows": rows}
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def verify_release(root: Path, expected_version: str | None = None) -> dict[str, object]:
|
| 214 |
+
manifest = json.loads((root / "metadata/manifest.json").read_text(encoding="utf-8"))
|
| 215 |
+
audit = json.loads((root / "metadata/audit.json").read_text(encoding="utf-8"))
|
| 216 |
+
assert manifest["dataset_id"] == "stwistzz/Sudoku_DLM_Reasoning"
|
| 217 |
+
dataset_version = str(manifest["dataset_version"])
|
| 218 |
+
if expected_version is not None:
|
| 219 |
+
assert dataset_version == expected_version, (dataset_version, expected_version)
|
| 220 |
+
assert manifest["seed"] == "20260815"
|
| 221 |
+
assert audit["dataset_version"] == dataset_version
|
| 222 |
+
|
| 223 |
+
split_ids: dict[str, dict[str, set[str]]] = {}
|
| 224 |
+
summaries: dict[str, object] = {}
|
| 225 |
+
for split in EXPECTED_BUCKETS:
|
| 226 |
+
relative_path = f"data/{split}.parquet"
|
| 227 |
+
ids, summary = verify_split(root / relative_path, split)
|
| 228 |
+
split_ids[split] = ids
|
| 229 |
+
summaries[split] = summary
|
| 230 |
+
declared = manifest["files"][relative_path]
|
| 231 |
+
assert declared["rows"] == summary["rows"]
|
| 232 |
+
assert declared["sha256"] == summary["sha256"]
|
| 233 |
+
|
| 234 |
+
split_names = list(EXPECTED_BUCKETS)
|
| 235 |
+
overlaps: dict[str, dict[str, int]] = {}
|
| 236 |
+
for left_index, left in enumerate(split_names):
|
| 237 |
+
for right in split_names[left_index + 1 :]:
|
| 238 |
+
key = f"{left}__vs__{right}"
|
| 239 |
+
overlaps[key] = {
|
| 240 |
+
name: len(split_ids[left][name] & split_ids[right][name])
|
| 241 |
+
for name in split_ids[left]
|
| 242 |
+
}
|
| 243 |
+
assert not any(value for result in overlaps.values() for value in result.values())
|
| 244 |
+
assert audit["pairwise_overlap"] == overlaps
|
| 245 |
+
assert audit["strict_selected_rows_verified"] == sum(
|
| 246 |
+
sum(counts.values()) for counts in EXPECTED_BUCKETS.values()
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
for relative_path, declared in manifest["files"].items():
|
| 250 |
+
path = root / relative_path
|
| 251 |
+
assert path.is_file(), relative_path
|
| 252 |
+
assert path.stat().st_size == declared["bytes"], relative_path
|
| 253 |
+
assert sha256_file(path) == declared["sha256"], relative_path
|
| 254 |
+
|
| 255 |
+
raw_summary = verify_raw_snapshot(root, manifest)
|
| 256 |
+
return {
|
| 257 |
+
"dataset_version": dataset_version,
|
| 258 |
+
"splits": summaries,
|
| 259 |
+
"pairwise_overlap": overlaps,
|
| 260 |
+
"raw_snapshot": raw_summary,
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
def main() -> None:
|
| 265 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 266 |
+
parser.add_argument("release_dir", type=Path)
|
| 267 |
+
parser.add_argument("--expected-version")
|
| 268 |
+
args = parser.parse_args()
|
| 269 |
+
result = verify_release(args.release_dir.resolve(), args.expected_version)
|
| 270 |
+
print(json.dumps(result, indent=2, sort_keys=True))
|
| 271 |
+
print("VERIFICATION_OK")
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
if __name__ == "__main__":
|
| 275 |
+
main()
|