Stockfish syzygy "bug"

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

petero2
Posts: 689
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Searching for fastest mate when using DTZ tables

Post by petero2 »

syzygy wrote:
petero2 wrote:The basic idea is that a tablebase probe can not just return an exact score, it can also return a lower or upper bound, just like a transposition table probe.
Theoretically this is the "correct" approach. If a probe returns a "TB win", that is not an exact score, but a lower bound on the score.

But I would expect this to result in major search instability. Once beta exceeds the value of a "TB win", the TB probes become effectively useless. If a mate is found then everything is fine, but usually this won't be the case. (I have never actually tried this though, so maybe my concerns are unfounded.)
Major search instability was indeed a problem in early versions of the TB implementation for the reason you state. However, it was fixed by allowing the search function to return the TB probe bound even if the bound is between alpha and beta. In this case there is no known best move though.

Also note that there is no "TB-win" constant in texel. All TB probe scores are converted to normal mate bound scores. For example, in the following position a WDL probe returns >= 31931 (mate in 69 ply or better) and a DTZ probe returns >= 31974 (mate in 26 ply or better):
[D]3k4/8/3K4/8/8/8/N7/1B6 w - - 0 1
For some positions with many possible pawn moves and conversions, the DTM bound may not be very tight, but this does not lead to search instability. For example in the following position a DTZ probe returns >= 30613 (mate in 1387 ply or better):
[D]k7/p7/8/8/8/8/PP6/1K6 w - - 0 1
My implementation does not probe TBs at the root, but the probe function called from search decides based on alpha/beta and number of remaining pieces what type of probe (WDL/DTZ/DTM) to perform. As long as alpha/beta are smaller than the "mate score limit", only WDL probes are performed. This means that the relatively slow DTZ/DTM probes basically only happen after the game theoretic value of the root position has been established. See TBProbe::tbProbe() in the source code for details.