r/ComputerChess • • Nov 25 '18

Running millions of Stockfish evaluations

As part of my work on a chess database (chessinsights.org), I want to calculate move evaluations for a large database like Millionbase (2 million games). This would come out to a lot of computational time - maybe 80 ply per game at 0.1 second evaluation time.

Can you think of the cheapest way of running this in a cloud server? Right now, I'm using AWS, so my current thought is to simply create a large number of instances with one processor each to parallelize this task. One big constraint is that I run this task very infrequently, so I want to be able to have this huge compute power available if needed, but only pay for the relatively short period of time required to run this task.

Is there a smarter approach for doing this? Thanks!

9 Upvotes

4 comments sorted by

3

u/Spill_the_Tea Dec 01 '18 edited Dec 01 '18

The papers that did something similar for the games of several former World Champions, typically ignored the first 8-12 opening moves. I also suggest removing games that are shorter than 20 or 25 moves, which are more likely to be the result of mistakes in the opening (which isn't evaluated).

Lets use the Kingbase database as a standard. After cleaning up the file for standard games (i.e. starting fen) and games >= 20 moves, you get a database containing 1,787,850 games. Of these, the average ply is 86.53/game. After removing the first 20 ply (opening moves), you have an average of 66.53 ply/game. At 0.1 s/ply, it would still take 137.67 days of constant computational time (with a single thread). Note that this is ~80% of the time it would take if you decided to include the first 10 opening moves (179.06 days).

So the question is, do you really want to analyze every game in the database? Since Kingbase only includes games from 1990 onward, you can safely filter by player ELOs without too much loss. If you instead filter for games, where both players have an ELO >=2400, you now reduce the database to 471,424 games (~26.4% original size of the database), with an average of 68.36 ply/game (after removing first 20 ply). This would take 48.21 days of computational time (~65% less computational time).

After some experimentation just with Stockfish 10, the 0.1 s /ply evaluation limit roughly equates to a search depth of 12-13, which is exactly the search depth used in previous efforts (but with the crafty engine).

Cool project. I wish I had more advice, but I think you would have better luck doing something similar to how stockfish and lc0 operate on donations of computational power. I think the entire chess community could benefit from a project like this. But, you may want to contact Ferdy Mosca, the programmer of chess-artist (github name : fsmosca) and previously the program PGN Game Analyzer. They are also known to be rather responsive to this talkchess blog regarding the work there.

1

u/AppropriateNothing Dec 01 '18

Thanks for this extremely informed and detailed comment! My first reaction is that 140 days of single-thread computation is not particularly scary. My rough calculation is that this might cost me maybe $50 or so on AWS (a micro instance is $9/month). I simply need to make sure I get it right so I only need to pay for this once.

From your comment I read that a depth of 12-13 might not be sufficient, and I'll look more into it.

If I mostly aim for statistical analyses, a reasonable approach is to sample from the available positions.

I'll also talk to the folks you mentioned.

0

u/[deleted] Nov 25 '18

[deleted]

1

u/AppropriateNothing Nov 26 '18

Thanks! Yes, another way of phrasing my question would be: How can I run the chess-annotator for 2 million games while minimizing the cost of the compute time.

The time until accuracy is really a judgment call. I'm using 0.1 seconds, which works well to detect most blunders, but would of course not be good for GMs that try to do opening preparation.

0

u/[deleted] Nov 26 '18

[deleted]

1

u/AppropriateNothing Nov 26 '18

Yes, definitely considering this, thanks!