ByteBulletin

[research] · · 2 min read

nanoAlphaZero: A Compact, TPU-Optimized AlphaZero That Hits Grandmaster Chess in Under 24 Hours

An open-source, game-agnostic reimplementation of AlphaZero achieves perfect play in Hex and grandmaster-level chess — if you have a TPU.

By ByteBulletin Editors · Editorial Team

[research]

AlphaZero’s original paper showed that a single algorithm could master chess, shogi, and Go from scratch, but the original implementation was notoriously resource-intensive and hard to reproduce. A new open-source project, nanoAlphaZero, aims to change that with a game-agnostic, high-performance implementation that fits on a TPU VM and trains grandmaster-level chess models in under 24 hours.

The project is built specifically for TPUs, not GPUs — the author notes that correctness on GPUs isn’t guaranteed. That’s a deliberate trade-off: TPUs offer high throughput for the matrix-heavy workloads of self-play and neural network inference, and nanoAlphaZero optimizes every step for that hardware. On a fresh TPU VM, you can train a model and then drop into an interactive game against it, with the trained parameters and resolved model configuration auto-saving to artifacts/alphazero_<env>.safetensors.

What’s Inside

nanoAlphaZero is game-agnostic — it can be adapted to a new game by hoisting the core logic, and the author provides a Colab notebook that runs on a TPU to train on a completely new game. Supported games include Hex, chess, and more, with config options for network size, MCTS simulations, and training cycles.

One of the most striking results is in Hex, a game that has been solved. As training progresses, nanoAlphaZero’s value head learns perfect play: the mean squared error (MSE) versus perfect play falls from ~0.9996 to 0.0007, and sign accuracy climbs from 0.673 to 1.000. The trainer periodically prints its verdict on every Black opening move, providing real-time visualization of the value head converging to the known perfect-play outcomes.

For chess, the project claims grandmaster-level strength by benchmarking against DeepMind’s Searchless Chess, a search-free transformer model that reached 2895 Lichess Blitz Elo against humans. The evaluation report shows how nanoAlphaZero’s 10x256nbt models fare against Searchless Chess 270M, and the results are solid enough to make these models ideal training opponents.

Why This Matters for Developers

For developers working on reinforcement learning or game AI, nanoAlphaZero is a significant contribution. It demonstrates that AlphaZero’s approach can be made practical on commodity cloud hardware (TPUs are available via Google Cloud and Colab), and it provides a clean, testable codebase for experimenting with self-play, MCTS, and neural network value/policy heads.

One caveat: the TPU-only focus could be a hurdle for many open-source developers, since GPUs are far more common in hobbyist and research environments. But for those with TPU access, nanoAlphaZero offers a reproducible path to state-of-the-art game AI — and a fascinating window into how neural networks can learn perfect play.

SHARE

← All stories