Skip to content

Stockfish FAQ

dav1312 edited this page Dec 11, 2022 · 21 revisions

Interpretation of the Stockfish evaluation.

The evaluation of a position that results from search has traditionally been measured in pawns or centipawns (1 pawn = 100 centipawns). A value of 1, implied a 1 pawn advantage. However, with engines being so strong, and the NNUE evaluation being much less tied to material value, a new scheme was needed. The new normalized evaluation is now linked to the probability of winning, with a 1.0 pawn advantage being a 0.5 (that is 50%) win probability. An evaluation of 0.0 means equal chances for a win or a loss, but also nearly 100% chance of a draw.

Some GUIs will be able to show the win/draw/loss probabilities directly, when the UCI_ShowWDL engine option is set to True.

The full plots of win, loss and draw probability are given below. From these probabilities, one can also obtain the expected match score.

Probabilities Expected match score

The probability of winning or drawing a game, of course, depends on the opponent and the time control. With bullet games, the draw rate will lower, and against a weak opponent, even a negative score could result in a win. These graphs have been generated from a model derived from Fishtest data for Stockfish playing against Stockfish (so an equally strong opponent), at 60+0.6s per game. The curves are expected to evolve, i.e. as the engines get stronger, an evaluation of 0.0 will approach the 100% draw limit. These curves are for SF15.1 (Dec 2022).


Optimal settings

To get the best possible evaluation or the strongest move for a given position, the key is to let Stockfish analyze long enough, using a recent release (or development version), properly selected for the CPU architecture.

The following settings are important as well:

Threads

tl;dr: Maximum - 1 or 2 threads.

Set the number of threads to the maximum available, possibly leaving 1 or 2 threads free for other tasks. SMT or Hyper-threading is beneficial, so normally the number of threads available is twice the number of cores available. Consumer hardware typically has at least 4-8 threads, Stockfish supports hundreds of threads.

Hash

tl;dr: Maximum - 1 or 2GiB RAM.

Set the hash to nearly the maximum amount of memory (RAM) available, leaving some memory free for other tasks. The Hash can be any value, not just powers of two. The value is specified in MiB, and typical consumer hardware will have GiB of RAM. For a system with 8GiB of RAM one could use 6000 as a reasonable value for the Hash.

MultiPV

tl;dr: 1.

A higher value weakens the quality of the best move computed, as resources are used to compute other moves.


Stockfish crashed

Stockfish may crash if fed incorrect fens, or fens with illegal positions. Full validation code is complex to write, and there is no established mechanism to communicate such an error back to the GUI.

On the other hand, the GUI must carefully check fens. If you find a GUI through which you can crash Stockfish or any other engine, then by all means report it to that GUI's developers.


Contribute to Stockfish

New commits to stockfish can mostly be categorised in 2 categories:

  • Non functional changes
  • Functional changes

Non functional changes

Changes that don't change the search behaviour, for example:

  1. Code cleanups
  2. Comments
  3. New commands

Functional changes

These change the search behaviour and lead to a different search tree.
Every functional patch (commit) has to be verified by Fishtest, our testing framework.

You can follow the steps described in our Fishtest wiki, to create your first test.
https://github.com/glinscott/fishtest/wiki/Creating-my-first-test

Clone this wiki locally