Approaches
Classical vs NNUE
Sum explicit terms: material, piece-square tables (PST), pawn structure, mobility, king safety. Weights tuned by humans or automated tuning (Texel tuning).
Sparse neural net on piece features → hidden layer → output cp. Incrementally updated when pieces move. Trained on millions of positions. Stockfish default since 2020.
Classical stack
What Gets Summed?
Tapered eval
Middlegame vs Endgame Blend
Game phase interpolates MG and EG PST values
Knights worth more in closed middlegames; rooks worth more when files open. Phase = f(non-pawn material) — fewer pieces → lower phase → more endgame weights.
Components
Key Eval Terms
Base piece values plus per-square bonuses from lookup tables (separate MG/EG arrays). A knight on e5 scores higher than on a1.
Doubled, isolated, backward, passed pawns — each has a penalty or bonus. Passed pawns especially ramp up toward promotion.
Count legal moves or attacked squares per piece type. More active pieces → higher score. Cheap bitboard-based approximation.
Feature = (piece type, square, king bucket). Accumulator updated incrementally on make/unmake. Single forward pass → cp. Replaces most hand terms in Stockfish.
| Term | Classical | NNUE |
|---|---|---|
| Material | Explicit sum | Learned implicitly |
| Piece placement | PST tables | Feature weights |
| King safety | Pawn shield, attack units | Learned from data |
| Update cost | O(pieces) sum | O(1) accumulator delta |
Build order for a hobby engine
- Start with material only — verify search plays legal chess
- Add MG/EG PSTs and tapered phase — immediate strength jump
- Add pawn terms and mobility when basics work
- Consider NNUE only after move gen + search + TT are solid
- Eval is called millions of times — keep it fast
Eval feeds search
Leaf scores drive alpha-beta, quiescence stand pat, and futility pruning.
Related: Search Algorithm · Quiescence Search · All Blogs