A honest take for someone using this repo as their entry point into AI.
A 2017-era research reimplementation of DeepMind's AlphaGo Zero, in TensorFlow 1.x, by Brain Lee and several contributors. It reproduces the AGZ pipeline: supervised training on human SGFs, self-play with MCTS, evaluation against a best-model pool. It is not a polished library, not a product, and not a teaching scaffold — it is a single-author research codebase pinned to a now-ancient toolchain.
If you came here from "I want to learn AI", this is closer to reading a senior engineer's working notebook than to following a tutorial.
Strengths worth reading carefully
- The end-to-end AGZ data flow is all here, in one place: SGF → feature planes → CNN+ResNet → policy + value → MCTS → self-play → evaluation. Few modern repos give you the whole loop in 2,000 lines.
utils/(Go game logic, SGF parsing, feature extraction) is a tight reimplementation of the relevant MuGo pieces. Good code to study.model/SelfPlayWorker.pyandmodel/APV_MCTS_tree.pyshow classic MCTS + neural-network guidance in pure Python. Educational.Network.pyis a clean illustration of TF 1.x graph/session plumbing — including the ugly bits (var_to_save, BN variable handling, thetf.placeholderfights). Knowing this helps you appreciate TF 2.x.- The config layer (
config.py:FLAGS+HPS) is simple and conventional.
Weaknesses you will hit
- It will not run on a modern setup as-is. The README warns TF ≥ 1.5 cannot load the shipped checkpoints. Python 3.6 is end-of-life.
protobuf==3.1.0.post1andsix==1.10.0are pinned because newer versions break the model files. Expect to spend hours just getting an import to work. - No build, no tests, no CI. The "test" mode is "
trainon the test split", not a unit-test suite.utils/tests/exists but has no runner. - Heavy GPU + data requirements. The reference workflow wants hundreds of GB of SGFs, a GPU, and days of training. The pretraining checkpoint download is a separate Google Drive link.
- Legacy TF idioms everywhere.
tf.placeholder,tf.Session,tf.global_variables_initializer(), explicitfeed_dict— all of which have been replaced bytf.function/ Keras in 2019. - Dead/experimental code mixed with runtime code.
model/APV_MCTS_C.pyx(Cython) is not built and not imported;support/is bundled upstream reference code (MuGo, RocAlphaGo, ...) that is not part of the runtime but is committed in-tree. - Typos and surprises baked in.
dest='gpt_policy'for the--gtp_policyflag,firts_time=inpreprocess.py, the hard-coded anaconda shebang onmain.py:1, the README's broken—-gtp_poliycommand. None of these are bugs you'd want to "fix" — they are part of the code you're reading.
As a hands-on environment to run: no. You'll burn days on environment setup before you see a single training step.
As a code-reading curriculum to learn the deep classic: yes, with structure. Used as a textbook, this repo is one of the best single-file-window views of the AGZ algorithm you can find. The trick is to read it in a specific order, not to run it.
If you want to actually learn from this repo without trying to run it, go in this order:
README.md+ the original AlphaGo Zero paper (Nature, 2017). Read them side by side.config.py(65 lines). All the knobs in one place.main.py. The mode dispatcher (fn = {'train': ..., 'gtp': ..., ...}at line 225) tells you the whole project in 5 lines.utils/—go.py,features.py,sgf_wrapper.py,strategies.py. Game logic + feature extraction. This is the most transferable skill in the repo.Network.py— TF 1.x graph wiring. Read it as "what did TF 1 force you to write by hand?".model/APV_MCTS_tree.py— pure-Python MCTS. This is the algorithmic heart.model/SelfPlayWorker.py— the self-play loop. Read this once you've digested MCTS.model/alphagozero_resnet_full_model.py— the architecture. Variant selection via--model_type {original,elu,full}is inNetwork.py:70-75.AGENTS.md(the file we just wrote) for the gotchas.
Skip support/ entirely unless you want to compare this repo to its ancestors.
If your goal is "get into AI" in 2026, the faster paths are:
- PyTorch + a single modern tutorial (Karpathy's "Zero to Hero" series, the PyTorch quickstart). TF 1.x is a dead end professionally.
- Stable-Baselines3 or CleanRL for reinforcement learning with modern APIs. They replace the entire
selfplay.py+APV_MCTS.pyecosystem in ~50 lines. - Re-implement AGZ yourself in PyTorch as a learning exercise. You will understand the algorithm 10× better than by reading this repo, and you will have something that actually runs on a single GPU.
- Read the code in this repo as a reference, not as a target. The patterns here (MCTS, self-play, feature planes, dual policy+value heads) all show up in modern AlphaZero-style projects (Leela Chess, KataGo, MuZero reimplementations).
- Wrote
AGENTS.mdat the repo root: a compact, repo-specific instruction file for future Kilo sessions covering stack lock-in, entrypoints, workflow, architecture, quirks, tests, and conventions. It is designed to answer "would an agent likely miss this without help?" for every line.
This repo is a 2017 research notebook, not a learner-facing AI starting point. It is excellent material to read and terrible material to run. Treat it as a textbook: read it in the order above, hand-port the pieces you care about to PyTorch, and use modern frameworks for anything you actually want to train. Keep AGENTS.md open when you come back — it will save the next agent (or future you) hours of rediscovering the gotchas.