Problem with Syzygy bases

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, chrisw, Rebel

User avatar
Rebel
Posts: 7227
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Problem with Syzygy bases

Post by Rebel »

I am working to improve my NN with Syzygy bases, I have installed the 3-6 men and the 10 most used 7-men and use SF16 to reanalyze the 3-6 men and the 10 most used 7-men in my NN.

This goes well except for 1/3500 cases the bases don't return a TB score and I wonder what the reason is. I went to https://syzygy-tables.info/ and here the failed positions worked well. So maybe a false download?

Some failed positions.

Code: Select all

2n5/2P5/8/1k6/p7/3K4/3N1p2/8 b - - 0 1 68 c8d6 0
8/kp3KP1/8/2q5/5Q2/8/8/8 b - - 0 1 -19 c5d5 0
8/8/8/1k5p/3K3N/8/4N3/8 b - - 0 1 -28 b5c6 0
Maybe someone is willing to check?
90% of coding is debugging, the other 10% is writing bugs.
Jouni
Posts: 3462
Joined: Wed Mar 08, 2006 8:15 pm
Full name: Jouni Uski

Re: Problem with Syzygy bases

Post by Jouni »

In last position SF 17 thinks, that white win (50 move draw on).

Analysis by Stockfish 17:

1...Kc6 2.Ke4 Kc5 3.Nd4 Kd6 4.Nb3 Ke6 5.Nc5+ Kd6 6.Kd4 Kc6 7.Ne4 Kb5 8.Kd5 Kb4 9.Nf2 Kc3 10.Kc5 Kd2 11.Kd4 Kc2 12.Ne4 Kb3 13.Kc5 Ka3 14.Kc4 Ka4 15.Nf2 Ka5 16.Kc5 Ka4 17.Nd3 Ka5 18.Nb4 Ka4 19.Nc6 Kb3 20.Kd4 Kc2 21.Na5 Kd2 22.Nb3+ Ke2 23.Ke4 Kf2 24.Nd4 Kg3 25.Ndf5+ Kf2 26.Kd3 Ke1 27.Nd6 Kf2 28.Ne4+ Ke1 29.Ng2+ Kd1 30.Nc5 Kc1 31.Ne3 Kb2 32.Kd2 Kb1 33.Nc4 Ka2 34.Kc1 Ka1 35.Nb3+ Ka2 36.Kc2 h4 37.Nc1+ Ka1 38.Nb2 h3 39.Nd1 h2 40.Nc3 h1Q 41.Nb3#
+- (200.00) Depth: 7/7 00:00:00 0kN, tb=6

Nalimov tbs says mate in 79.

What's this??
Jouni
User avatar
Brunetti
Posts: 352
Joined: Tue Dec 08, 2009 1:37 pm
Location: Milan, Italy
Full name: Alex Brunetti

Re: Problem with Syzygy bases

Post by Brunetti »

Jouni wrote: Wed Nov 20, 2024 10:58 pm What's this??
If you explore the Stockfish line on the Syzygy tables site, you’ll encounter some peculiar positions. I’m not an expert in tablebases, but here’s an example:

[d]8/8/8/7p/2K1N2N/k7/8/8 b - - 0 1

The site shows:

Code: Select all

Black is losing DTM 122 DTZ 45
Ka4 DTM 107 Loss with DTZ 44
Kb2 DTM 121 Loss with DTZ 28
Ka2 DTM 103 Loss with DTZ 16
stating that ...Ka4 is the best move, while Lichess online tablebases indicate ...Kb2 as the best choice for Black.
There are several such instances along this line. I hope this information proves helpful.

Alex
syzygy
Posts: 5654
Joined: Tue Feb 28, 2012 11:56 pm

Re: Problem with Syzygy bases

Post by syzygy »

Rebel wrote: Wed Nov 20, 2024 8:32 pmand the 10 most used 7-men
[d]2n5/2P5/8/1k6/p7/3K4/3N1p2/8 b
You need all the tables into which black can promote.
syzygy
Posts: 5654
Joined: Tue Feb 28, 2012 11:56 pm

Re: Problem with Syzygy bases

Post by syzygy »

Jouni wrote: Wed Nov 20, 2024 10:58 pm In last position SF 17 thinks, that white win (50 move draw on).

Analysis by Stockfish 17:

1...Kc6 2.Ke4 Kc5 3.Nd4 Kd6 4.Nb3 Ke6 5.Nc5+ Kd6 6.Kd4 Kc6 7.Ne4 Kb5 8.Kd5 Kb4 9.Nf2 Kc3 10.Kc5 Kd2 11.Kd4 Kc2 12.Ne4 Kb3 13.Kc5 Ka3 14.Kc4 Ka4 15.Nf2 Ka5 16.Kc5 Ka4 17.Nd3 Ka5 18.Nb4 Ka4 19.Nc6 Kb3 20.Kd4 Kc2 21.Na5 Kd2 22.Nb3+ Ke2 23.Ke4 Kf2 24.Nd4 Kg3 25.Ndf5+ Kf2 26.Kd3 Ke1 27.Nd6 Kf2 28.Ne4+ Ke1 29.Ng2+ Kd1 30.Nc5 Kc1 31.Ne3 Kb2 32.Kd2 Kb1 33.Nc4 Ka2 34.Kc1 Ka1 35.Nb3+ Ka2 36.Kc2 h4 37.Nc1+ Ka1 38.Nb2 h3 39.Nd1 h2 40.Nc3 h1Q 41.Nb3#
+- (200.00) Depth: 7/7 00:00:00 0kN, tb=6

Nalimov tbs says mate in 79.

What's this??
It seems Stockfish gets that wrong. Is it repeatable with different hash sizes?
syzygy
Posts: 5654
Joined: Tue Feb 28, 2012 11:56 pm

Re: Problem with Syzygy bases

Post by syzygy »

syzygy wrote: Thu Nov 21, 2024 1:52 am
Jouni wrote: Wed Nov 20, 2024 10:58 pm In last position SF 17 thinks, that white win (50 move draw on).

Analysis by Stockfish 17:

1...Kc6 2.Ke4 Kc5 3.Nd4 Kd6 4.Nb3 Ke6 5.Nc5+ Kd6 6.Kd4 Kc6 7.Ne4 Kb5 8.Kd5 Kb4 9.Nf2 Kc3 10.Kc5 Kd2 11.Kd4 Kc2 12.Ne4 Kb3 13.Kc5 Ka3 14.Kc4 Ka4 15.Nf2 Ka5 16.Kc5 Ka4 17.Nd3 Ka5 18.Nb4 Ka4 19.Nc6 Kb3 20.Kd4 Kc2 21.Na5 Kd2 22.Nb3+ Ke2 23.Ke4 Kf2 24.Nd4 Kg3 25.Ndf5+ Kf2 26.Kd3 Ke1 27.Nd6 Kf2 28.Ne4+ Ke1 29.Ng2+ Kd1 30.Nc5 Kc1 31.Ne3 Kb2 32.Kd2 Kb1 33.Nc4 Ka2 34.Kc1 Ka1 35.Nb3+ Ka2 36.Kc2 h4 37.Nc1+ Ka1 38.Nb2 h3 39.Nd1 h2 40.Nc3 h1Q 41.Nb3#
+- (200.00) Depth: 7/7 00:00:00 0kN, tb=6

Nalimov tbs says mate in 79.

What's this??
It seems Stockfish gets that wrong. Is it repeatable with different hash sizes?
I think I am getting the same result:

Code: Select all

info depth 60 seldepth 123 multipv 1 score cp -20000 nodes 3577883971 nps 7699308 hashfull 173 tbhits 6 time 464702 pv b5c6 d4e4 c6c5 e2d4 c5d6 d4b3 d6e6 b3c5 e6d6 e4d4 d6c6 c5e4 c6b5 d4d5 b5b4 e4f2 b4c3 d5c5 c3d2 c5d4 d2c2 f2e4 c2b3 d4c5 b3a3 c5c4 a3a4 e4f2 a4a5 c4c5 a5a4 f2d3 a4a5 d3b4 a5a4 b4c6 a4b3 c5d4 b3c2 c6a5 c2d2 a5b3 d2e2 d4e4 e2f2 b3d4 f2g3 d4f5 g3f2 e4d3 f2e1 f5d6 e1f2 d6e4 f2e1 h4g2 e1d1 e4c5 d1c1 g2e3 c1b2 d3d2 b2b1 e3c4 b1a2 d2c1 a2a1 c5b3 a1a2 c1c2 h5h4 b3c1 a2a1 c4b2 h4h3 b2d1 h3h2 d1c3 h2h1q c1b3
I did not check the full line, but it also ends with h1Q and Nb3, which is probably mate.

The line does end in mate, but it is not the optimal line.
However, SF does not return a mate score. It return what I think is the TB win score.

So maybe this is not strictly a bug (SF does not actually find a mate), but it is strange to see the PV end in mate.
peter
Posts: 3269
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Problem with Syzygy bases

Post by peter »

Jouni wrote: Wed Nov 20, 2024 10:58 pm Nalimov tbs says mate in 79.

What's this??
It's a cursed win of course. Hope, we are talking about the same position, but here's the line following Nalimov's from what I think is starting position of yours too, 50 moves along:

[pgn]
[Event "?"]
[Site "?"]
[Date "2024.11.21"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "8/8/8/1k5p/3K3N/8/4N3/8 b - -"]

1... Kc6 2. Ke5 Kc5 3. Nd4 Kc4 4. Ne6 Kd3 5. Kf4 Kc3 6. Ke3
Kc4 7. Ke4 Kc3 8. Kd5 Kd3 9. Nf4+ Kc3 10. Kc5 Kd2 11. Kd4
Kc2 12. Nd5 Kb3 13. Kd3 Ka4 14. Kc4 Ka5 15. Kc5 Ka4 16. Nf6
Ka3 17. Kb5 Kb3 18. Ne4 Ka3 19. Nc5 Kb2 20. Kc4 Kc2 21. Nf3
h4 22. Kd4 h3 23. Nh2 Kd2 24. Nb3+ Kc2 25. Kc4 Kb2 26. Nd4
Ka2 27. Kc3 Ka3 28. Nb3 Ka2 29. Nc5 Ka3 30. Kc4 Ka2 31. Kd3
Kb2 32. Kd2 Ka2 33. Kc2 Ka3 34. Kc3 Ka2 35. Nd3 Kb1 36. Kb3
Ka1 37. Kc2 Ka2 38. Nb2 Ka1 39. Nc4 Ka2 40. Kc3 Kb1 41. Kd2
{10s} Ka1 42. Kc1 Ka2 43. Kc2 Ka1 44. Kb3 Kb1 45. Nd2+ Kc1
46. Kc3 Kd1 47. Nb3 Ke1 48. Kd4 Ke2 49. Ke4 Ke1 50. Ke3 Kd1
[/pgn]
According to Nalimov's DTM still 30 moves to mate.

Huntsman at the starting position with 6men loaded, ProbeDepth 1 and ProbeLimit 6 says

8/8/8/1k5p/3K3N/8/4N3/8 b - -

Engine: The Huntsman 10 (32768 MB)
von the Stockfish developers (see AUTHORS f

58/59 0:12 +152.65 1...Kc6 2.Sc3 Kd6 3.Sb5+ Ke6 4.Ke4 Kf6
5.Sd4 Kg5 6.Sdf3+ Kg4 7.Ke5 Kg3
8.Kf5 Kf2 9.Kf4 Ke2 10.Ke4 Kf2
11.Sg5 Ke2 12.Sh3 Kd2 13.Kd4 Ke2
14.Sf4+ Kf2 (881.940.960) 70112 TB:6

And with ProbeLimit 0:

8/8/8/1k5p/3K3N/8/4N3/8 b - -

Engine: The Huntsman 10 (32768 MB)
von the Stockfish developers (see AUTHORS f

66/66 0:33 +1.42 1...Kb4 2.Kd5 Kb5 3.Ke4 Kc4 4.Sf4 Kc5
5.Kd3 Kb6 6.Se6 Kb5 7.Kd4 Kb6 8.Sg5 Kb5
9.Sf7 Kc6 10.Kc4 Kd7 11.Kd5 Ke7
12.Se5 Kf6 13.Sef3 Ke7 14.Sd4 Kd7 (2.318.560.668) 68955

Setting move count to 0 after 50 moves (end of .pgn):


8/8/8/8/8/1N2K2p/7N/3k4 w - -

Engine: The Huntsman 10 (32768 MB)
von the Stockfish developers (see AUTHORS f

54/55 0:11 +M30 1.Kd3 Ke1 2.Sc1 Kd1 3.Se2 Ke1 4.Sc3 Kf2
5.Kd2 Kg2 6.Ke2 Kg3 7.Ke3 Kh4 8.Kf4 Kh5
9.Kf5 Kh6 10.Kf6 Kh7 11.Sd5 Kg8
12.Ke7 Kh7 13.Kf7 Kh6 14.Kf6 (804.649.064) 67154

(Same DTM with ProbleLimit 0 as well as with 6)
Last edited by peter on Thu Nov 21, 2024 9:25 am, edited 1 time in total.
Peter.
Jouni
Posts: 3462
Joined: Wed Mar 08, 2006 8:15 pm
Full name: Jouni Uski

Re: Problem with Syzygy bases

Post by Jouni »

Obsidian scores this knight position as draw.
Jouni
peter
Posts: 3269
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Problem with Syzygy bases

Post by peter »

Jouni wrote: Thu Nov 21, 2024 9:23 am Obsidian scores this knight position as draw.
So does SF 20241113 with ProbeLimit 0.
BTW going the Nalimov- line above backwards, SF keeps drawing eval in hash till move nr. 20, after 21.Nf3:

[d]8/8/8/2N4p/2K5/5N2/2k5/8 b - -

Engine: Stockfish dev-20241113-82b092ca0 (32768 MB)
von the Stockfish developers (see AUTHORS f

50/104 0:00 +0.16 21...h4 22.Se6 h3 23.Sed4+ Kb1
24.Kc3 Ka2 25.Sh2 Ka3 26.Sb3 Ka4
27.Kc4 Ka3 28.Sc5 Kb2 29.Kd3 Kb1
30.Kc3 Kc1 31.Sd3+ Kb1 32.Kb3 Ka1
33.Sf1 h2 34.Sxh2 Kb1 (20.142.026) 45161 TB:5

51/106 0:09 +0.16 21...h4 22.Se6 (410.765.195) 43097 TB:5

51/106 0:11 +0.16 21...h4 22.Se6 (515.025.249) 43221 TB:5

Taking back one more ply:

[d]8/8/8/2N4p/2K4N/8/2k5/8 w - -

Engine: Stockfish dev-20241113-82b092ca0 (32768 MB)
von the Stockfish developers (see AUTHORS f

46/73 0:15 +200.00 21.Sb3 Kb2 22.Sd4 Ka2 23.Kc3 Ka3
24.Sb3 Ka4 25.Kc4 Ka3 26.Sc5 Kb2
27.Sf3 Kc2 28.Sa4 Kc1 29.Kc3 Kb1
30.Kb3 Kc1 31.Sb2 Kb1 32.Sd3 Ka1
33.Sd2 h4 34.Sc1 (724.532.767) 47745 TB:16

But again by switching to ProbeLimit 0 there:

Code: Select all

8/8/8/2N4p/2K4N/8/2k5/8 w - -

Engine: Stockfish dev-20241113-82b092ca0 (32768 MB)
von the Stockfish developers (see AUTHORS f

38/81  0:01   0.00     21.Sb3 Kb2 22.Sd4 Ka2 23.Kc3 Ka3 
                       24.Sb3 Ka2 (62.639.174) 41155 

...

42/33  0:01   0.00     21.Sb3 Kb2 22.Sd4 Ka2 23.Kc3 Ka3 
                       24.Sb3 Ka2 25.Sc5 Ka3 26.Kc4 Kb2 
                       27.Kd3 Kb1 28.Kc3 Kc1 29.Sb3+ Kd1 
                       30.Kd3 Ke1 31.Sc1 Kf2 32.Se2 Ke1 
                       33.Kc4 Kf2 (70.192.601) 41048 

43/90  0:05   +0.33    21.Sb3 Kb2 22.Sd4 Ka3 23.Kb5 Kb2 
                       24.Kb4 Ka2 25.Sc2 Kb1 26.Kc3 Ka2 
                       27.Sd4 Ka3 28.Sb3 Ka2 29.Sc5 Ka3 
                       30.Sf3 h4 31.Sxh4 Ka2 32.Sf3 Ka3 
                       33.Sd4 Ka2 34.Kb4 (226.251.041) 44441 

...

45/95  0:14   +0.35    21.Sb3 Kb2 22.Sd4 Ka3 23.Kb5 Ka2 
                       24.Ka4 Kb2 25.Kb4 Ka2 26.Sc2 Kb1 
                       27.Kc3 Ka2 28.Sd4 Ka3 29.Sb3 Ka2 
                       30.Sc5 Ka3 31.Sf3 h4 32.Sxh4 Ka2 
                       33.Sf3 Ka3 34.Sd4 (653.222.978) 46443 

...

46/98  0:44   +0.38++  21.Sb3 (2.102.957.133) 46925 

46/98  0:44   +1.48++  21.Sb3 (2.102.960.765) 46925 

46/98  0:44   +2.62++  21.Sb3 (2.102.961.747) 46925 
...

46/98  0:44   +58.11++ 21.Sb3 (2.103.091.168) 46925 

46/99  0:46   +0.27--  21.Sb3 Kb2 (2.165.900.671) 47013 
:)
Peter.
Joerg Oster
Posts: 952
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany
Full name: Jörg Oster

Re: Problem with Syzygy bases

Post by Joerg Oster »

syzygy wrote: Thu Nov 21, 2024 2:07 am
syzygy wrote: Thu Nov 21, 2024 1:52 am
Jouni wrote: Wed Nov 20, 2024 10:58 pm In last position SF 17 thinks, that white win (50 move draw on).

Analysis by Stockfish 17:

1...Kc6 2.Ke4 Kc5 3.Nd4 Kd6 4.Nb3 Ke6 5.Nc5+ Kd6 6.Kd4 Kc6 7.Ne4 Kb5 8.Kd5 Kb4 9.Nf2 Kc3 10.Kc5 Kd2 11.Kd4 Kc2 12.Ne4 Kb3 13.Kc5 Ka3 14.Kc4 Ka4 15.Nf2 Ka5 16.Kc5 Ka4 17.Nd3 Ka5 18.Nb4 Ka4 19.Nc6 Kb3 20.Kd4 Kc2 21.Na5 Kd2 22.Nb3+ Ke2 23.Ke4 Kf2 24.Nd4 Kg3 25.Ndf5+ Kf2 26.Kd3 Ke1 27.Nd6 Kf2 28.Ne4+ Ke1 29.Ng2+ Kd1 30.Nc5 Kc1 31.Ne3 Kb2 32.Kd2 Kb1 33.Nc4 Ka2 34.Kc1 Ka1 35.Nb3+ Ka2 36.Kc2 h4 37.Nc1+ Ka1 38.Nb2 h3 39.Nd1 h2 40.Nc3 h1Q 41.Nb3#
+- (200.00) Depth: 7/7 00:00:00 0kN, tb=6

Nalimov tbs says mate in 79.

What's this??
It seems Stockfish gets that wrong. Is it repeatable with different hash sizes?
I think I am getting the same result:

Code: Select all

info depth 60 seldepth 123 multipv 1 score cp -20000 nodes 3577883971 nps 7699308 hashfull 173 tbhits 6 time 464702 pv b5c6 d4e4 c6c5 e2d4 c5d6 d4b3 d6e6 b3c5 e6d6 e4d4 d6c6 c5e4 c6b5 d4d5 b5b4 e4f2 b4c3 d5c5 c3d2 c5d4 d2c2 f2e4 c2b3 d4c5 b3a3 c5c4 a3a4 e4f2 a4a5 c4c5 a5a4 f2d3 a4a5 d3b4 a5a4 b4c6 a4b3 c5d4 b3c2 c6a5 c2d2 a5b3 d2e2 d4e4 e2f2 b3d4 f2g3 d4f5 g3f2 e4d3 f2e1 f5d6 e1f2 d6e4 f2e1 h4g2 e1d1 e4c5 d1c1 g2e3 c1b2 d3d2 b2b1 e3c4 b1a2 d2c1 a2a1 c5b3 a1a2 c1c2 h5h4 b3c1 a2a1 c4b2 h4h3 b2d1 h3h2 d1c3 h2h1q c1b3
I did not check the full line, but it also ends with h1Q and Nb3, which is probably mate.

The line does end in mate, but it is not the optimal line.
However, SF does not return a mate score. It return what I think is the TB win score.

So maybe this is not strictly a bug (SF does not actually find a mate), but it is strange to see the PV end in mate.
That's because of vondele's PV extension patch.
See https://github.com/official-stockfish/S ... 0bfad3b850

I think the main purpose is to show a PV line representing the TB outcome.
This was also announced in the release notes of Stockfish 17.
Improved engine lines

This release introduces principal variations (PVs) that are more informative for mate and decisive table base (TB) scores. In both cases, the PV will contain all moves up to checkmate. For mate scores, the PV shown is the best variation known to the engine at that point, while for table base wins, it follows, based on the TB, a sequence of moves that preserves the game outcome to checkmate.
Jörg Oster