r/MachineLearning • u/jackyuanybt • 8h ago
Research Mechanistic interpretability as a capability test: reading Stockfish 19's net to build a +40 Elo classical chess engine [R]
https://x.com/jackyuan35/status/2128994871952462199
Interpretability work is rarely measured in capability. We tried a concrete test: can structures found inside a superhuman network be compiled into readable code that measurably improves a non-neural system?
Setup: Stockfish 19's NNUE as the subject; Stockfish 16's classical (hand-written) evaluation as the target. AI agents decomposed the net's weights to find structures the classical eval lacks, then we wrote those structures back into the classical engine and fitted their values to SF19's evaluations. No net at play time.
What the decompositions surfaced:
- King-wing asymmetry: the net values the same piece/move differently on the wing its king castled on; the classical eval treats both wings as mirror images.
- Non-linear game phase across the net's material-specific output layers, vs the classical linear middlegame/endgame blend.
- Pawn-pair structure.
We also traced single positions (e.g. an uncastled king facing a queen on h4) and confirmed causally that a handful of hidden neurons carry most of the learned "king danger" signal.
Results vs untouched SF16 classical (NNUE off), pre-registered, fresh openings: +39.8 Elo [+33.4, +46.2] over 4,000 games at 10+0.1; +31.4 at 60+0.6; independent replication +35.0. ~6,900 table values total.
Controls/negatives that I think matter for the interpretability question:
- Plainly refitting the existing classical tables to SF19's evals gives ~0 Elo, so the gain comes from the new structures, not the fitting.
- Turning the findings into short human-readable rule lists (1–30 rules) made the engine worse; it took hundreds of rules to keep half the gain.
- Several internally "real" features (threat circuits) didn't transfer, because search already covers tactics.
Open question for discussion: when interpretability finds a structure the net clearly uses, what predicts whether it transfers to a simpler system? Here, static positional structure transferred and dynamic/tactical structure didn't.
Code + all games: github.com/JackYBT/whitebox
Write-up: bitianyuan.com/writing/whitebox
1
u/Lengador 1h ago
It would be interesting to do an ablation of the neurons which were found to make the engine weaker when ported, to see what affect removing them has on the NNUE Stockfish 19 performance. The description that "knowledge about the static shape of a position transfers. Knowledge about dynamic and tactical situations does not, because classical search already handles those" doesn't feel justified, as both versions of Stockfish do search. Search has changed, but the NNUE only does position evaluation. There's no clear way to tell if the neurons were misinterpreted or poorly ported, or if they actually have a negative effect in Stockfish 16. And if they actually do have a negative impact, why do they not in Sotckfish 19? Is the search biased by the position estimators strength to not explore some branches? It seems odd that there is no comparison with the same engine and only NNUE/classical position evaluation swapped out. It would also be informative to see which positions result in the largest difference in evaluation, and then explaining that. Especially if position evaluation differs more after porting the NNUE activations to the classical evaluator, which would indicate the grafter has a bias and may not have reproduced the network's decisions accurately. The game strength is one measure, another measure is to simply compare evaluation vs a much larger search horizon as an oracle to see how much closer the engine gets to the "true" value after the grafting, and possibly the number of search steps vs the accuracy. By evaluating against Stockfish 16 explicitly, the experiment is biased to focus on what makes the position evaluation better against Stockfish 16, rather than better at correctly predicting the the evaluation of a position.