Stockfish NNUE

From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * Stockfish * NNUE

Stockfish NNUE Logo [1]

Stockfish NNUE,
a Stockfish branch by Hisayori Noda aka Nodchip, which uses Efficiently Updatable Neural Networks - stylized as ƎUИИ or reversed as NNUE - to replace its standard evaluation. NNUE, introduced in 2018 by Yu Nasu [2], were previously successfully applied in Shogi evaluation functions embedded in a Stockfish based search [3], such as YaneuraOu [4], and Kristallweizen [5]. In 2019, Nodchip incorporated NNUE into Stockfish 10 - as a proof of concept, and with the intention to give something back to the Stockfish community [6]. After support and announcements by Henk Drost in May 2020 [7] and subsequent enhancements, Stockfish NNUE was established and recognized. In summer 2020, with more people involved in testing and training, the computer chess community bursts out enthusiastically due to its rapidly raising playing strength with different networks trained using a mixture of supervised and reinforcement learning methods. Despite the approximately halved search speed, Stockfish NNUE seemingly became stronger than its original [8]. In July 2020, the playing code of NNUE is put into the official Stockfish repository as a branch for further development and examination. In August that playing code has been merged to the master branch and becomes an official part of the engine. However, the training code still remains in Nodchip's repository [9] [10].

NNUE Structure

The neural network consists of four layers. The input layer is heavily overparametrized, feeding in the board representation for all king placements per side. The efficiency of NNUE is due to incremental update of the input layer outputs in make and unmake move, where only a tiny fraction of its neurons need to be considered [11]. The remaining three layers with 256x2x32-32x32-32x1 neurons are computational less expensive, best calculated using appropriate SIMD instructions performing fast 16-bit integer arithmetic, like SSE2 or AVX2 on x86-64, or if available, AVX-512.


NNUE layers in action [12]


All networks are built by some volunteers but not by any big community (differs from Leela Chess Zero) nor Fishtest one. They can upload their networks into Fishtest for testing. Those networks will be released officially if they are good enough.


In August 2020 a new patch changed Stockfish NNUE into a hybrid engine: it uses NNUE evaluation only on quite balanced material positions, otherwise uses the traditional one [13].

Strong Points

  • Reuses and gets benefits from the very optimized search function of Stockfish as well as almost all Stockfish's code
  • Runs with CPU only, and doesn't require expensive video cards, as well the need for installing drivers and specific libraries. Thus it is much easier to install (compared to engines using deep convolutional neural networks, such as Leela Chess Zero) and suitable for almost all modern computers. Using a GPU is even not practical for that small net - latency and bandwidth from/to a then underemployed GPU are not sufficient for the intended NPS range [14]
  • Requires much smaller training sets. Some high score networks can be built with the effort of one or a few people within a few days. It doesn't require the massive computing from a supercomputer and/or from community

See also

Forum Posts

2020 ...

January ...


Re: NNUE accessible explanation by Jonathan Rosenthal, CCC, July 23, 2020
Re: NNUE accessible explanation by Jonathan Rosenthal, CCC, July 24, 2020
Re: NNUE accessible explanation by Jonathan Rosenthal, CCC, August 03, 2020


Re: this will be the merge of a lifetime : SF 80 Elo+ by Henk Drost, CCC, August 04, 2020

External Links





Rating Lists



  1. Stockfish NNUE Logo from GitHub - nodchip/Stockfish: UCI chess engine by Nodchip
  2. Yu Nasu (2018). ƎUИИ Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi. Ziosoft Computer Shogi Club, pdf (Japanese with English abstract)
  3. The Stockfish of shogi by Larry Kaufman, CCC, January 07, 2020
  4. GitHub - yaneurao/YaneuraOu: YaneuraOu is the World's Strongest Shogi engine(AI player), WCSC29 1st winner, educational and USI compliant engine
  5. GitHub - Tama4649/Kristallweizen: 第29回世界コンピュータ将棋選手権 準優勝のKristallweizenです。
  6. Stockfish NNUE – The Complete Guide, June 19, 2020 (Japanese and English)
  7. Stockfish NN release (NNUE) by Henk Drost, CCC, May 31, 2020
  8. Can the sardine! NNUE clobbers SF by Henk Drost, CCC, July 16, 2020
  9. NNUE merge · Issue #2823 · official-stockfish/Stockfish · GitHub by Joost VandeVondele, July 25, 2020
  10. GitHub - nodchip/Stockfish: UCI chess engine by Nodchip
  11. Re: NNUE accessible explanation by Jonathan Rosenthal, CCC, July 23, 2020
  12. Image courtesy Roman Zhukov, revised version of the image posted in Re: Stockfish NN release (NNUE) by Roman Zhukov, CCC, June 17, 2020
  13. NNUE evaluation threshold, GitHub, August 06, 2020
  14. stockfish with graphics card by h1a8, CCC, August 06, 2020
  15. An info by Sylwy, CCC, July 25, 2020
  16. You can now look inside NNUE and look at its Per square value estimation by Henk Drost, CCC, August 04, 2020

Up one Level