A Retrieval-based Chess Engine
COS 597A: Long Term Memory for AI Systems @ Princeton University
The game of chess has historically been a driver of progress in artificial intelligence due to its high branching factor and the infeasibility of a complete computational solution. Most modern chess-engines are sophisticated algorithms that utilize complex value estimations, heuristics, tree-search algorithms and table-bases to find good moves. The recent online chess boom has led to the availability of transcripts of billions of public games played between strong players. The moves played in these games are typically near-optimal as measured by the strongest modern chess engines. We propose a simple retrieval-based chess-engine that utilizes these transcripts to make strong expert-level moves in any given position. We use a pretrained embedder from prior work to embed chess positions into 64-dimensional vectors, and create a large vector database of 100M chess positions from the lichess dataset. We then train ChessBERT, a BERT-like model which learns a mapping from chess position to optimal move when given k retrieved similar chess positions in context. We show that providing the context positions can improve sample-efficiency as well as overall performance.