|
Download README.md from ScAGI/written-binary-maze-solver: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/ScAGI/written-binary-maze-solver/resolve/main/README.md
- Command line
-
hf download hf://ScAGI/written-binary-maze-solver/README.md
-
curl -L -o README.md https://huggingface.co/ScAGI/written-binary-maze-solver/resolve/main/README.md
2.47 kB
| tags: | |
| - maze-solving | |
| - hard-attention | |
| - weight-space-programming | |
| - cuda | |
| - binary | |
| # Hand-written binary maze solver | |
| A train-free recurrent hard-attention network for exact shortest paths in unweighted, four-neighbour grids. Four fixed neighbour reads and a signed threshold block are reused at every cell and loop. A goal wave discovers cells at shortest-path distance; the first-discovery parent lets a second wave mark a shortest route. It is not a language model or a reproduction of the published softmax maze transformer. | |
| - **48** nonzero signed connections (+1/-1), **18** integer thresholds per lane. The **96-connection** configuration applies two independent copies to different mazes. Both share one compiled CUDA kernel; doubling throughput does not increase single-maze capability. | |
| - **Seven bits per cell**: visited, four one-hot parent directions, current path tip and on-path flag. CUDA packs them in one byte, plus the separate fixed input grid. No optimizer, training data or learned parameters. | |
| - **61/61** deterministic generated/edge cases matched on each of the two GPUs in both configurations: 59 shortest paths, including 100-by-100 grids, and two blocked/unreachable cases. CPU logical maximum observed: 2,656 iterations. GPU termination checks are batched, so kernel launches need not equal logical steps. | |
| | GPU | One lane | Two lanes | | |
| | --- | ---: | ---: | | |
| | GTX 1660 SUPER | 61.921 ms | 38.720 ms | | |
| | RTX 2080 Ti | 74.037 ms | 47.691 ms | | |
| Times are median of five warmed complete 61-case passes after a warmup, with device transfers and synchronization for each solve. Excludes fixture creation, compilation, CUDA startup and output comparison. Timings are for these exact existing hosts and a tiny workload, not a general device ranking. | |
| ## Run | |
| ```bash | |
| python -m pip install numpy | |
| python written_maze.py checkpoint.json | |
| python prepare.py | |
| nvcc -O3 -arch=sm_75 bench.cu -o bench | |
| ./bench | |
| ``` | |
| The first command after installing NumPy runs the reference from the checkpoint. `prepare.py` regenerates CPU-verified fixtures and the CUDA gate header from the same JSON; the CUDA benchmark checks every output mask against them. For a different NVIDIA architecture use a compatible compiler target. No externally sourced datasets or weights are included. | |
| Inspired by [Looped Weight-Space Programming](https://mbzuai-oryx.github.io/LoopedWSP/); this is a separate implementation with hard-wired grid neighbourhoods and exact binary state. | |