Michael Paycer — SQL Server DBA and lifelong computer-chess tinkerer
Computer Chess · NNUE

How Neural Nets Took Over Evaluation

For fifty years, a chess engine judged a position with a formula a human wrote. Then in a few short years that formula was replaced by a trained neural network — and, remarkably, it happened without a GPU, running on the same plain CPU that ran the old code. The trick that made it possible is one a DBA will recognize instantly: don't recompute what barely changed. This is NNUE.

Computer Chess Cluster
This is the NNUE page — part of Computer Chess, from a DBA's Chair. Companion reading: Search vs. Evaluation (the classical eval this replaced) · How Engines Were Built · Glossary.
The Shock

Why evaluation went neural

In 2017, DeepMind's AlphaZero taught itself chess from nothing but the rules, playing millions of games against itself, and beat Stockfish 8 convincingly. It didn't search more — it searched far less, examining tens of thousands of positions per second where Stockfish examined tens of millions. What it had instead was a neural network that judged positions better than decades of accumulated human chess knowledge. That was the shock: the evaluation function, the part everyone assumed needed human expertise, was the part a network did best.

AlphaZero used a deep network with a Monte Carlo tree search (MCTS) guided by two heads — a policy head suggesting which moves to explore, a value head estimating who's winning. The open-source world rebuilt it as Leela Chess Zero. But AlphaZero and Leela ran their big networks on GPUs. The question that produced NNUE was: could you get most of that evaluation quality on a normal CPU, inside a classical alpha-beta search?

The Import

NNUE — a neural eval that rides a classical search

NNUE ("Efficiently Updatable Neural Network," pronounced "n-new") came not from chess but from computer shogi, where Yu Nasu introduced it in 2018. The idea: a small network, small enough to run fast on a CPU, used purely for evaluation, bolted onto the fast classical search chess engines already had. Stockfish adopted it in 2020 — it landed in the repository in August 2020, worth about +90 Elo in Fishtest testing, and shipped in Stockfish 12. The result is the modern hybrid: classical alpha-beta search + trained neural evaluation. The search half barely changed; the evaluation half was replaced wholesale.

Inside the Net

The feature transformer and the accumulator

NNUE's first and biggest layer is the feature transformer. Its input is enormous but sparse: tens of thousands of possible features describing piece placements, of which only around thirty are active in any given position. The transformer maps those sparse inputs into a dense vector of numbers called the accumulator — one per side. That's where most of the network's chess knowledge lives. The later layers are tiny by comparison, taking the accumulator and producing a single centipawn score.

sparsefeatures~30 active featuretransformerthe big layer accumulatorkept incrementally small layers→ score (cp)

Most of the cost — and most of the knowledge — sits in the feature transformer. Keeping its output, the accumulator, cheap to update is the whole game.

The Page Star

The incremental-update trick

Here's why NNUE is fast enough to call millions of times per second inside a search. When the engine makes a move, almost nothing about the position changes — a piece leaves one square and arrives on another. So instead of recomputing the whole feature transformer from scratch, NNUE adds and subtracts only the handful of features that actually changed from the accumulator. Make a move: subtract the "piece on old square" features, add the "piece on new square" features. Take the move back during search: undo the same way. The expensive first layer is almost never fully recomputed.

The one exception

Because the features are defined relative to the king's square (that's the "K" in HalfKA), a king move changes the frame of reference for every piece at once — so a king move forces a full accumulator refresh. It's the one move that can't be done incrementally, and engines optimize around it specifically.

The DBA bridge · the one that matters here

This is a maintained running aggregate versus a full re-scan. Rather than re-aggregate the whole table every time one row changes, you keep a running total and apply just the delta: add the new row's contribution, subtract the old one's. An indexed view or a materialized aggregate that updates incrementally on write is exactly this pattern — and the king-move full refresh is the case where the delta is too tangled to maintain, so you rebuild. NNUE is incremental view maintenance applied to a neural network, and it's the reason a net runs at classical-search speed.

The Features, and 2026

HalfKA to Threat Inputs

The feature sets have names: HalfKA and its successors encode each piece's location relative to its own king ("Half" = one perspective per side, "K" = king-relative, later "hm" = horizontal mirroring to halve the size). The newest step shipped in Stockfish 18 (January 2026): Threat Inputs in the SFNNv10 network, features that encode which squares are attacked and defended, so the static evaluation directly "sees" hanging pieces and simple tactics instead of relying on the search to find them. The Stockfish 18 release that introduced them gained about +46 Elo over Stockfish 17 (Threat Inputs headlined the network change, alongside search refinements). Stockfish also trains its network partly on evaluation data labeled by Leela — a quiet cross-pollination between the two rival families.

Why It Fits on a CPU

Quantization

The last piece is quantization: NNUE stores and runs the network in small integers (int8/int16) rather than floating-point, with cheap integer-friendly activation functions (clipped ReLU). Integer arithmetic is exactly what ordinary CPUs are fast at, so the whole network flies without a GPU. That's the design philosophy in one word — every choice in NNUE, from the sparse features to the incremental update to the integer math, is bent toward running a neural evaluation at the speed a classical search demands.

The DBA bridge

Quantization is picking the narrowest datatype that preserves correctness — the same instinct as choosing tinyint over int, or a compact fixed-point over a float, because the smaller type packs more into cache and processes faster. NNUE is a study in fitting the data type to the hardware, which is half of physical database design.

Sources & Further Reading
  • Chessprogramming Wiki — NNUE, Stockfish NNUE, AlphaZero, Leela Chess Zero.
  • Stockfish NNUE announcement (August 2020, ~+90 Elo, shipped in SF12) — stockfishchess.org.
  • Stockfish 18 (January 2026), SFNNv10 with Threat Inputs; the release gained ~+46 Elo over Stockfish 17 — stockfishchess.org.
  • Yu Nasu, "NNUE" (computer shogi, 2018) — the original efficiently-updatable network.
  • DeepMind AlphaZero paper (Science, 2018).
Keep Exploring the Cluster

The search this net rides on — and the arc that got us here

NNUE replaced the evaluation half; the search half is a separate, older story. And the whole shift is one step in how engines were built.

Search vs. Evaluation →  ·  How Engines Were Built →  ·  Back to the Hub →