Solving Sudoku by drawing it: PaTh on MNIST Sudoku
A replication of Think Before You Paint (Painter–Thinker, PaTh). A 10M-parameter diffusion model paints Sudoku solutions in handwritten MNIST digits. It never sees a number, only pixels.
Try it: JohanDL/sudoku-by-drawing
| very hard puzzles (Sudoku-Extreme), 1000 test puzzles | solved |
|---|---|
| standard diffusion model, 82M (paper) | 2.9% |
| PaTh, 10M (paper) | 72.5% |
| PaTh, 10M (this replication) | 48.3% |
It's not quite as good as the paper's model. The paper doesn't give every hyperparameter, so I guessed a few: the batch size, for one (64 learned nothing, 768 worked). For the best model, wait for the official code.
Files
| file | contents |
|---|---|
painter.pt |
Painter, a 1.5M-parameter pixel diffusion UNet (EMA weights, key ema) |
thinker_extreme.pt |
Thinker, an 8.5M-parameter Tiny Recursive Model with its encoder, decoder and ControlNet adapters, trained on Sudoku-Extreme (EMA weights, key ema) |
classifier.pt |
MNIST cell reader used only for scoring (key model, 99.6% test accuracy) |
paper.yaml |
the full training configuration |
eval_extreme.log, curve.tsv, ablation_nsup.txt |
evaluation results behind the numbers above |
All checkpoints load with torch.load(path, weights_only=True). The model code is in the
Space repository (pathrepl/), and
pathrepl.common.load_eval_models builds the models from paper.yaml.
Training
One RTX 4090, about 2.7 days. The Painter trained for 100k steps (batch 64) on images of solved Sudokus, with no clues. The Thinker then trained for 160k steps (batch 768) with the Painter frozen, using only the diffusion reconstruction loss. Images are 144×144, with 100 training timesteps and 20 DDIM sampling steps at CFG 2.0. Built with Claude Code.
Scores use "fast sampling" (the paper's efficient variant): the Thinker keeps its state across denoising steps and reuses its last output after halfway. With thinking at every step instead, it solves 40.6%.