DeepMind has open-sourced the heart of AlphaGo and AlphaZero
twitter.com
twitter.com
I came up with a nifty implementation in Python that outperforms the naive impl by 30x, allowing a pure python MCTS/NN interop implementation. See https://www.moderndescartes.com/essays/deep_dive_mcts/
MCTX comes up with an even niftier implementation in JAX that runs the entire MCTS algorithm on the TPU. This is quite a feat because tree search is typically a heavily pointer based algorithm. It uses the object pool pattern described in https://gameprogrammingpatterns.com/object-pool.html to serialize all of the nodes of the search tree into one flat array (which is how it manages to fit into JAX formalisms). I suspect it's not a particularly efficient use of the TPU, but it does cut out all of the CPU-TPU round trip latency, which I'm sure more than compensates.
Great post!
Chasing pointers in the MCTS tree is definitely a slow approach. Although typically there are ~ 900 "considerations" per move for alphazero. I've found getting value/policy predictions from a neural network (or GBDT[1]) for the node expansions during those considerations is at least an order of magnitude slower than the MCTS tree-hopping logic.
If you have the research paper, someone in the field could reimplement them in a few days.
Then there is the large compute cost for training them to produce the trained weights.
So, opensourcing these bits of work without the weights isn't as major a thing as you might imagine.
And as far as I understand, the training code is where the secret sauce lies.
Secret sauce is in the ML compiler and accelerator used, but all those improvements simply lower the cost of training a model. You could still do it on a regular GPU, it would just take you more time.
In the case of Google, they probably used TPU chips that you can't get direct 'bare metal' access to anyway, so none of that code would have helped.
The actual optimizer used and parameters (like the learning rate schedule) is normally published in the research paper.
1600 inferences per move * 1ms per inference * 250 moves/game * 30M games played = 12B seconds. 140k days; muzero with gumbel brought down the 1600 to ~40, but either way, you need some more scale.
It turns out a lot of the difficulties, judgment calls, and implementation details involve data pipelining. Some of those choices affect the final skill ceiling you reach. Which ones? How much? Are they path dependent? Well, you'll need to run it more than once...
High level, I'd say it's a good way to test a new environment w/out spending time/effort on GPUs until you understand the problem well, and then you can switch to the time/money costly GPU world.
I'm shocked to discover it's been rated higher than AlphaZero & Komodo and just slightly below Stockfish
Is it valuable to have open source AI systems is the countering question to that…
Hi I did this while I was at Google Brain and it took our team of three more like a year. The "reimplementation" part took 3 months or so and the rest of the time was literally trying to debug and figure out all of the subtleties that were not quite mentioned in the paper. See https://openreview.net/forum?id=H1eerhIpLV
> The replication crisis (also called the replicability crisis and the reproducibility crisis) is an ongoing methodological crisis in which the results of many scientific studies are difficult or impossible to reproduce. Because the reproducibility of empirical results is an essential part of the scientific method,[2] such failures undermine the credibility of theories building on them and potentially call into question substantial parts of scientific knowledge.
People should publish automated tests. How does a performance-optimizer know that they haven't changed the output of there are no known-good inputs and outputs documented as executable tests? Pytest-hypothesis seems like a nice compact way to specify tests.
AlphaZero: https://en.wikipedia.org/wiki/AlphaZero
GH topic "AlphaZero" https://github.com/topics/alphazero
I believe ther are one or more JAX implementations of AlphaZero?
Though there's not yet a quantum-inference-based self-play (AlphaZero) algorithm?
TIL about the modified snow plow problem is a variation on TSP, and there are already quantum algos capable of optimally solving TSP.
Can you run the notebook again with the exact same data sample (input) and get the same charts and summary statistics (output)? Is there a way to test the stability of those outputs over time?
Can you run the same experiment (the same 'experimental design'), ceteris paribus (everything else being equal) and a different sample (input) and get a very similar output? Is it stable, differentiable, independent, nonlinear, reversible; Does it converge?
Now I have to go look up the definitions for Replication, Repeatability, Reproducibility
Replication_(scientific_method) -> Reproducibility https://en.wikipedia.org/wiki/Reproducibility :
> Measures of reproducibility and repeatability: In chemistry, the terms reproducibility and repeatability are used with a specific quantitative meaning. [7] In inter-laboratory experiments, a concentration or other quantity of a chemical substance is measured repeatedly in different laboratories to assess the variability of the measurements. Then, the standard deviation of the difference between two values obtained within the same laboratory is called repeatability. The standard deviation for the difference between two measurement from different laboratories is called reproducibility. [8] These measures are related to the more general concept of variance components in metrology.
Replication (statistics) https://en.wikipedia.org/wiki/Replication_(statistics) :
> In engineering, science, and statistics, replication is the repetition of an experimental condition so that the variability associated with the phenomenon can be estimated. ASTM, in standard E1847, defines replication as "... the repetition of the set of all the treatment combinations to be compared in an experiment. Each of the repetitions is called a replicate."
> Replication is not the same as repeated measurements of the same item: they are dealt with differently in statistical experimental design and data analysis.
> For proper sampling, a process or batch of products should be in reasonable statistical control; inherent random variation is present but variation due to assignable (special) causes is not. Evaluation or testing of a single item does not allow for item-to-item variation and may not represent the batch or process. Replication is needed to account for this variation among items and treatments.
Accuracy and precision: https://en.m.wikipedia.org/wiki/Accuracy_and_precision :
> In simpler terms, given a statistical sample or set of data points from repeated measurements of the same quantity, the sample or set can be said to be accurate if their average is close to the true value of the quantity being measured, while the set can be said to be precise if their standard deviation is relatively small.
Reproducible builds; to isolate and minimize software variance: https://en.wikipedia.org/wiki/Reproducible_builds
Re: reproducibility, containers, Jupyter books, REES, repo2docker: https://news.ycombinator.com/item?id=32965961 https://westurner.github.io/hnlog/#comment-32965961 (Ctrl-F #linkedreproducibility)
Anyway if you want something runnable Leela has a nice reimplementation: https://github.com/leela-zero/leela-zero
For example, in Starcraft, when you A-move a large part of your army across the map, an AlphaStar-like AI could decide which units to prioritize it to attack once it reaches a group of enemy units, or what formation to move in (automatically keeping colossus in back, observer ahead, balls of marines split apart into smaller clumps), or when your Terran army encounters a significant force along the way, the tanks in back could auto-siege / auto-unsiege.
The search algorithms have been incrementally improved, but still follow the same Alpha Beta and a heap of heuristics approach.
Anyone here from DeepMind?
That said many have been retooled for a more specific purpose before public release.
I guess it's because AZ came out of Google?
Lc0 is based on AlphaZero ideas and is significantly weaker than NNUE based modern Stockfish.
Even that was debatable given the restrictions placed on the version of Stockfish it played.
Not to take anything away from AlphaZero either, self play to reach that level was quite the achievement.
E.g. inventor of the blue LED versus those who improve the efficiency by .1%
https://stockfishchess.org/blog/2020/introducing-nnue-evalua...
I'm not sure where you get the LCZero connection from.
Subjectively, the Monte Carlo moves seem so human-like in comparison to minimax. Minimax can suggest a move that no human would play because the depth of calculation at which that move is good is just impossible for people.
Open-sourcing isn't a dev-level decision - it is a business leadership decision.
Then you realize they get paid >x10 of what you are and they're fine, but the next layoff is likely gonna get you.
Humans are also trained in games when young, and even into adulthood, think war games that are held semi-annually between countries.
These are just board games with increased stakes and additional variables.
I have heard (high level sources, unconfirmed publicly) the YouTube algorithm that promotes open mouth creator with $$$$ signs thumbnails is based on their ground breaking research from this collaboration.
ie. Chess and Go. Go a couple of thousand years old, and Chess in particular a core element of AI research history.
Language model research is cool, but you should perhaps consider expanding your horizons beyond the latest headlines in AI.