Difference between revisions of "NNUE"

From Chessprogramming wiki
Jump to: navigation, search
(27 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
=[[Stockfish NNUE]]=
 
=[[Stockfish NNUE]]=
 
As reported by [[Henk Drost]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74059 Stockfish NN release (NNUE)] by [[Henk Drost]], [[CCC]], May 31, 2020</ref>,  
 
As reported by [[Henk Drost]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74059 Stockfish NN release (NNUE)] by [[Henk Drost]], [[CCC]], May 31, 2020</ref>,  
[[Hisayori Noda|Nodchip]] incorporated NNUE into the chess playing Stockfish 10 as a proof of concept.
+
[[Hisayori Noda|Nodchip]] incorporated NNUE into the chess playing [[Stockfish]] 10 as a proof of concept.
 
[[Stockfish NNUE]] was born, and in summer 2020 the computer chess community bursts out enthusiastically due to its rapidly raising [[Playing Strength|playing strength]] with different networks trained using a mixture of [[Supervised Learning|supervised]] and [[Reinforcement Learning|reinforcement learning]] methods -
 
[[Stockfish NNUE]] was born, and in summer 2020 the computer chess community bursts out enthusiastically due to its rapidly raising [[Playing Strength|playing strength]] with different networks trained using a mixture of [[Supervised Learning|supervised]] and [[Reinforcement Learning|reinforcement learning]] methods -
despite the approximately halved search speed, becoming stronger than its original <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74484 Can the sardine! NNUE clobbers SF] by [[Henk Drost]], [[CCC]], July 16, 2020</ref>.  
+
despite the approximately halved search speed, becoming stronger than its original <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74484 Can the sardine! NNUE clobbers SF] by [[Henk Drost]], [[CCC]], July 16, 2020</ref>, finally responsible for the huge [[Playing Strength|strength]] improvement of '''Stockfish 12'''.
  
 
=NNUE Engines=
 
=NNUE Engines=
 
''see [[:Category:NNUE]]''
 
''see [[:Category:NNUE]]''
  
Being tempted by the success of [[Stockfish NNUE]] and attracted by how easy the method and small the code is, many engine developers have started testing and applying [[NNUE]]. For quick trials and evaluating before going into serious development, some of them borrowed and/or rewrote NNUE code and use networks from Stockfish NNUE. Most of them reported positive results, such as [[David Carteau]] with [[Orion]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74828 Orion 0.7 : NNUE experiment] by [[David Carteau]], [[CCC]], August 19, 2020</ref>, [[Ehsan Rashid]] with [[DON]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=72613&start=320#p856640 Re: New engine releases 2020...Don NNUE 2020?] by supersharp77, [[CCC]], August 19, 2020</ref>, various [[Stockfish#Derivatives|Stockfish derivatives]] by [[Michael Byrne]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=74825 ... the last shall be first ...] by [[Michael Byrne|MikeB]], [[CCC]], 19 Aug 2020</ref>, and [[Volodymyr Shcherbyna]] with [[Igel]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=67890&start=10#p856742 Introducing Igel chess engine] by [[Volodymyr Shcherbyna]], [[CCC]], 20 Aug 2020</ref> using the ''Night Nurse'' NNUE net by [[Dietrich Kappe]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=74837 Night Nurse 0.2] by [[Dietrich Kappe]], [[CCC]], August 19, 2020</ref>. In October 2020, [[Daniel Shawul]] added NNUE support à la [[CFish]] into his [[Scorpio#Bitbases|egbbdll]] probing library of [[Scorpio]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75400&start=22 Re: Hacking around CFish NNUE] by [[Daniel Shawul]], [[CCC]], October 15, 2020</ref> <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75415&start=3 Re: How to scale stockfish NNUE score?] by [[Daniel Shawul]], [[CCC]], October 17, 2020</ref>.
+
Being tempted by the success of [[Stockfish NNUE]] and attracted by how easy the method and small the code is, many engine developers have started testing and applying [[NNUE]]. For quick trials and evaluating before going into serious development, some of them borrowed and/or rewrote NNUE code and use networks from Stockfish NNUE. Most of them reported positive results, such as [[David Carteau]] with [[Orion]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74828 Orion 0.7 : NNUE experiment] by [[David Carteau]], [[CCC]], August 19, 2020</ref>, [[Ehsan Rashid]] with [[DON]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=72613&start=320#p856640 Re: New engine releases 2020...Don NNUE 2020?] by supersharp77, [[CCC]], August 19, 2020</ref>, various [[Stockfish#Derivatives|Stockfish derivatives]] by [[Michael Byrne]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=74825 ... the last shall be first ...] by [[Michael Byrne|MikeB]], [[CCC]], 19 Aug 2020</ref>, and [[Volodymyr Shcherbyna]] with [[Igel]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=67890&start=10#p856742 Introducing Igel chess engine] by [[Volodymyr Shcherbyna]], [[CCC]], 20 Aug 2020</ref> using the ''Night Nurse'' NNUE net by [[Dietrich Kappe]] <ref>[http://talkchess.com/forum3/viewtopic.php?f=2&t=74837 Night Nurse 0.2] by [[Dietrich Kappe]], [[CCC]], August 19, 2020</ref>. [[Daniel Shawul]] added NNUE support à la [[CFish]] into his [[Scorpio#Bitbases|egbbdll]] probing library of [[Scorpio]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75400&start=22 Re: Hacking around CFish NNUE] by [[Daniel Shawul]], [[CCC]], October 15, 2020</ref> <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75415&start=3 Re: How to scale stockfish NNUE score?] by [[Daniel Shawul]], [[CCC]], October 17, 2020</ref>, making it even easier to use NNUE. The promising engines [[Halogen]] 7 and 8 by [[Kieren Pearson]], and [[Seer]] by [[Connor McMonigle]] came with their own, distinct NNUE implementations, and on November 10, 2020, the commercial [[Dragon by Komodo Chess]] aka [[Komodo]] NNUE appeared <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75748 Dragon by Komodo Chess] by [[Larry Kaufman]], [[CCC]], November 10, 2020</ref>, trying to close the gap to Stockfish NNUE.
  
 
=NN Structure=
 
=NN Structure=
The neural network consists of four layers, W1 through W4. The input layer W1 is heavily overparametrized, feeding in the [[Board Representation|board representation]] for various king configurations.
+
The neural network of Stockfish NNUE consists of four layers, W1 through W4. The input layer W1 is heavily overparametrized, feeding in the [[Board Representation|board representation]] for various king configurations.
 
The efficiency of the net is due to [[Incremental Updates|incremental update]] of W1 in [[Make Move|make]] and [[Unmake Move|unmake move]],
 
The efficiency of the net is due to [[Incremental Updates|incremental update]] of W1 in [[Make Move|make]] and [[Unmake Move|unmake move]],
 
where only a fraction of its neurons need to be recalculated. The remaining three layers with 32x2x256, 32x32 and 32x1 weights are computational less expensive, best calculated using appropriate [[SIMD and SWAR Techniques|SIMD instructions]] like [[AVX2]] on [[x86-64]], or if available, [[AVX-512]].
 
where only a fraction of its neurons need to be recalculated. The remaining three layers with 32x2x256, 32x32 and 32x1 weights are computational less expensive, best calculated using appropriate [[SIMD and SWAR Techniques|SIMD instructions]] like [[AVX2]] on [[x86-64]], or if available, [[AVX-512]].
Line 27: Line 27:
 
[[FILE:NNUE.jpg|none|border|text-bottom]]  
 
[[FILE:NNUE.jpg|none|border|text-bottom]]  
 
NNUE structure with [[Incremental Updates|incremental update]] <ref>Image from [[Yu Nasu]] ('''2018'''). ''&#398;U&#1048;&#1048; Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi''.  Ziosoft Computer Shogi Club, [https://github.com/ynasu87/nnue/blob/master/docs/nnue.pdf pdf] (Japanese with English abstract)</ref>
 
NNUE structure with [[Incremental Updates|incremental update]] <ref>Image from [[Yu Nasu]] ('''2018'''). ''&#398;U&#1048;&#1048; Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi''.  Ziosoft Computer Shogi Club, [https://github.com/ynasu87/nnue/blob/master/docs/nnue.pdf pdf] (Japanese with English abstract)</ref>
 +
 +
=See also=
 +
* [[Cerebrum]]
 +
* [[David E. Moriarty#SANE|SANE]]
  
 
=Publications=
 
=Publications=
* [[Yu Nasu]] ('''2018'''). ''&#398;U&#1048;&#1048; Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi''.  Ziosoft Computer Shogi Club, [https://github.com/ynasu87/nnue/blob/master/docs/nnue.pdf pdf] (Japanese with English abstract)
+
* [[Yu Nasu]] ('''2018'''). ''&#398;U&#1048;&#1048; Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi''.  Ziosoft Computer Shogi Club, [https://github.com/ynasu87/nnue/blob/master/docs/nnue.pdf pdf], [https://www.apply.computer-shogi.org/wcsc28/appeal/the_end_of_genesis_T.N.K.evolution_turbo_type_D/nnue.pdf pdf] (Japanese with English abstract) [https://github.com/asdfjkl/nnue GitHub - asdfjkl/nnue translation] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=76250 Translation of Yu Nasu's NNUE paper] by [[Dominik Klein]], [[CCC]], January 07, 2021</ref>
  
 
=Forum Posts=
 
=Forum Posts=
Line 37: Line 41:
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74058 Stockfish NNUE] by [[Henk Drost]], [[CCC]], May 31, 2020 » [[Stockfish]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74058 Stockfish NNUE] by [[Henk Drost]], [[CCC]], May 31, 2020 » [[Stockfish]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74059 Stockfish NN release (NNUE)] by [[Henk Drost]], [[CCC]], May 31, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74059 Stockfish NN release (NNUE)] by [[Henk Drost]], [[CCC]], May 31, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74148 NNUE shared library and tools] by [[Adam Treat]], [[CCC]], June 10, 2020
 
===July===
 
===July===
 +
* [http://talkchess.com/forum3/viewtopic.php?t=74480 Lizard-NNUE Experiment NOT bad with NNUE Net Evaluation...] by Nancy M Pichardo, [[CCC]], July 15, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74484 Can the sardine! NNUE clobbers SF] by [[Henk Drost]], [[CCC]], July 16, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=74484 Can the sardine! NNUE clobbers SF] by [[Henk Drost]], [[CCC]], July 16, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74531 NNUE accessible explanation] by [[Martin Fierz]], [[CCC]], July 21, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74531 NNUE accessible explanation] by [[Martin Fierz]], [[CCC]], July 21, 2020
Line 57: Line 63:
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74955 Train a neural network evaluation] by [[Fabio Gobbato]], [[CCC]], September 01, 2020 » [[Automated Tuning]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74955 Train a neural network evaluation] by [[Fabio Gobbato]], [[CCC]], September 01, 2020 » [[Automated Tuning]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75016 RubiChess NNUE player implemented] by [[Andreas Matthies]], [[CCC]], September 06, 2020 » [[RubiChess]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75016 RubiChess NNUE player implemented] by [[Andreas Matthies]], [[CCC]], September 06, 2020 » [[RubiChess]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75027 Toga III 0.4 NNUE] by [[Dietrich Kappe]], [[CCC]], September 07, 2020 » [[Toga]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75042 Neural network quantization] by [[Fabio Gobbato]], [[CCC]], September 08, 2020 » [[Neural Networks]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75042 Neural network quantization] by [[Fabio Gobbato]], [[CCC]], September 08, 2020 » [[Neural Networks]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75049 AVX-512 and NNUE] by [[Gian-Carlo Pascutto]], [[CCC]], September 08, 2020 » [[AVX-512]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75049 AVX-512 and NNUE] by [[Gian-Carlo Pascutto]], [[CCC]], September 08, 2020 » [[AVX-512]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75190 First success with neural nets] by [[Jonathan Kreuzer]], [[CCC]], September 23, 2020 » [[Neural Networks]]
 +
: [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75190&start=21 Re: First success with neural nets] by [[Jonathan Kreuzer]], [[CCC]], November 11, 2020 » [[Checkers]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75241 Nemorino 6 (NNUE)] by [[Christian Günther|Florentino]], [[CCC]], September 28, 2020 » [[Nemorino]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75241 Nemorino 6 (NNUE)] by [[Christian Günther|Florentino]], [[CCC]], September 28, 2020 » [[Nemorino]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75247 A Crossroad in Computer Chess; Or Desperate Flailing for Relevance] by [[Andrew Grant]], [[CCC]], September 29, 2020
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75247 A Crossroad in Computer Chess; Or Desperate Flailing for Relevance] by [[Andrew Grant]], [[CCC]], September 29, 2020
Line 82: Line 91:
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75651 Komodo 14.1 Release and Dragon Announcement] by [[Larry Kaufman]], [[CCC]], November 02, 2020 » [[Komodo]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75651 Komodo 14.1 Release and Dragon Announcement] by [[Larry Kaufman]], [[CCC]], November 02, 2020 » [[Komodo]]
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75653 NNUE outer product vs tensor product] by Madeleine Birchfield, [[CCC]], November 02, 2020 <ref>[https://en.wikipedia.org/wiki/Outer_product Outer product from Wikipedia]</ref> <ref>[https://en.wikipedia.org/wiki/Tensor_product Tensor product from Wikipedia]</ref>
 
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75653 NNUE outer product vs tensor product] by Madeleine Birchfield, [[CCC]], November 02, 2020 <ref>[https://en.wikipedia.org/wiki/Outer_product Outer product from Wikipedia]</ref> <ref>[https://en.wikipedia.org/wiki/Tensor_product Tensor product from Wikipedia]</ref>
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75724 Pytorch NNUE training] by [[Gary Linscott]], [[CCC]], November 08, 2020 <ref>[https://en.wikipedia.org/wiki/PyTorch PyTorch from Wikipedia]</ref>
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75725 TucaNNo: neural network research] by [[Alcides Schulz]], [[CCC]], November 08, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75748 Dragon by Komodo Chess] by [[Larry Kaufman]], [[CCC]], November 10, 2020 » [[Dragon by Komodo Chess]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75751 Tensorflow NNUE training] by [[Daniel Shawul]], [[CCC]], November 10, 2020 <ref>[https://en.wikipedia.org/wiki/TensorFlow TensorFlow from Wikipedia]</ref>
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75890 Speculations about NNUE development (was New engine releases 2020)] by Madeleine Birchfield, [[CCC]], November 11, 2020
 +
: [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75890&start=6 Re: Speculations about NNUE development (was New engine releases 2020)] by [[Connor McMonigle]], [[CCC]], November 12, 2020
 +
: [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75890&start=9 Re: Speculations about NNUE development (was New engine releases 2020)] by [[Connor McMonigle]], [[CCC]], November 12, 2020 » [[Dragon by Komodo Chess]], [[Seer]], [[Halogen]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75335&start=134 Re: Final Release of Ethereal, V12.75] by [[Andrew Grant]], [[CCC]], November 12, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75797 Maybe not the best diversity of strongest chess engines under development] by [[Kai Laskos]], [[CCC]], November 14, 2020 » [[Engine Similarity]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75862 CPU Vector Unit, the new jam for NNs...] by [[Srdja Matovic]], [[CCC]], November 18, 2020 » [[SIMD and SWAR Techniques|SIMD]]
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75870 You've trained a brilliant NN(UE) King-Piece Network. Now what?] by [[Andrew Grant]], [[CCC]], November 19, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75925 Pawn King Neural Network] by [[Tamás Kuzmics]], [[CCC]], November 26, 2020
 +
===December===
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75953 Orion 0.8 + The Cerebrum release] by [[David Carteau]], [[CCC]], December 01, 2020 » [[Orion]], [[Cerebrum]]
 +
* [https://prodeo.actieforum.com/t104-the-nnue-split-programmers-are-in The NNUE split programmers are in] by [[Ed Schroder|Ed Schröder]], [[Computer Chess Forums|ProDeo Forum]], December 02, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=76006 Introducing the "Cerebrum" library (NNUE-like trainer and inference code)] by [[David Carteau]], [[CCC]], December 07, 2020
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=76190 Dispelling the Myth of NNUE with LazySMP: An Analysis] by [[Andrew Grant]], [[CCC]], December 30, 2020 » [[Lazy SMP]]
 +
==2021==
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=76250 Translation of Yu Nasu's NNUE paper] by [[Dominik Klein]], [[CCC]], January 07, 2021
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75724&start=60 Re: Pytorch NNUE training] by [[Gary Linscott]], [[CCC]], January 09, 2021
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=76285 HalfKP Structure in NNUE] by Roger Stephenson, [[CCC]], January 12, 2021
  
 
=External Links=
 
=External Links=
 
==NNUE==
 
==NNUE==
 
* [https://en.wikipedia.org/wiki/Efficiently_updatable_neural_network Efficiently updatable neural network | Wikipedia]
 
* [https://en.wikipedia.org/wiki/Efficiently_updatable_neural_network Efficiently updatable neural network | Wikipedia]
* [https://github.com/yaneurao/YaneuraOu GitHub - yaneurao/YaneuraOu: YaneuraOu is the World's Strongest Shogi engine(AI player), WCSC29 1st winner, educational and USI compliant engine]
 
* [https://github.com/Tama4649/Kristallweizen/ GitHub - Tama4649/Kristallweizen: 第29回世界コンピュータ将棋選手権 準優勝のKristallweizenです。]
 
 
* [http://qhapaq.hatenablog.com/entry/2018/06/02/221612 次世代の将棋思考エンジン、NNUE関数を学ぼう(その1.ネットワーク構造編) - コンピュータ将棋 Qhapaq], June 02, 2018 (Japanese)
 
* [http://qhapaq.hatenablog.com/entry/2018/06/02/221612 次世代の将棋思考エンジン、NNUE関数を学ぼう(その1.ネットワーク構造編) - コンピュータ将棋 Qhapaq], June 02, 2018 (Japanese)
 
: Learn Next Generation Shogi Thinking Engine, NNUE Function (Part 1. Network Structure) - Computer Shogi
 
: Learn Next Generation Shogi Thinking Engine, NNUE Function (Part 1. Network Structure) - Computer Shogi
Line 94: Line 122:
 
* [http://yaneuraou.yaneu.com/2020/06/19/stockfish-nnue-the-complete-guide/ Stockfish NNUE – The Complete Guide], June 19, 2020 (Japanese and English)
 
* [http://yaneuraou.yaneu.com/2020/06/19/stockfish-nnue-the-complete-guide/ Stockfish NNUE – The Complete Guide], June 19, 2020 (Japanese and English)
 
* [http://yaneuraou.yaneu.com/2020/08/21/3-technologies-in-shogi-ai-that-could-be-used-for-chess-ai/ 3 technologies in shogi AI that could be used for chess AI] by [[Motohiro Isozaki]], August 21, 2020 » [[Stockfish NNUE]]
 
* [http://yaneuraou.yaneu.com/2020/08/21/3-technologies-in-shogi-ai-that-could-be-used-for-chess-ai/ 3 technologies in shogi AI that could be used for chess AI] by [[Motohiro Isozaki]], August 21, 2020 » [[Stockfish NNUE]]
 +
* [https://www.qhapaq.org/shogi/shogiwiki/stockfish-nnue/ Stockfish NNUE Wiki]
 +
==Source Code==
 +
* [https://github.com/yaneurao/YaneuraOu GitHub - yaneurao/YaneuraOu: YaneuraOu is the World's Strongest Shogi engine(AI player), WCSC29 1st winner, educational and USI compliant engine]
 +
* [https://github.com/Tama4649/Kristallweizen/ GitHub - Tama4649/Kristallweizen: 第29回世界コンピュータ将棋選手権 準優勝のKristallweizenです。]
 
* [https://github.com/nodchip/Stockfish GitHub - nodchip/Stockfish: UCI chess engine] ([[Stockfish NNUE]] by [[Hisayori Noda|Nodchip]])
 
* [https://github.com/nodchip/Stockfish GitHub - nodchip/Stockfish: UCI chess engine] ([[Stockfish NNUE]] by [[Hisayori Noda|Nodchip]])
* [https://www.qhapaq.org/shogi/shogiwiki/stockfish-nnue/ Stockfish NNUE Wiki]
+
* [https://github.com/dkappe/leela-chess-weights/wiki/A-Leela-NNUE%3F-Night-Nurse-and-Others A Leela NNUE? Night Nurse and Others · dkappe/leela-chess-weights Wiki · GitHub] by [[Dietrich Kappe]]
 +
* [https://github.com/david-carteau/cerebrum GitHub - david-carteau/cerebrum: The Cerebrum library] by [[David Carteau]] » [[Cerebrum]]
 +
* [https://github.com/DanielUranga/TensorFlowNNUE GitHub - DanielUranga/TensorFlowNNUE] by [[Daniel Uranga]]
 +
* [https://github.com/glinscott/nnue-pytorch GitHub - glinscott/nnue-pytorch: NNUE (Chess evaluation) trainer in Pytorch] by [[Gary Linscott]]
 +
* [https://github.com/connormcmonigle/seer-nnue GitHub - connormcmonigle/seer-nnue: UCI chess engine using neural networks for position evaluation] by [[Connor McMonigle]] » [[Seer]]
 +
* [https://github.com/bmdanielsson/nnue-trainer GitHub - bmdanielsson/nnue-trainer: PyTorch trainer for NNUE style neural networks] by [[Martin Danielsson]] » [[Marvin]]
 
==Misc==
 
==Misc==
 
* [https://en.wikipedia.org/wiki/Nue Nue from Wikipedia]
 
* [https://en.wikipedia.org/wiki/Nue Nue from Wikipedia]

Revision as of 23:40, 12 January 2021

Home * Learning * Neural Networks * NNUE

Toriyama Sekien - Nue (鵺) [1] [2]

NNUE, (ƎUИИ Efficiently Updatable Neural Networks)
a Neural Network architecture intended to replace the evaluation of Shogi, chess and other board game playing alpha-beta searchers running on a CPU. NNUE was introduced in 2018 by Yu Nasu [3], and was used in Shogi adaptations of Stockfish such as YaneuraOu [4], and Kristallweizen [5], apparently with AlphaZero strength [6].

Stockfish NNUE

As reported by Henk Drost [7], Nodchip incorporated NNUE into the chess playing Stockfish 10 as a proof of concept. Stockfish NNUE was born, and in summer 2020 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, becoming stronger than its original [8], finally responsible for the huge strength improvement of Stockfish 12.

NNUE Engines

see Category:NNUE

Being tempted by the success of Stockfish NNUE and attracted by how easy the method and small the code is, many engine developers have started testing and applying NNUE. For quick trials and evaluating before going into serious development, some of them borrowed and/or rewrote NNUE code and use networks from Stockfish NNUE. Most of them reported positive results, such as David Carteau with Orion [9], Ehsan Rashid with DON [10], various Stockfish derivatives by Michael Byrne [11], and Volodymyr Shcherbyna with Igel [12] using the Night Nurse NNUE net by Dietrich Kappe [13]. Daniel Shawul added NNUE support à la CFish into his egbbdll probing library of Scorpio [14] [15], making it even easier to use NNUE. The promising engines Halogen 7 and 8 by Kieren Pearson, and Seer by Connor McMonigle came with their own, distinct NNUE implementations, and on November 10, 2020, the commercial Dragon by Komodo Chess aka Komodo NNUE appeared [16], trying to close the gap to Stockfish NNUE.

NN Structure

The neural network of Stockfish NNUE consists of four layers, W1 through W4. The input layer W1 is heavily overparametrized, feeding in the board representation for various king configurations. The efficiency of the net is due to incremental update of W1 in make and unmake move, where only a fraction of its neurons need to be recalculated. The remaining three layers with 32x2x256, 32x32 and 32x1 weights are computational less expensive, best calculated using appropriate SIMD instructions like AVX2 on x86-64, or if available, AVX-512.

NNUE.jpg

NNUE structure with incremental update [17]

See also

Publications

Forum Posts

2020 ...

Re: The Stockfish of shogi by Gian-Carlo Pascutto, CCC, January 18, 2020

July

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

August

September

Re: First success with neural nets by Jonathan Kreuzer, CCC, November 11, 2020 » Checkers

October

Re: Hacking around CFish NNUE by Daniel Shawul, CCC, October 15, 2020 » Scorpio
Re: How to scale stockfish NNUE score? by Daniel Shawul, CCC, October 17, 2020

November

Re: Speculations about NNUE development (was New engine releases 2020) by Connor McMonigle, CCC, November 12, 2020
Re: Speculations about NNUE development (was New engine releases 2020) by Connor McMonigle, CCC, November 12, 2020 » Dragon by Komodo Chess, Seer, Halogen

December

2021

External Links

NNUE

Learn Next Generation Shogi Thinking Engine, NNUE Function (Part 1. Network Structure) - Computer Shogi
Let's Learn Next Generation Shogi Thinking Engine, NNUE Function (Part 2. Remodeling/Learning) - Computer Shogi

Source Code

Misc

References

  1. Nue (鵺) from the Konjaku Gazu Zoku Hyakki (今昔画図続百鬼) by Toriyama Sekien, circa 1779, Wikimedia Commons
  2. Re: What does NNUE actually mean by Henk Drost, CCC, July 29, 2020
  3. Yu Nasu (2018). ƎUИИ Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi. Ziosoft Computer Shogi Club, pdf (Japanese with English abstract)
  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. The Stockfish of shogi by Larry Kaufman, CCC, January 07, 2020
  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. Orion 0.7 : NNUE experiment by David Carteau, CCC, August 19, 2020
  10. Re: New engine releases 2020...Don NNUE 2020? by supersharp77, CCC, August 19, 2020
  11. ... the last shall be first ... by MikeB, CCC, 19 Aug 2020
  12. Introducing Igel chess engine by Volodymyr Shcherbyna, CCC, 20 Aug 2020
  13. Night Nurse 0.2 by Dietrich Kappe, CCC, August 19, 2020
  14. Re: Hacking around CFish NNUE by Daniel Shawul, CCC, October 15, 2020
  15. Re: How to scale stockfish NNUE score? by Daniel Shawul, CCC, October 17, 2020
  16. Dragon by Komodo Chess by Larry Kaufman, CCC, November 10, 2020
  17. Image from Yu Nasu (2018). ƎUИИ Efficiently Updatable Neural-Network based Evaluation Functions for Computer Shogi. Ziosoft Computer Shogi Club, pdf (Japanese with English abstract)
  18. Translation of Yu Nasu's NNUE paper by Dominik Klein, CCC, January 07, 2021
  19. Outer product from Wikipedia
  20. Tensor product from Wikipedia
  21. PyTorch from Wikipedia
  22. TensorFlow from Wikipedia

Up one Level