unmaze
A small diffusion model that solves hedge mazes by turning random noise into the path from the entrance to the centre. It trains on a plain CPU, and a browser page replays the model’s real frames so you can watch it work.
- 5,000 fresh 11×11 mazes the model never saw: 4,990 solved (99.8%)
- On a maze style it never trained on it solved 66%. Retraining on mixed styles got 88%, below the 90% bar I set before training, so I kept the original model and wrote down why.
- All 10 failures were in the longest quarter of routes; on the 300 longest routes of 30,000 it solves 93%
Why and how
Why. Image models turn noise into pictures. This tests whether the same idea can turn noise into the one correct path through a maze, and measures where it stops working.
How. Python, PyTorch, and NumPy. Mazes come from Wilson’s algorithm and their solutions from BFS. A 2.7M-parameter U-Net with self-attention denoises the path mask, and a DDIM sampler runs 50 steps; training took about 50 minutes on 3 CPU threads. A strict judge counts an answer only if it is exactly one simple path with no gaps or stray pixels, and no repair step runs afterward. The page is plain HTML, CSS, and JavaScript.