Marjon Cajocon

HomeWriting › How NNUE works for checkers

How NNUE works for checkers

· Marjon Cajocon

NNUE — an efficiently-updatable neural network — is the idea that reshaped computer chess. It is worth explaining what it actually is, because the name suggests something more exotic than the reality.

The problem it solves

A game engine searches millions of positions. For each one it needs a number: how good is this? Traditionally that number came from hand-written rules — count the material, add a bonus for a piece on a strong square, subtract for a weak structure. Fast, but it only knows what its author thought to tell it.

A neural network learns those judgements instead. The catch is cost. A network that takes a millisecond to evaluate is useless when you need millions of evaluations per move.

The trick

NNUE's insight is that consecutive positions in a search are almost identical. Moving one piece changes two squares. So instead of recomputing the network from scratch, you keep a running total — the accumulator — and when a piece moves you subtract the contribution of the square it left and add the contribution of the square it arrived on.

That is what "efficiently updatable" means. The expensive first layer is never recomputed, only adjusted. The rest of the network is small enough that evaluating it is cheap.

What changes for draughts

The architecture transfers, but almost nothing else does.

The feature set is smaller. Chess has six piece types on 64 squares for each colour — 768 inputs. Draughts has two piece types, men and kings, and on an 8×8 board only 32 squares are ever occupied. That gives 128 inputs: four planes of 32 squares. International draughts, on 10×10, uses 50 squares per plane and 200 inputs.

Symmetry can be enforced rather than learned. A draughts position seen from the other side should score exactly the opposite. Rather than hope the network learns that, you evaluate the network for the position and for its mirror and take the difference. The result is antisymmetric by construction. A network that has to learn symmetry approximately will always have small inconsistencies; one built this way cannot.

Each variant needs its own net. This is the part that surprises people. Brazilian and English draughts use the same board and the same starting position, but in one kings fly the length of a diagonal and in the other they step one square. That single difference changes what a position is worth so thoroughly that a net trained on one plays badly on the other. Turkish draughts is further still — orthogonal movement across all 64 squares — and shares no feature layout at all.

Training

The engine plays itself at a fixed depth and records each position with the score its search returned. The network is then fit to those scores. It is a distillation: the network learns to guess in one pass what the search took thousands of nodes to work out.

Every candidate is gated. A new net only ships if it beats the current one over a match. That gate matters — it is why not every trained net makes it into a release, and why one variant here still runs on its hand-crafted evaluation.

Why it is rare in draughts

Strong neural draughts engines exist, but they are desktop programs. Putting one on a phone means the whole thing — search, network and weights — has to be small, integer-only and dependency-free. That is the engineering, more than the architecture.

See the apps these engines ship in →

Marjon Cajocon

Software engineer · Talibon, Bohol, Philippines

I build game engines in C and the apps that ship them. Seven board-game engines, six of them running NNUE neural networks I trained myself, plus a from-scratch LLM engine written in dependency-free C.

Developer
MMC Solo Dev — the name my apps ship under on Google Play and the Microsoft Store
Primary
C — engines, evaluation, search, the LLM stack
Then
Go · Flutter (Dart) · Python · TypeScript / JavaScript
Certification
EDP Specialist — Civil Service, rated 94.65% (80% to pass)
Published
Six apps on the Microsoft Store, five on Google Play
Contact
marjoncajocon08@gmail.com
Code
github.com/marjoncajocon