Skip to content
Fabian Fichter edited this page Jan 6, 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 this spreadsheet.

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 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. This generalized training code currently is private.

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. Also see the above spreadsheet for an overview.
  • 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.
  • 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.