Skip to content
Fabian Fichter edited this page Mar 30, 2022 · 20 revisions

In order to improve playing strength compared to the classical/handcrafted evaluation, NNUE (efficiently updatable neural network) evaluation - if available for the variant - can be used to enhance playing strength. An overview of available NNUE evaluation files for variants can be found in the list of networks in this wiki.

What is NNUE?

NNUE are efficiently updateable neural networks, which were first applied to shogi, then later also applied to official Stockfish. From there it made its way into Fairy-Stockfish. Several generalizations have been applied to the architecture of the neural network so that it can be used for different board sizes, arbitrary piece types, as well as variants with piece drops.

An overview over NNUE in official Stockfish can be found in the chessprogramming wiki.

How is it trained?

For official Stockfish NNUE networks are trained using https://github.com/glinscott/nnue-pytorch. Variant NNUE evaluation files for Fairy-Stockfish are trained using a fork of that code which contains many generalizations for variants with respect to board size, piece types, etc.

Documentation about the data generation and training process is available at https://github.com/ianfab/variant-nnue-pytorch/wiki. Trained networks can be uploaded using a google form and are then available for download here. The list of networks should be updated accordingly after a new strongest network has been uploaded.

How to use it?

In order to use NNUE evaluation for chess variants in Fairy-Stockfish, follow the below steps:

  • Download the NNUE evaluation file you want to use from patreon or google drive. You can look up the current best networks in the list of networks.
  • Download a compatible Fairy-Stockfish release.
    • For HalfKP networks (v1.x) use Fairy-Stockfish 13.1.
    • For HalfKA networks (v2.x) use the latest release, at least Fairy-Stockfish 14.
      • For Half(K)A networks after the architecture generalization (>=v2.5) at least Fairy-Stockfish 14.0.1 is required. This mainly applies to variants without one royal king per side (e.g., antichess, horde) or restrictions to the king (Xiangqi/Janggi).
  • Set the path of the downloaded NNUE file in the EvalFile parameter, either in your GUI or via the command line.
  • When you select a variant for which an NNUE file was defined in the EvalFile, it will start using NNUE automatically. If the GUI you are using supports to print engine debug output (such as cutechess), you can check there whether Fairy-Stockfish prints a message starting like NNUE evaluation using ... enabled to make sure that it correctly detected it.