Pathsolver#

Zero-Knowledge ML for Finding Short Paths on Large Cayley Graphs. Pathsolver is the official implementation of the NeurIPS 2025 Spotlight paper “A Machine Learning Approach That Beats Large Rubik’s Cubes” (arXiv:2502.13266). It finds short paths on very large Cayley graphs — the state graphs of permutation puzzles such as the Rubik’s Cube — by training a network to estimate the diffusion distance to the solved state and using that estimate to guide a batched GPU beam search.

The approach uses zero human knowledge: no handcrafted heuristics, no domain rules, no pattern databases. The same architecture and the same hyperparameters transfer across puzzles unchanged.

The repository also implements the follow-up paper in the CayleyPy series, “CayleyPy RL: Pathfinding and Reinforcement Learning on Cayley Graphs” (arXiv:2502.18663): the optional Modified DQN refinement of the value estimates and the LRX puzzle family (cyclic shift + transposition generators) studied there.

Diffusion-distance predictor + batched beam search

The whole pipeline — data generation, training, search — is plain PyTorch, built for massive GPU parallelism. On a single NVIDIA H100, with model parameters N₁ = 1024, N₂ = 256, Nᵣ = 1, beam width 2²⁰ and only 1.28×10⁸ training examples:

PuzzleGraph sizeTraining (min)Solving (min)Avg. solution len.Solved (%)
Rubik’s Cube 3×3×34×10¹⁹0.80.1720.5 ± 0.1100
Rubik’s Cube 4×4×47×10⁴⁵1.51.2465.0 ± 1.094
Pancake Graph 553×10⁷³1.43.4950.0 ± 0.3100
Klotski 6×6 (PBC)2×10⁴¹1.20.45113 ± 2.0100

With more compute the method reaches 98% optimality on 3×3×3 (QTM), outperforms the top Santa Kaggle 2023 submissions on 3×3×3, 4×4×4 and 5×5×5 in average solution length, and on 3×3×3 delivers 20× faster path finding than the previous state of the art at comparable solution lengths. See Results.

Where to go next#

I want to…Start here
Understand what this project doesIntroduction
Solve a puzzle with pretrained weightsTesting a pretrained model
Train my own modelTraining
Add my own puzzleAdding new puzzles
See how the code fits togetherArchitecture
Read the method and the numbersResearch
Look up a flag, a group ID or a termReference