Possible "real" hash collision

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Possible "real" hash collision

Post by xr_a_y »

I probably gave the topic a bad title ... hash collision is most always a fantasy.

Here Minic is probably more struggling with a lot of delaying checks and miss evaluate everything as a draw score thanks to repetition.
But the plan for black is quite simple, put the two rooks on the 7th rank (to grab the pawn and then promote or the bishop), so I don't really get why Minic fails here.

Is everybody else engine seeing the only good move for white (Qf5) ? or after Kh2 the good move for black Rf7 ?

I guess, something that Minic should do here, is trying to force the draw by itself, not suppose the opponent will go for it.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Possible "real" hash collision

Post by mar »

xr_a_y wrote: Wed May 22, 2019 4:10 pm Is everybody else engine seeing the only good move for white (Qf5) ? or after Kh2 the good move for black Rf7?
My engine needs 3 seconds and depth 18 to see Rf7 after Kh2, single threaded.
It wants to play Qf5 before Kh2 rather quickly, but it's probably simply because it prefers Qf5, not because it sees that Kh2 loses to Rf7.
In multiPV mode it still Kh2 drops to -2.4 at depth 23, so I guess it's not so easy to see that Kh2 is bad. It's easy for SF, but not for our engines.
Martin Sedlak
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Possible "real" hash collision

Post by Pio »

xr_a_y wrote: Wed May 22, 2019 4:10 pm I probably gave the topic a bad title ... hash collision is most always a fantasy.

Here Minic is probably more struggling with a lot of delaying checks and miss evaluate everything as a draw score thanks to repetition.
But the plan for black is quite simple, put the two rooks on the 7th rank (to grab the pawn and then promote or the bishop), so I don't really get why Minic fails here.

Is everybody else engine seeing the only good move for white (Qf5) ? or after Kh2 the good move for black Rf7 ?

I guess, something that Minic should do here, is trying to force the draw by itself, not suppose the opponent will go for it.
Hi, I think you are correct about your analysis and maybe also because you look much deeper into the Principal variation. A long time ago I wrote some thoughts about how to handle this and similar cases in the following link viewtopic.php?f=7&t=61023

One thing you could do if you implement my idea is to allocate a lot more time when you see you can force a draw and the moves after since you have nothing to lose.

BR
Pio
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Possible "real" hash collision

Post by Joost Buijs »

My engine single threaded (certainly not a top engine) sees within 8 msec. that Qf5+ is necessary.

Code: Select all

info depth 1 score cp 136 time 1 nodes 99 nps 99000 tbhits 0 pv h3h2
info depth 2 score cp 68 time 1 nodes 155 nps 155000 tbhits 0 pv h3h2 c7f7
info depth 2 score cp 142 time 2 nodes 225 nps 112500 tbhits 0 pv f2f5 g6g7 g4g5
info depth 3 score cp 107 time 2 nodes 446 nps 223000 tbhits 0 pv f2f5 g6g7 g4g5 b1b2
info depth 4 score cp 94 time 3 nodes 890 nps 296666 tbhits 0 pv f2f5 g6g7 g4g5 b1b2 g5g6 b2a2
info depth 4 score cp 97 time 3 nodes 1724 nps 574666 tbhits 0 pv h3h2 b1b2 f2b6 c7d7 b6b4 b2a2
info depth 5 score cp 83 time 4 nodes 2362 nps 590500 tbhits 0 pv h3h2 b1b2 f2b6 c7d7 b6c6 b2a2 c6d7
info depth 6 score cp 52 time 6 nodes 5485 nps 914166 tbhits 0 pv h3h2 b1b2 f2b6 c7d7 b6c6 h7f6
info depth 6 score cp 74 time 8 nodes 10854 nps 1356750 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g8
info depth 7 score cp 41 time 11 nodes 13142 nps 1194727 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g8 e7d8
info depth 8 score cp 44 time 14 nodes 21337 nps 1524071 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g8 e7d8 h7f8
info depth 9 score cp 0 time 20 nodes 37373 nps 1868650 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e6 g6g7 e6e7
info depth 10 score cp 0 time 32 nodes 67108 nps 2097125 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e8 g6g7 e8d7 g7h8
info depth 11 score cp 0 time 46 nodes 106286 nps 2310565 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e8 g6g7 e8d7 g7h8 d7d8
info depth 12 score cp 0 time 74 nodes 185175 nps 2502364 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e8 g6g7 e8d7 g7g8 d7e6 g8g7
info depth 13 score cp 0 time 169 nodes 463688 nps 2743715 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e8 g6g7 e8d7 g7g8 d7e6 g8g7 e6e7
info depth 14 score cp 0 time 235 nodes 654089 nps 2783357 tbhits 0 pv f2f5 g6g7 h3h2 b1b2 f5e6 c7c2 e6e7 g7g6 e7e8 g6g7 e8d7 g7g8 d7e6 g8h8 e6e8 h8g7
info depth 15 score cp -1 time 462 nodes 1311307 nps 2838326 tbhits 0 pv f2f5 g6g7 h3h2 c7f7 f5e6 h7f8 e6d6 g7g8 d6e5 f7h7 g2h3 b1b2 h2g1 h7h3 e5g5 g8f7 g5f5
info depth 16 score cp -68 time 2049 nodes 5938231 nps 2898111 tbhits 0 pv f2f5 g6g7 h3h2 h7f8 f5g5 g7h8 g5d8 c7h7 g2h3 h8g8 d8g5 h7g7 g5f6 b1b2 h2g1 g7g6 f6e7 b2a2
info depth 17 score cp -69 time 4365 nodes 12680846 nps 2905119 tbhits 0 pv f2f5 g6g7 f5f2 c7f7 f2b6 f7f6 b6b7 g7g6 b7b4 b1b2 b4b8 b2a2 b3b4 a2f2 b8g8 g6h6 h3h4 f6g6 g4g5
info depth 18 score cp -106 time 9389 nodes 27207316 nps 2897786 tbhits 0 pv f2f5 g6g7 f5f2 c7d7 f2f5 d7f7 f5c8 b1b2 c8d8 f7f6 d8e7 g7g6 e7e8 g6h6 h3h4 f6g6 g4g5 g6g5 g2h3 b2a2
When I enter the position after Kh2 it sees Rf7 in a fraction of a second with a rising score.

Code: Select all

info depth 1 score cp -68 time 0 nodes 90 nps 90 tbhits 0 pv c7f7
info depth 2 score cp -103 time 0 nodes 134 nps 134 tbhits 0 pv c7f7 f2b6
info depth 2 score cp -87 time 1 nodes 239 nps 239000 tbhits 0 pv b1b2 f2f5 g6g7
info depth 3 score cp -97 time 1 nodes 537 nps 537000 tbhits 0 pv b1b2 f2b6 c7d7 b6b4 b2a2
info depth 4 score cp -83 time 2 nodes 939 nps 469500 tbhits 0 pv b1b2 f2b6 c7d7 b6c6 b2a2 c6d7
info depth 5 score cp -52 time 3 nodes 1850 nps 616666 tbhits 0 pv b1b2 f2b6 c7d7 b6c6 h7f6
info depth 6 score cp -39 time 4 nodes 3918 nps 979500 tbhits 0 pv b1b2 f2f5 g6g7 f5e6 c7c2 e6d7 g7g8 d7e8
info depth 6 score cp -1 time 5 nodes 6499 nps 1299800 tbhits 0 pv c7f7 f2b6 h7f6 g2f3 b1b2 h2g1 b2a2 b6d6
info depth 7 score cp 0 time 7 nodes 8523 nps 1217571 tbhits 0 pv c7f7 f2b6 h7f6 g2f3 f7h7 h2g2 b1b2 g2g1 b2b1
info depth 8 score cp 0 time 9 nodes 12781 nps 1420111 tbhits 0 pv c7f7 f2b6 h7f6 g2f3 f7h7 h2g2 b1b2 g2f1 b2b1 f1g2
info depth 9 score cp 19 time 15 nodes 26824 nps 1788266 tbhits 0 pv c7f7 f2c2 b1b2 c2c8 f7f2 c8g8 g6h6 g8e6 h7f6 h2h3 b2a2
info depth 10 score cp 34 time 27 nodes 58598 nps 2170296 tbhits 0 pv c7f7 f2b6 h7f6 g2f3 f7d7 b6b4 b1b2 h2g1 b2a2 b4c3 a2b2
info depth 11 score cp 38 time 35 nodes 79353 nps 2267228 tbhits 0 pv c7f7 f2b6 h7f6 g2f3 f7d7 b6b4 b1b2 h2g1 b2a2 b4c3 a2b2 b3b4 b2b1
info depth 12 score cp 160 time 67 nodes 169683 nps 2532582 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f2 c6e8 g6h6 e8e6 h7f6 h2h3 h6g6 g4g5 g6g5 e6d6
info depth 13 score cp 160 time 80 nodes 204149 nps 2551862 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f2 c6e8 g6h6 e8e6 h7f6 h2h3 h6g6 g4g5 g6g5 e6d6 f2g2
info depth 14 score cp 160 time 116 nodes 305620 nps 2634655 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f2 c6e8 g6h6 e8e6 h7f6 h2h3 h6g6 g4g5 g6g5 e6d6 f2g2 d6e5
info depth 15 score cp 170 time 274 nodes 758646 nps 2768781 tbhits 0 pv c7f7 f2c2 b1b2 c2c8 h7f8 c8b8 f7f2 h2h1 b2a2 b8b4 f2g2 b4d6 g6f7 d6c7 f7g8 c7e5 a2b2
info depth 16 score cp 124 time 720 nodes 2037089 nps 2829290 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f2 c6e8 g6h6 h2h3 b2a2 h3h4 a2b2 g4g5 h6g7 e8e7 f2f7 e7d6 b2g2 d6e5
info depth 17 score cp 138 time 1160 nodes 3309260 nps 2852810 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f2 c6e8 g6h6 h2h3 b2a2 h3h4 h6g7 g2h3 a2e2 e8e7 f2f7 e7d6 e2e4 d6a6 e4e3
info depth 18 score cp 119 time 3135 nodes 8986395 nps 2866473 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 h6g7 b8b7 g7g6 h2h1 f6f2 b7e7 h7f6 g4g5 b2b1 h1h2 f6e4 e7e6
info depth 19 score cp 158 time 5169 nodes 14940871 nps 2890476 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 h6g7 b8b7 g7g6 h2h1 b2a2 b7b4 a2a1 h1h2 a3a2 b4a5 h7g5 a5a8 g6h7
info depth 20 score cp 187 time 9880 nodes 28608532 nps 2895600 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 h6g7 b8b7 g7g6 h2h1 b2a2 b7b4 a2a1 h1h2 a3a2 g4g5 h7g5 b4a3 g6g7 g3g4
info depth 21 score cp 186 time 13552 nodes 39236583 nps 2895261 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 h6g7 b8b7 g7g6 b7b4 f6f2 b4c4 f2g2 h2h1 b2a2 c4c7
info depth 22 score cp 224 time 26181 nodes 75844981 nps 2896947 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 b2a2 b8b4 f6f2 b4d6 h7f6 h2h3 h6g6 g4g5 g6g5 d6e5 g5g6 h3h4 f2g2 e5f5 g6g7 f5e6
info depth 23 score cp 280 time 51380 nodes 148676169 nps 2893658 tbhits 0 pv c7f7 f2c2 b1b2 c2c6 f7f6 c6e8 g6h6 e8b8 b2a2 b8b4 f6f2 b4d6 h7f6 
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Possible "real" hash collision

Post by JVMerlino »

xr_a_y wrote: Wed May 22, 2019 4:10 pm Is everybody else engine seeing the only good move for white (Qf5) ? or after Kh2 the good move for black Rf7 ?
Even Myrddin, a much weaker engine than Minic, sees that Qf5 is best after only a few seconds, and gives it a draw score. It takes even less time than that, after Kh2, to see that Rf7 gives Black an advantage.

Do you have a way to get a static eval of the position? Given the number of pieces on the board, could it possibly be a rogue King Safety eval term pushing its King back?

jm
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Possible "real" hash collision

Post by xr_a_y »

JVMerlino wrote: Wed May 22, 2019 8:58 pm
xr_a_y wrote: Wed May 22, 2019 4:10 pm Is everybody else engine seeing the only good move for white (Qf5) ? or after Kh2 the good move for black Rf7 ?
Even Myrddin, a much weaker engine than Minic, sees that Qf5 is best after only a few seconds, and gives it a draw score. It takes even less time than that, after Kh2, to see that Rf7 gives Black an advantage.

Do you have a way to get a static eval of the position? Given the number of pieces on the board, could it possibly be a rogue King Safety eval term pushing its King back?

jm
Here is the static eval :

Code: Select all

# Info  2019-05-22 21:18:55-273: Reading fen 8/2r4n/3p2k1/3Pp3/1p2P1P1/pP4PK/P4QB1/1r6 w - - 2 41
# Warn  2019-05-22 21:18:55-273: No castling right given
# Info  2019-05-22 21:18:55-273: No en passant square given
# Info  2019-05-22 21:18:55-273: Position
# +-+-+-+-+-+-+-+-+
# | | | | | | | | |
# +-+-+-+-+-+-+-+-+
# | | |r| | | | |n|
# +-+-+-+-+-+-+-+-+
# | | | |p| | |k| |
# +-+-+-+-+-+-+-+-+
# | | | |P|p| | | |
# +-+-+-+-+-+-+-+-+
# | |p| | |P| |P| |
# +-+-+-+-+-+-+-+-+
# |p|P| | | | |P|K|
# +-+-+-+-+-+-+-+-+
# |P| | | | |Q|B| |
# +-+-+-+-+-+-+-+-+
# | |r| | | | | | |
# +-+-+-+-+-+-+-+-+
# wk h3
# bk g6
# Turn white
# Phase 0.468003
# Static score 227
# Hash 10120985343957484277
# FEN 8/2r4n/3p2k1/3Pp3/1p2P1P1/pP4PK/P4QB1/1r6 w - - 2 41

# Info  2019-05-22 21:18:55-273: eval 227 phase 0.468003
this is 2 pawns up, begin passer but double, material being more or less equal (Minic does not have imbalance term).
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Possible "real" hash collision

Post by xr_a_y »

I've just tried an analysis with pruning disabled after Kh2, expecting a high score quite fast ... but still 0 at depth 16 ... There is really something bad with draw (by repetition) detection ...

What makes me angry right now is that it was already an unresolved bug in Weini ... :evil:
konsolas
Posts: 182
Joined: Sun Jun 12, 2016 5:44 pm
Location: London
Full name: Vincent

Re: Possible "real" hash collision

Post by konsolas »

I suppose you could try turning off hash cutoffs and seeing if you get the same result
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Possible "real" hash collision

Post by xr_a_y »

konsolas wrote: Wed May 22, 2019 9:29 pm I suppose you could try turning off hash cutoffs and seeing if you get the same result
Even without a TT at all, after Kh2, black plays Rf7 but with a draw score.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Possible "real" hash collision

Post by JVMerlino »

I recall that one thing I tried when I was having a similar problem (or, at least, I suspected there was something wrong with repetition detection), was not saving positions to the TT that were given a draw score due to repetition. I think it pointed me in the right direction, but it was so long ago that I can't remember what the problem was. :oops: