Learning to Play: Reinforcement Learning and Games
Abstract
Amazing breakthroughs in reinforcement learning have taken place. Computers teach themselves to play Chess and Go and beat world champions. There is talk about expanding application areas towards general artificial intelligence (AI). The breakthroughs in Backgammon, Checkers, Chess, Atari, Go, Poker, and StarCraft have shown that we can build machines that exhibit intelligent game playing of the highest level. These successes have been widely publicized in the media, and inspire AI entrepreneurs and scientists alike. Reinforcement learning in games has become a mainstream AI research topic. It is a broad topic, and the successes build on a range of diverse techniques, from exact planning algorithms, to adaptive sampling, deep function approximation, and ingenious self-play methods. Perhaps because of the breadth of these technologies, or because of the recency of the breakthroughs, there are few books that explain these methods in depth. This book covers all methods in one comprehensive volume, explaining the latest research, bringing you as close as possible to working implementations, with many references to the original research papers. The programming examples in this book are in Python, the language in which most current reinforcement learning research is conducted. We help you to get started with machine learning frameworks such as Gym, TensorFlow, and Keras, and provide exercises to help understand how AI is learning to play.
Figures & tables
| Name | board | state space | zero-sum | information | turn |
|---|---|---|---|---|---|
| Chess | zero-sum | perfect | turn | ||
| Checkers | zero-sum | perfect | turn | ||
| Othello | zero-sum | perfect | turn | ||
| Backgammon | 24 | zero-sum | chance | turn | |
| Go | zero-sum | perfect | turn | ||
| Shogi | zero-sum | perfect | turn |
| Solution tree | Value | # children at max node | # children at min node |
|---|---|---|---|
| Max | upper bound | all | |
| Min | lower bound | all |
| Critical/solution trees |
|---|
| Critical tree = max solution tree min solution tree |
| Critical path = max solution tree min solution tree |
| Name | Principle | Applicability | Effectiveness |
|---|---|---|---|
| alpha-beta | backward pruning | all minimax games | |
| iterative deepening | iterate search depth | with TT: move ordering | helps alpha-beta |
| transposition table | cache of states | with ID: move ordering | helps alpha-beta |
| null window | alpha-beta cutoffs | all minimax games | more cutoffs |
| forward pruning | variable width | domain specific | variable |
| capture moves | ordering | games with captures | good |
| Name | Principle | Applicability | Effectiveness |
|---|---|---|---|
| search extensions | variable depth | domain specific | good |
| quiescence search | variable depth | domain specific | good |
| null-move search | variable depth | no Zugzwang | good |
| odd-even effect | move advantage | minimax games | unstable values |
| piece-square tables | evaluation coding | heuristic evaluation | efficiency |
| coefficient learning | machine learning | evaluation tuning | automated learning |
| Name | Principle | Applicability | Effectiveness |
|---|---|---|---|
| expl/expl | expl/expl/N | small/large searches | all MCTS |
| RAVE | statistics sharing | early phase | all MCTS |
| play-out db | small patterns | domain specific | domain dependent |
| adaptive expl/expl | variable | general | all MCTS |
| parallelism | parallel search | general | all MCTS |
| Name | Principle | Applicability | Effectiveness |
|---|---|---|---|
| AlexNet | CNN | image | improve |
| inception | net inside net | image | improve |
| residual | skip links | image | improve |
| GAN | generative-adversarial | image | robustness |
| RNN/LSTM | state | sequential proc | sequences |
| Supervised learning | Reinforcement learning |
|---|---|
| (example-label) or (example-number) pair | (state-action) or (state-reward) pair |
| database of ground truths | environment gives reward |
| static learning process | interactive learning process |
| fixed set of examples | changing and interdependent set of examples |
| dense: ground truth for all examples | sparse: rewards for some examples |
| Name | Principle | Applicability | Effectiveness |
|---|---|---|---|
| double DQN | de-overestimate values | DQN | convergence |
| prioritized experience | decorrelation | replay buffer | convergence |
| distributional | probability distr | deep RL | generalization |
| random noise | parametric noise | deep RL | more exploration |
| actor-critic | value/policy interleave | A3C, PPO, dueling | stability, parallel |
| Program | Game | Plan | Learn | Data | Net | Eval | Reference |
|---|---|---|---|---|---|---|---|
| Samuel | Check. | AlphaB. | coeff. | self-play | - | coeff. feat. | Samuel 1959 [ 577 ] |
| Chinook | Check. | AlphaB. | - | endgames | - | heur. feat. | Schaeffer 1992 [ 590 ] |
| Logistello | Othello | AlphaB. | regress. | patterns | - | coeff. pat. | Buro 1995 [ 113 ] |
| Deep Blue | Chess | AlphaB. | coeff. | manual | - | coeff. feat. | Hsu 1990 [ 310 ] |
| NeuroCh. | Chess | AlphaB. | TD(0) | db/self-play | 1 layer | coeff. feat. | Thrun 1995 [ 686 ] |
| Neurogam. | B.gam. | - | FCN | games db | 1 layer | coeff. feat. | Tesauro 1989 [ 673 ] |
| Program | Planning | Learning | Input/output | Achievement |
|---|---|---|---|---|
| AlphaGo | MCTS | supervised & reinforcement | Go | beat human champions |
| AlphaGo Zero | MCTS | self-play | Go | learn tabula rasa |
| AlphaZero | MCTS | self-play | Go, Chess, Shogi | generalize three games |
| Hyperparameter | Value |
|---|---|
| self play games per iteration | 25000 |
| MCTS simulations | 1600 |
| exploration temperature | 1 for first 30 moves, 0 afterwards |
| Dirichlet noise | |
| resignation threshold | 5% |
| regularization parameter |
| System 1 | System 2 |
|---|---|
| fast | slow |
| recognition | reasoning |
| reflex | rational |
| approximate | exact |
| train | plan |
| eval | search |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Name | Type | URL | Ref. |
|---|---|---|---|
| Python | General-purpose language | https://www.python.org | [ 562 ] |
| Weka | Machine learning env. | https://www.cs.waikato.ac.nz/ml/weka | [ 762 ] |
| Scikit-Learn | Machine learning env. | https://scikit-learn.org | [ 513 ] |
| Caffe | Deep learning env. | http://caffe.berkeleyvision.org | [ 334 ] |
| PyTorch | Deep learning env. | https://pytorch.org | [ 508 ] |
| TensorFlow | Deep learning env. | https://www.tensorflow.org | [ 2 ] |
| Name | Type | URL | Ref. |
|---|---|---|---|
| ALE | Atari Games | https://github.com/mgbellemare/Arcade-Learning-Environment | [ 53 ] |
| Gym | RL environments | https://gym.openai.com | [ 98 ] |
| Stable | RL algorithms | https://stable-baselines.readthedocs.io | [ 291 ] |
| Baselines | |||
| Dopamine | Deep RL env. | https://github.com/google/dopamine | [ 123 ] |
| RLlib | Distributed RL | https://docs.ray.io/en/latest/rllib.html | [ 417 ] |
| Name | Type | URL | Ref. |
|---|---|---|---|
| AlphaZero General | AlphaZero in Python | https://github.com/suragnair/alpha-zero-general | [ 679 ] |
| ELF | Game framework | https://github.com/pytorch/ELF | [ 689 ] |
| Leela | AlphaZero for Chess, Go | https://github.com/LeelaChessZero/lczero | [ 507 ] |
| PhoenixGo | AlphaZero-based Go prog. | https://github.com/Tencent/PhoenixGo | [ 775 ] |
| PolyGames | Env. for Zero learning | https://github.com/facebookincubator/Polygames | [ 124 ] |
| Server | Name | Link |
|---|---|---|
| OGS | Online Go Server | https://online-go.com |
| KGS | Kiseido Go Server | http://www.gokgs.com |
| IGS | Pandanet Internet Go Server | http://www.pandanet-igs.com |
| Tygem | Tygem Baduk | http://www.tygembaduk.com |
| Fox | Fox Weiqi (Chinese) | https://www.foxwq.com |
| Dragon | Dragon Go Server for correspondence | https://www.dragongoserver.net |
| Tutorial | Link |
|---|---|
| Kiseido | https://www.kiseido.com/ff.htm |
| Nordic | https://www.nordicgodojo.eu/post/212/a-simple-beginners-guide-to-go |
| Online Go | https://online-go.com/learn-to-play-go |
| Wikipedia | https://en.wikipedia.org/wiki/Go_(game) |
| Server | Link |
|---|---|
| Chess.com | https://chess.com |
| Internet Chess Club | http://chessclub.com |
| Chessbase | https://en.chessbase.com |
| Chess24 | https://chess24.com/en/play/chess |
| Lichess | https://lichess.org |
| Wikipedia | https://en.wikipedia.org/wiki/Chess |
| Engine | Link |
|---|---|
| Stockfish | https://stockfishchess.org |
| Komodo | http://komodochess.com |
| Houdini | http://www.cruxis.com/chess/houdini.htm |
| Critter | http://www.vlasak.biz/critter/ |
| Ethereal | https://github.com/AndyGrant/Ethereal |
| Gull | https://sourceforge.net/projects/gullchess/ |
| Abbreviation | Journal |
|---|---|
| PAMI | IEEE Transactions on Pattern Analysis and Machine Intelligence |
| AIJ | Artificial Intelligence Journal |
| JAIR | Journal of AI Research |
| ToG | IEEE Transactions on Games |
| ICGAJ | ICCA/ICGA Journal |
| Science | Science |
| Abbreviation | Conference |
|---|---|
| IJCAI | International Joint Conference on AI |
| AAAI | Association for the Advancement of AI |
| ECAI | European Conference on AI |
| FDG | Foundations of Digital Games |
| CoG | Conference on Games |
| NeurIPS | Neural Information Processing Systems |