Out-of-Distribution Evaluation of Rule-Based and Strategic Reasoning in Chess Transformers

Anna Mészáros, Patrik Reizinger, Ferenc HuszárICML 2026

Introduction

The debate over whether Large Language Models (LLMs) and Transformers are merely "stochastic parrots" or possess genuine internal models of reasoning remains a central question in artificial intelligence. Chess provides an ideal laboratory for this inquiry due to its rigid, formal rules and its requirement for high-level strategic planning. While most chess models are evaluated on standard gameplay, this paper asks a more rigorous question: how does a model perform when faced with out-of-distribution (OOD) scenarios?

By testing a 270M-parameter Chess Transformer on impossible board states and novel variants, researchers aimed to decouple simple pattern matching from systematic reasoning. Their findings reveal that while the model excels at rule extrapolation—consistently generating legal moves in novel configurations—its strategic depth falters when the game's starting conditions fundamentally change.

Methodology and Experimental Setup

The researchers trained a 270M-parameter decoder-only Transformer via behavior cloning. To ensure that any observed reasoning emerged directly from the Transformer rather than from auxiliary mechanisms like Monte Carlo Tree Search (MCTS) or explicit move-legality filters, they utilized a simplified architecture.

The model was trained on a filtered version of ChessBench, comprising approximately 528 million standard, legal chess positions labeled with the "best move" as determined by Stockfish 16. The input was formatted as a FEN string (a standard ASCII representation of a board state), and the output was a probability distribution over all possible moves. Crucially, the model was not forced to play legal moves; it had to infer the rules of chess entirely from the training data.

To test the model's limits, the evaluation leveraged both In-Distribution (ID) sets (standard puzzles and Lichess test positions) and meticulously crafted OOD sets. These OOD datasets included:

  • More Pieces / Same Color: Positions reachable via pawn promotion (e.g., three queens) or impossible setups (e.g., two bishops on the same color).
  • Chess960: A variant where the back-rank pieces are randomized.
  • Horde Chess: An asymmetric variant where White has 36 pawns and no King, while Black has a standard army.
  • Knights & Rooks: A custom "stress test" featuring 3 to 15 randomly placed knights to test the absolute limits of rule adherence.

Key Findings: The "Lawyer" vs. the "General"

The evaluation revealed a stark contrast in the model's capabilities, characterizing it as an excellent "lawyer" but a mediocre "general."

Robust Rule Adherence: The model demonstrated a profound grasp of legal moves, even on boards vastly different from its training data. It achieved 100% legal move accuracy on ID data and maintained an impressive 96–99% accuracy across most OOD sets. Even in the extreme Knights & Rooks stress test, legality accuracy stayed above 90%.

Limited Strategic Adaptation: While the model matched Stockfish’s top-1 move 67.7% of the time on curated OOD puzzles (compared to 70.5% for ID puzzles), its strategic quality collapsed in novel starting positions. For instance, top-1 accuracy plummeted to approximately 23% on starting positions for variants like Chess960. Furthermore, in extreme OOD tests, the model exhibited low entropy (high confidence) in its predictions even when selecting strategically poor moves—a classic failure mode of Transformers pushed beyond their training distribution.

Training Dynamics and Human Comparisons

The study uncovered fascinating training dynamics, showing that the model learns hierarchically in distinct phases. It first learns to move its own pieces, then grasps specific movement rules (legality), and finally learns to select the optimal move (strategy). This suggests an emergent compositional understanding of the game.

Interestingly, when deployed against human players on Lichess, the model reached an Elo of 1550 in Standard Blitz and 1571 in Chess960, outperforming roughly half the human player base. The performance gap between Standard Chess and Chess960 was notably smaller against humans than against Stockfish. This suggests that while humans rely heavily on "opening book" patterns that fail in Chess960, the Transformer has internalized more general principles that carry over effectively.

Conversely, in the Horde variant, the model struggled significantly (Elo 1178), failing to adapt to the radically different objective of capturing pawns rather than checkmating a King.

Limitations and Future Directions

The authors note that using FEN strings provides the model with a "perfect memory" of the current state, potentially simplifying the task compared to models that must track state from a sequential move history. Additionally, the absence of a search algorithm like MCTS means the model relies entirely on "intuition," inherently limiting its performance against symbolic engines like Stockfish.

Future research may explore whether techniques like Chain-of-Thought prompting or further parameter scaling can bridge the gap in strategic adaptation, or if Transformers will fundamentally require explicit search components to master complex, novel environments.

Summary updated

BibTeX
@inproceedings{meszaros2026out,
  author = {Anna Mészáros and Patrik Reizinger and Ferenc Huszár},
  title = {{Out-of-Distribution Evaluation of Rule-Based and Strategic Reasoning in Chess Transformers}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=JFGUsQ68rG},
}
Figure