The Algorithm Is Not the Behavior: Learned Priors Override Look-Ahead in a Chess-Playing Neural Network

Elias Sandmann, Sebastian Lapuschkin, Wojciech SamekNeurIPS 2026

TL;DR

Just because a neural network learns a genuine algorithm to solve a problem doesn’t mean it will actually trust that algorithm's answer. Looking inside Leela Chess Zero, researchers discovered that the network routinely calculates brilliant, game-winning sacrifices in its middle layers, only to chicken out in the final layer and play a losing, "safe" move instead. It turns out that broad rules of thumb learned during training can actively override exact, multi-step reasoning—a sobering lesson for how we interpret and trust AI behavior.

What Problem Does This Paper Address?

Mechanistic interpretability—the art of reverse-engineering neural networks—has recently celebrated finding clean, recognizable algorithms inside black-box models, from modular arithmetic to look-ahead planning in games. Usually, researchers study these internal circuits when the model gets the right answer.

But does having the right internal algorithm guarantee algorithmic behavior? The authors ask what happens when things go wrong: can a model internally compute the exact right answer via a learned algorithm, yet still output a blunder? And if it does, what internal force is strong enough to veto a winning calculation?

Methods

The team studied a 15-layer transformer version of Leela Chess Zero, the strongest neural chess engine, focusing purely on its move-predicting policy network (without external tree search).

  • Novel Post-LN Logit Lens: Standard "logit lenses" let you peek at what a model is thinking at intermediate layers by projecting hidden states directly to the output. Because Leela uses a tricky Post-LayerNorm architecture (which non-linearly warps activations at every step), the authors extended the logit lens by zero-ablating future sublayers while keeping subsequent normalizations intact. Because Leela is an encoder that views all 64 squares simultaneously, this gives a complete snapshot of its chess policy at every depth.
  • Circuit Verification: To check if Leela’s internal look-ahead algorithm was broken on missed puzzles, they replicated standard causal interventions: activation patching (swapping square representations), attention head ablation (snipping specific "3rd-move-to-1st-move" look-ahead heads), and bilinear probing (decoding future moves from activations).
  • Concept Preference & Steering: Using handcrafted evaluation terms from the traditional chess engine Stockfish 8 (like "king safety" and "threats"), they measured what concepts each layer's policy favored. Finally, they used activation steering—nudging layer activations along the gradient of these concepts—to causally test if "safety" preferences were suppressing tactical brilliance.

Datasets

  • General Puzzle Dataset: 10,000 Lichess puzzles (from Ruoss et al., 2024), each having a single clear winning line.
  • Solved vs. Forgotten Datasets: Following prior look-ahead filtering criteria, the authors compiled 23,601 solved tactical puzzles and introduced a new dataset of 8,648 forgotten puzzles—positions where an intermediate layer found the winning move, the final output missed it, yet the full model still understood the follow-up continuation (>50% probability on subsequent moves).
  • Strength Benchmarks: 200 Encyclopedia of Chess Openings (ECO) positions for internal round-robin Elo tournaments, plus live games against humans on Lichess.

Key Insights and Ideas

  • The "Forgotten Puzzle" Phenomenon: Leela frequently solves complex tactics—even mate-in-two—around layer 12, only to overwrite the solution in the final feed-forward layer. Remarkably, in 97.0% of these cases, Leela's own value head knows the chosen final move is worse than the forgotten sacrifice!
Figure 1: Our extended logit lens maps intermediate activations to policy distributions across transformer layers in Leela Chess Zero, revealing a forgotten mate-in-two puzzle with optimal line of play—the principal variation—1. QXf1+ KXf1 2. Rd1m, Black to move. Left: The correct queen sacrifice QXf1+ maintains high probability through most layers, peaking at layer 12, before dropping sharply in the final layers. The losing move Qc8—a quiet queen retreat to the back rank—remains near zero throughout the network and rises only in the final layer to become the top choice. Right: The value head, trained to predict game outcomes, correctly assesses both resulting positions, indicating that the policy head’s final move selection contradicts the model’s own evaluation of the consequences. At the puzzle position itself, the value head is consistent with the final policy and does not see the win. Full probabilities are in Appendix J, with additional examples in Appendix K.
  • Three-Phase Thinking: Across layers, Leela doesn't just sharpen one idea; it reorganizes its priorities. It progresses from basic piece priors and greedy captures (early layers), through a middle-layer plateau of forcing checks, into a sharp late-layer surge of deep calculation.
  • The Algorithm Works, The Priors Veto: Look-ahead isn't failing on forgotten puzzles—future moves are still represented, linearly decodable, and causally active. Instead, 87.3% of forgotten puzzles require a material sacrifice. Late layers exhibit a strong shift toward conservative "safety priors" (protecting one's own king, mitigating opponent threats)—sensible habits for 99% of chess, which disastrously veto rare, aggressive winning tactics.
  • A Network Failure, Not an Objective Failure: When running the Monte Carlo tree search used to train Leela, the training target puts 93.1% of its weight on the winning sacrifice. The network isn't doing what its training objective wants; rather, broad distributional heuristics outvote exact computation on rare inputs.

Key Results

  • Strength Across Depth: Internal deterministic Elo climbs monotonically from 351 at the input to 2268 at the final layer, accelerating up to 24.8× faster in the final layers on the hardest puzzles compared to middle layers.
Figure 4: Layer-wise puzzle-solving performance across network depth. The hatched region indicates puzzles solved by at least one previous layer but not by the current layer—forgotten solutions.
  • Intact Look-Ahead: On forgotten puzzles, bilinear probes still decode the 3rd future move with up to 79% accuracy (vs. 90% on solved puzzles), and snipping a single scalar in look-ahead head L12H12 hurts the correct move more than ablating all other 4,095 attention entries combined in 61.6% of cases.
  • Steering Recovers Genius: Steering layer 13 activations against mitigating opponent threats boosts general puzzle accuracy from 88.6% to 92.4%, recovering 71.7% of the held-out forgotten dataset (and even solving 34.4% of puzzles the model never solved at any layer).

Limitations and Future Work

  • Missing Circuitry for Priors: While the authors prove safety priors causally override look-ahead, they don't map out the exact mechanistic circuit implementing those priors in the final feed-forward layer.
  • Proxy Concepts & Single Model: Stockfish 8’s one-step evaluation terms are imperfect proxies for Leela's true internal features, and causal experiments were limited to one specific Leela network.
  • Broader AI Implications: Exploring whether similar late-layer heuristic overrides suppress hidden reasoning capabilities in Large Language Models—such as mathematical reasoning or sycophancy—remains a vital open frontier.

Summary updated

Abstract

Recent mechanistic work has uncovered learned algorithms within neural networks, from modular arithmetic to search and planning in game-playing agents. But does algorithmic structure guarantee algorithmic behavior? We investigate this in Leela Chess Zero, the strongest neural chess engine, where prior work identified learned look-ahead. By extending the logit lens to its move-selecting policy network, we discover that correct puzzle solutions—including immediate checkmates—often appear in intermediate layers but are systematically overridden in the final output, a phenomenon we term *forgotten puzzles*. Replicating prior analyses on these positions, we find that look-ahead operates normally—future moves of the correct continuation are represented, causally important, and linearly decodable—ruling out a failure of the algorithm. Instead, late layers increasingly shift toward safe play over aggression. To test whether this shift drives the override, we steer the model against these preferences and recover 71.7% of forgotten puzzles, providing causal evidence that safety priors override algorithmically computed solutions. These findings show that algorithmic structure does not guarantee algorithmic behavior: a model can internally solve a problem and still output the wrong answer.
BibTeX
@inproceedings{sandmann2026algorithm,
  author = {Elias Sandmann and Sebastian Lapuschkin and Wojciech Samek},
  title = {{The Algorithm Is Not the Behavior: Learned Priors Override Look-Ahead in a Chess-Playing Neural Network}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ULhusDnCQy},
}
Figure