Sudoku_DLM_Reasoning / docs /DIFFICULTY.md
twistshan's picture
Publish v1.1.0 seed-0 formal splits
66746ff verified
|
Raw
History Blame Contribute Delete
7.69 kB
# Difficulty definition and quantitative audit
This document defines the difficulty fields used by Sudoku DLM Reasoning release
`1.1.0`. Difficulty is an operational, solver-relative measurement;
it is not a human Sudoku grade and is not defined by the number of clues.
## 1. Provenance of the rating
For the Sudoku Extreme rows, the upstream `rating` column is copied into
`official_rating` and labeled `rating_type = tdoku_backtracks`. The converter
does not recompute the rating:
- Sudoku Extreme card: https://huggingface.co/datasets/sapientinc/sudoku-extreme
- Conversion code: https://github.com/hengyuf/diffusion-vs-ar/blob/ba0445f4d0808113bf08a9a9d8c7041086bfdf10/tools/prepare_sudoku_datasets.py
The upstream card describes the value as the number of backtracks required by
Tdoku. At public Tdoku commit `af426180dc53aef89b82868e7b3fdfcf42165654`, the counter is named
`num_guesses_` and is incremented whenever the DPLL solver expands a binary
configuration decision:
- Branch implementation: https://github.com/t-dillon/tdoku/blob/af426180dc53aef89b82868e7b3fdfcf42165654/src/solver_dpll_triad_simd.cc#L539-L559
- Branch-variable selection: https://github.com/t-dillon/tdoku/blob/af426180dc53aef89b82868e7b3fdfcf42165654/src/solver_dpll_triad_simd.cc#L473-L536
Operationally, `official_rating` is best interpreted as the number of search
decision nodes visited before the first solution, rather than literal failed
undo operations.
## 2. Constraint propagation and the DFS root
Tdoku does not begin search from an empty board or from the first empty cell.
For a standard 81-character puzzle it:
1. loads every given digit;
2. eliminates incompatible row, column, box, band, and stack configurations;
3. propagates those eliminations until the initialized state is consistent; and
4. calls depth-first search on that propagated partial state.
The initialization and call path are visible in that pinned public source:
- Initialization: https://github.com/t-dillon/tdoku/blob/af426180dc53aef89b82868e7b3fdfcf42165654/src/solver_dpll_triad_simd.cc#L612-L634
- Solve entry point: https://github.com/t-dillon/tdoku/blob/af426180dc53aef89b82868e7b3fdfcf42165654/src/solver_dpll_triad_simd.cc#L680-L693
Propagation applies only logical consequences of the current givens or branch
assumption. It makes no new hypothesis and is not counted by the rating. It can
end in a complete solution, a contradiction, or a fixed point that still has
multiple configurations.
This matters because two puzzles can both have rating zero while requiring very
different amounts of propagation.
## 3. What one branch means
For one digit in a three-row band (or a three-column stack), there are six
possible global placements across the three boxes. Tdoku represents these as
band configurations. When propagation leaves multiple configurations, the
branching heuristic selects:
1. the unresolved band or stack with the fewest configurations; then
2. the digit in that band or stack with the fewest configurations.
It then creates a binary decision:
- left branch: force the first remaining configuration;
- right branch: exclude that configuration and retain the others.
The counter increases once for this binary split. If the left branch fails and
the right branch immediately solves the puzzle, the count for that decision is
still one. A later split of the remaining configurations increases it again.
Therefore the rating is not the recursion depth, the number of filled cells, the
number of contradictions, or a human solving-step count.
## 4. Bucket definitions
The source converter applies these thresholds:
| release label | operational rule | interpretation |
|---|---:|---|
| `original` | no Tdoku rating | separate easy collection; not numerically calibrated to Extreme |
| `r0` | rating = 0 | propagation resolves the puzzle without a search decision |
| `r1_4` | 1 <= rating < 5 | 1--4 visited decision nodes |
| `r5_19` | 5 <= rating < 20 | 5--19 visited decision nodes |
The upstream converter also defines `r20_49`, `r50_99`, and `r100_plus`, but
those buckets are outside this v1 candidate pool. Thus `r5_19` is an adjacent
held-out difficulty band, not the hardest part of the upstream corpus.
## 5. Quantitative audit of the raw candidate pool
The following statistics were computed over all 1,415,420 rows included under
`raw/`. Rating and clue statistics use the full pool.
| bucket | rows | rating mean / median | clue mean / median | clue range |
|---|---:|---:|---:|---:|
| `original` | 101,000 | not rated | 33.813 / 34 | 29--37 |
| `r0` | 614,136 | 0 / 0 | 26.282 / 26 | 17--37 |
| `r1_4` | 588,453 | 1.976 / 2 | 25.604 / 26 | 17--31 |
| `r5_19` | 111,831 | 11.776 / 12 | 24.932 / 25 | 17--30 |
Clue count is not a substitute for this rating. Within `r1_4`, the Pearson
correlation between rating and clues is -0.035; within `r5_19` it is 0.002.
As an independent diagnostic, standard row/column/box naked-single propagation
was run over all 101,000 original rows and deterministic 20,000-row reservoir
samples of each Extreme bucket. The reservoir seeds were `20260816` for `r0`,
`20260817` for `r1_4`, and `20260818` for `r5_19`:
| bucket | rows checked | solved by naked singles |
|---|---:|---:|
| `original` | 101,000 | 100,959 (99.959%) |
| `r0` | 20,000 | 3,691 (18.455%) |
| `r1_4` | 20,000 | 0 |
| `r5_19` | 20,000 | 0 |
The 41 original rows that stalled under naked singles were all solved after
adding hidden-single propagation. This independent audit describes basic Sudoku
logic, not Tdoku's own internal propagation, which is configuration-based and
stronger.
## 6. Released train and evaluation distributions
The three training buckets are equal in size, but exact ratings inside `r1_4`
retain the upstream proportions:
| exact rating | train rows |
|---:|---:|
| 1 | 29,584 |
| 2 | 16,809 |
| 3 | 10,244 |
| 4 | 8,899 |
The main `r1_4` test allocation instead uses 250 rows at each exact rating 1,
2, 3, and 4. The `r5_19` test allocation uses 250 rows from each of `[5,8)`,
`[8,12)`, `[12,16)`, and `[16,20)`; `test_ood_confirm` uses 1,000 per range.
This supports per-rating or per-range reporting rather than only a bucket-wide
average.
## 7. Source confounding
Difficulty and source collection are not independent in the raw pool:
- `r0`: 77.40% `puzzles1_unbiased`, 16.28% `puzzles0_kaggle`, and 6.30%
`puzzles2_17_clue`;
- `r1_4`: 85.02% `puzzles1_unbiased`, 9.70%
`puzzles4_forum_hardest_1905`, and 3.40% `01_file1`;
- `r5_19`: 68.19% `puzzles4_forum_hardest_1905`, 28.15% `01_file1`, and only
2.18% `puzzles1_unbiased`.
Consequently, an `r5_19` result combines a Tdoku-rating shift, a held-out
training-exposure shift, and a source-distribution shift. It must not be
interpreted as a pure causal effect of search count.
Recommended reporting includes exact rating or subrange, source collection, and
clue count. A source- and clue-matched diagnostic set is appropriate when the
goal is to isolate the rating axis.
## 8. Reproducibility limitation
The public Sudoku Extreme card does not pin the Tdoku commit, build flags,
command, permutation policy, or seed used to create its rating column. This
release therefore preserves `official_rating` as an upstream measurement rather
than claiming to reproduce it.
For a fully controlled future rating, pin a Tdoku commit and configuration,
record the branch count for the exact stored puzzle, and optionally measure its
mean and variance over Sudoku-preserving isomorphic transformations.