AlphaZero

From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * AlphaZero

AlphaZero,

a chess and Go playing entity by Google DeepMind based on a general reinforcement learning algorithm with the same name. On December 5, 2017 [1], the DeepMind team around David Silver, Thomas Hubert, and Julian Schrittwieser along with former Giraffe author Matthew Lai, reported on their generalized algorithm, combining Deep learning with Monte-Carlo Tree Search (MCTS) [2]. The final peer reviewed paper with various clarifications was published almost one year later in the Science magazine under the title A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play [3].


Starting from random play, and given no domain knowledge except the game rules, AlphaZero achieved a superhuman level of play in the games of chess and Shogi as well as in Go. The algorithm is a more generic version of the AlphaGo Zero algorithm that was first introduced in the domain of Go [4]. AlphaZero evaluates positions using non-linear function approximation based on a deep neural network, rather than the linear function approximation as used in classical chess programs. This neural network takes the board position as input and outputs a vector of move probabilities (policy) and a position evaluation. Once trained, these network is combined with a Monte-Carlo Tree Search (MCTS) using the policy to narrow down the search to high ­probability moves, and using the value in conjunction with a fast rollout policy to evaluate positions in the tree. The selection is done by a variation of Rosin's UCT improvement dubbed PUCT.

„Zero
ist die Stille. Zero ist der
Anfang. Zero ist rund. Zero dreht sich.
Zero ist der Mond. Die Sonne ist Zero.
Zero ist weiss. Die Wüste Zero. Der Himmel
über Zero. Die Nacht –, Zero fließt. Das Auge
Zero. Nabel. Mund. Kuß. Die Milch ist rund. Die
Blume Zero der Vogel. Schweigend. Schwebend. Ich
esse Zero, ich trinke Zero, ich schlafe Zero, ich wache
Zero, ich liebe Zero. Zero ist schön, dynamo, dynamo,
dynamo. Die Bäume im Frühling, der Schnee, Feuer,
Wasser, Meer. Rot orange gelb grün indigo blau violett
Zero Zero Regenbogen. 4 3 2 1 Zero. Gold und
Silber, Schall und Rauch. Wanderzirkus Zero.
Zero ist die Stille. Zero ist der Anfang.
Zero ist rund. Zero ist
Zero.“
[5]

Network Architecture

The deep neural network consists of a “body” with input and hidden layers of spatial NxN planes, 8x8 board arrays for chess, followed by both policy and value “heads” [6] [7]. Each square cell of the input plane contains 6x2 piece-type and color bits of the current chess position from the current player's point of view, plus two bits of a repetition counter concerning the draw rule, and to further address graph history and path-dependency issues - these 14 bits times eight, that is up to seven predecessor positions as well - so that en passant, or some sense of progress is implicit. Additional 7 input bits consider castling rights, total move count and side to move, yielding in 119 bits per square cell for chess.

The body consists of a rectified batch-normalized convolutional layer followed by 19 residual blocks. Each such block consists of two rectified batch-normalized residual convolutional layers with a skip connection [8] [9]. Each convolution applies 256 filters (shared weight vectors) of kernel size 3x3 with stride 1. These layers connect the pieces on different squares to each other due to consecutive convolutions, where a cell of a layer is connected to the correspondent 3x3 receptive field of the previous layer, so that after 4 convolutions, each square is connected to every other cell in the original input layer [10].

The policy head applies an additional rectified, batch-normalized convolutional layer, followed by a final convolution of 73 filters for chess, with the final policy output represented as an 8x8 board array as well, for every origin square up to 73 target square possibilities (NRayDirs x MaxRayLength + NKnightDirs + NPawnDirs * NMinorPromotions), encoding a probability distribution over 64x73 = 4,672 possible moves, where illegal moves were masked out by setting their probabilities to zero, re-normalising the probabilities for remaining moves. The value head applies an additional rectified, batch-normalized convolution of 1 filter of kernel size 1x1 with stride 1, followed by a rectified linear layer of size 256 and a tanh-linear layer of size 1.

Training

AlphaZero was trained in 700,000 steps or mini-batches of size 4096 each, starting from randomly initialized parameters, using 5,000 first-generation TPUs [11] to generate self-play games and 64 second-generation TPUs [12] [13] [14] to train the neural networks [15] .

Stockfish Match

As mentioned in the December 2017 paper [16], a 100 game match versus Stockfish 8 using 64 threads and a transposition table size of 1GiB, was won by AlphaZero using a single machine with 4 first-generation TPUs with +28=72-0, 10 games were published. Despite a possible hardware advantage of AlphaZero and criticized playing conditions [17], this is a tremendous achievement.

In the final peer reviewed paper, published in Science magazine in December 2018 [18] along with supplementary materials [19], a 1000 game match was reported with about 200 games published, versus various most recent Stockfish versions available at the time of the matches, that is Stockfish 8, a development version as of January 13, 2018 close to Stockfish 9, Brainfish with Cerebellum book, and Stockfish 9, in total AlphaZero winning 155 games and losing 6 games.

Stockfish was configured according to its 2016 TCEC Season 9 superfinal settings: 44 threads on 44 cores (two 2.2GHz Intel Xeon Broadwell x86-64 CPUs with 22 cores, running Linux), a transposition table size of 32 GiB, and 6-men Syzygy bases. Time control was 3 hours per side and game plus 15 seconds increment per move. AlphaZero used a simple time control strategy: thinking for 1/20th of the remaining time, and selects moves greedily with respect to the root visit count. Each MCTS was executed on a single machine with 4 first-generation TPUs.

AlphaZero and Stockfish (except Brainfish) used no opening book, 12 common human positions as well as the 2016 TCEC Season 9 superfinal positions were played, originally selected by Jeroen Noomen [20]. To ensure diversity against opponents (Brainfish) with a deterministic opening book, AlphaZero used a small amount of randomization in its opening moves. This avoided duplicate games but also resulted in more losses by AlphaZero.

See also

Publications

2017

2018

2019

2020 ...

Forum Posts

2017

Re: AlphaZero is not like other chess programs by Rein Halbersma, CCC, December 09, 2017

2018

Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by Larry Kaufman, CCC, December 07, 2018
Re: Alphazero news by Kai Laskos, CCC, December 07, 2018
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by crem, CCC, December 07, 2018
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by crem, CCC, December 07, 2018
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by Gian-Carlo Pascutto, CCC, December 07, 2018 » Leela Chess Zero
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018
Re: Alphazero news by Matthew Lai, CCC, December 07, 2018 » Giraffe
Re: Alphazero news by Matthew Lai, CCC, December 08, 2018
Re: Alphazero news by Jonathan Rosenthal, CCC, December 11, 2018
Re: Alphazero news by Matthew Lai, CCC, December 11, 2018
Re: Alphazero news by Matthew Lai, CCC, December 11, 2018 » Stockfish Match
Re: Alphazero news by Milos, CCC, December 11, 2018
Re: Alphazero news by Gian-Carlo Pascutto, CCC, December 11, 2018
Re: Alphazero news by Matthew Lai, CCC, December 11, 2018
Re: Alphazero news by Kai Laskos, CCC, December 12, 2018 » Stockfish Match

2019

2020 ...

Blog Posts

Lessons from AlphaZero: Connect Four by Aditya Prasad, Oracle Blog, June 13, 2018
Lessons from AlphaZero (part 3): Parameter Tweaking by Aditya Prasad, Oracle Blog, June 20, 2018
Lessons From AlphaZero (part 4): Improving the Training Target by Vish Abrams, Oracle Blog, June 27, 2018
Lessons From Alpha Zero (part 5): Performance Optimization by Anthony Young, Oracle Blog, July 03, 2018
Lessons From Alpha Zero (part 6) — Hyperparameter Tuning by Anthony Young, Oracle Blog, July 11, 2018

External Links

GitHub - suragnair/alpha-zero-general: A clean and simple implementation of a self-play learning algorithm based on AlphaGo Zero (any game, any framework!)

OpenSpiel

Reports

2017

2018 ...

Stockfish Match

Round 1

Round 2, 3

Misc

lineup: Irmin Schmidt, Michael Karoli, Holger Czukay, Damo Suzuki, Jaki Liebezeit

References

  1. "5th of December - The Krampus has come", suggested by Michael Scheidl in AlphaZero by Peter Martan, CSS Forum, December 06, 2017, with further comments by Ingo Althöfer
  2. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2017). Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm. arXiv:1712.01815
  3. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2018). A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play. Science, Vol. 362, No. 6419
  4. AlphaGo Zero: Learning from scratch by Demis Hassabis and David Silver, DeepMind, October 18, 2017
  5. Zero Manifesto by Günther Uecker, Heinz Mack and Otto Piene of the ZERO Art group 1963, Translation by Google Translate
    "Zero is silence. Zero is the beginning. Zero is round. Zero turns. Zero is the moon. The sun is zero. Zero is white. The desert zero. The sky over zero. The night -, Zero flows. The eye zero. Navel. Mouth. Kiss. The milk is round. The flower zero the bird. Silently. Pending. I eat Zero, I drink Zero, I sleep Zero, I watch Zero, I love Zero. Zero is beautiful, dynamo, dynamo, dynamo. The trees in spring, the snow, fire, water, sea. Red orange yellow green indigo blue violet zero zero rainbow. 4 3 2 1 Zero. Gold and silver, noise and smoke. Zero circus. Zero is silence. Zero is the beginning. Zero is round. Zero is zero. "
    Zero the new Idealism
  6. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2018). A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play. Science, Vol. 362, No. 6419, Supplementary Materials - Architecture
  7. Re: Alphazero news by Matthew Lai, CCC, December 08, 2018
  8. The principle of residual nets is to add the input of the layer to the output of each layer. With this simple modification training is faster and enables deeper networks, see Tristan Cazenave (2017). Residual Networks for Computer Go. IEEE Transactions on Computational Intelligence and AI in Games, Vol. PP, No. 99, pdf
  9. Residual Networks for Computer Go by Brahim Hamadicharef, CCC, December 07, 2017
  10. Re: AlphaZero is not like other chess programs by Rein Halbersma, CCC, December 09, 2017
  11. First In-Depth Look at Google’s TPU Architecture by Nicole Hemsoth, The Next Platform, April 05, 2017
  12. Photo of Google Cloud TPU cluster by Norman Schmidt, CCC, December 09, 2017
  13. First In-Depth Look at Google’s New Second-Generation TPU by Nicole Hemsoth, The Next Platform, May 17, 2017
  14. Under The Hood Of Google’s TPU2 Machine Learning Clusters by Paul Teich, The Next Platform, May 22, 2017
  15. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2017). Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm. arXiv:1712.01815
  16. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2017). Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm. arXiv:1712.01815
  17. Alpha Zero by BB+, OpenChess Forum, December 06, 2017
  18. David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, Demis Hassabis (2018). A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play. Science, Vol. 362, No. 6419
  19. Supplementary Materials
  20. Supplementary Materials S4
  21. "Exact-Win Strategy for Overcoming AlphaZero" · Issue #799 · LeelaChessZero/lc0 · GitHub
  22. AlphaZero: Shedding new light on the grand games of chess, shogi and Go by David Silver, Thomas Hubert, Julian Schrittwieser and Demis Hassabis, DeepMind, December 03, 2018
  23. open_spiel/contributing.md at master · deepmind/open_spiel · GitHub
  24. Book about Neural Networks for Chess by dkl, CCC, September 29, 2021
  25. Acquisition of Chess Knowledge in AlphaZero, ChessBase News, November 18, 2021
  26. AlphaZero explained by one creator by Mario Carbonell Martinez, CCC, December 19, 2017
  27. A Simple Alpha(Go) Zero Tutorial by Oliver Roese, CCC, December 30, 2017
  28. Marc Lanctot, Edward Lockhart, Jean-Baptiste Lespiau, Vinícius Flores Zambaldi, Satyaki Upadhyay, Julien Pérolat, Sriram Srinivasan, Finbarr Timbers, Karl Tuyls, Shayegan Omidshafiei, Daniel Hennes, Dustin Morrill, Paul Muller, Timo Ewalds, Ryan Faulkner, János Kramár, Bart De Vylder, Brennan Saeta, James Bradbury, David Ding, Sebastian Borgeaud, Matthew Lai, Julian Schrittwieser, Thomas Anthony, Edward Hughes, Ivo Danihelka, Jonah Ryan-Davis (2019). OpenSpiel: A Framework for Reinforcement Learning in Games. arXiv:1908.09453
  29. BBC News; 'Google's ... DeepMind AI claims chess crown' by pennine22, Hiarcs Forum, December 07, 2017
  30. Reactions about AlphaZero from top GMs... by Norman Schmidt, CCC, December 08, 2017
  31. recent article on alphazero ... 12/11/2017 ... by Dan Ellwein, CCC, December 14, 2017
  32. AlphaZero No Castling Chess by Javier Ros, CCC, December 03, 2019
  33. Cerebellum analysis of the AlphaZero - Stockfish Games by Thomas Zipproth, CCC, December 11, 2017
  34. AlphaZero reinvents mobility and romanticism by Chris Whittington, Rybka Forum, December 08, 2017
  35. Immortal Zugzwang Game from Wikipedia
  36. Article:"How Alpha Zero Sees/Wins" by AA Ross, CCC, January 17, 2018
  37. Anna Rudolf analyzes a game of AlphaZero's by Stuart Cracraft, CCC, December 07, 2018
  38. Connect 4 AlphaZero implemented using Python... by Steve Maughan, CCC, January 29, 2018

Up one Level