5

I have a simple question. Does the Stockfish engine use, amongst the steps of its complicated algorithm, a library/database of past matches? For such an algorithm to work, it would to need store many matches that have had a particular scenario. Each scenario has a player who went on to win. Thus, it is provided some kind of rating point to judge each particular scenario with, allowing it to choose the best move. It's either that or the Stockfish engine works just by working through the possible moves to figure out how to win.

In other words, does the Stockfish engine need to be fed data from past matches or can it work without any such data ?

3
  • I think this will help you : quora.com/…
    – p_square
    May 25, 2021 at 17:27
  • @Algebrology thanks, a lot. So, it seems the answer is NO. Thank you for that link , it really helped a lot. I am surprised though, it feels like i have heard it said a lot that chess engines analyse positions by comparing them with the positions in previous matches played between people. But i guess, i must have misunderstood May 25, 2021 at 19:15
  • Such a question has likely been answered hundreds or thousand of times elsewhere and i wouln't see the point of reiterating here. Generally if i wish to learn about a completely unkown subject X, i would google "tutorial X" or "introduction X". If have done that her for you and i think this link is quite useful: chess.com/article/view/computer-chess-engines
    – user27863
    May 25, 2021 at 21:18

4 Answers 4

6

Technically, Stockfish does make use of past matches, just not when it's playing. The way it uses its past matches is during training, when a new neural network (NNUE in Stockfish's case) is being trained. Once the NNUE is trained, though, it is "standalone" and does not change anymore.

The Stockfish you can download and play has an already-trained NNUE, so it does not use past matches.

6
0

To answer your question concisely, SF does not need a 'database' as in raw data pulled from a bag, but its NNUE function concatenates the moves, move order, and outcomes of many games played against itself to make more informed move decisions based on learned strategies and deep thinking.

A database is like a grocery store. An NNUE is like a cookbook from a Top Chef (it's gonna contain precise measurements, ingredients, cooking times, and detailed preparation as well as pictures showing garnished finished products--maybe even some backstory)

1
  • why downvote and not explain why? (EDIT: this comment is for the one that downvoted, not the post-creator) welcome to chess! Jun 27 at 9:33
0

does the Stockfish engine need to be fed data from past matches

No.

You are confusing Stockfish with AlphaZero. The two engines work in entirely different ways.

Stockfish works by using brute force calculation plus clever evaluation functions to determine what is the best move in any position. During a game it maintains hash tables of positions and evaluations that have occurred during that game so that when it calculates a transposition of an earlier calculated position it doesn't redo the calculations but just uses the previous one.

If an opening database is available it can use that but it also works perfectly well albeit slower without. Similarly in the endgame it can use tablebases if available which can greatly increase speed and accuracy.

AlphaZero, however, does rely on millions of training games played against itself in order to update its policy (learn to play chess well). It does not need data from past matches after it has been trained in order to play chess - the experience obtained from the past games is implicitly contained in the weights of the neural network.

1
  • 2
    Newer versions of Stockfish do use NNUE weights which come from millions of past games.
    – qwr
    Aug 21, 2022 at 0:35
0

If you see "NNUE" on the end of Stockfish's name, it means it's using something called a neural network (i.e. "Stockfish 15.1 NNUE"). A neural network works in a similar fashion to how your brain does. For example, you can look at an easy chess puzzle (say, a simple knight fork), and immediately know the right move. You don't have to check that the knight is attacking your opponent's king and rook, or that it is moving to a safe square. You know that it wins the exchange. Or, a better explanation might be the common description of Jose Raul Capablanca's abilities---many said that he could take one glance at a chessboard and know what the position needed.

That's a pretty simple explanation of how a neural network functions. Stockfish trains its neural network by playing millions of games with itself, and with each game the network gets a tiny bit better at evaluating positions. Then in an actual game or evaluation, it uses the network alongside traditional engine calculation to provide more accurate positional play (pawn structures and piece placement are what are really affected by neural network evaluation).

So the answer is yes and no. Stockfish doesn't reference a game database when it plays, but it does use a neural network that essentially makes it learn from its mistakes during self-play.

1
  • why downvote and not explain why? (EDIT: this comment is for the one that downvoted, not the post-creator) welcome to chess! Jun 27 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.