Any good positions to test hash tables?

Discussion of chess software programming and technical issues.

Moderator: Ras

Mark
Posts: 216
Joined: Thu Mar 09, 2006 9:54 pm

Any good positions to test hash tables?

Post by Mark »

Just implemented hash tables in my program. While I can now solve Fine #70, I'm not really seeing any improvements in the wac test suite. My eval is basically material and piece-square tables.

Are there any other good positions or test suites to see if my hash is working correctly?

Thanks!
micron
Posts: 155
Joined: Mon Feb 15, 2010 9:33 am
Location: New Zealand

Re: Any good positions to test hash tables?

Post by micron »

The starting position has the merit of easy availability :-)

Look at time-to-depth. With no hash table, your program perhaps struggles to reach 9 or 10 plies. With a correctly functioning hash table (but no NMP or LMR) it won't bog down until 11 or 12...

It's good idea to count the number of hash probes and the outcomes:
- hit with score returned;
- hit with move returned;
- useless hit with no move;
- miss.
Many problems in a TT implementation can be recognised from abnormal percentage misses or useless hits. For instance, if your miss rate is > 50% in reasonably shallow (6--9 ply ) searches from the starting position, something is wrong.

Robert P.
User avatar
hgm
Posts: 28386
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Any good positions to test hash tables?

Post by hgm »

End-games are usually good tests:

4k3/8/8/8/8/8/4P3/4K3 w - - 0 1

how long until you see promotion. How long to mate?

KBBK mates are another good test case.
Mincho Georgiev
Posts: 454
Joined: Sat Apr 04, 2009 6:44 pm
Location: Bulgaria

Re: Any good positions to test hash tables?

Post by Mincho Georgiev »

One of the best I've seen:
8/k7/3p4/p2P1p2/P2P1P2/8/8/K7 w
White to play and win: 1. Ka1-b1 Ka7-b7 2. Kb1-c1
Mark
Posts: 216
Joined: Thu Mar 09, 2006 9:54 pm

Re: Any good positions to test hash tables?

Post by Mark »

Mincho Georgiev wrote:One of the best I've seen:
8/k7/3p4/p2P1p2/P2P1P2/8/8/K7 w
White to play and win: 1. Ka1-b1 Ka7-b7 2. Kb1-c1
Yes, this is the "Fine #70" problem, which I now get right, so any bugs couldn't be too bad!
Mark
Posts: 216
Joined: Thu Mar 09, 2006 9:54 pm

Re: Any good positions to test hash tables?

Post by Mark »

hgm wrote:End-games are usually good tests:

4k3/8/8/8/8/8/4P3/4K3 w - - 0 1

how long until you see promotion. How long to mate?

KBBK mates are another good test case.
Thanks! With null move on I see the promotion in 25 ply and 11 seconds. With null off (as I know it should be), it takes 9 minutes and 24 ply to see the promotion. Without the hash implemented I don't get anywhere near these depths.

I'll try some KBBK positions tonight.
Mark
Posts: 216
Joined: Thu Mar 09, 2006 9:54 pm

Re: Any good positions to test hash tables?

Post by Mark »

micron wrote:The starting position has the merit of easy availability :-)

Look at time-to-depth. With no hash table, your program perhaps struggles to reach 9 or 10 plies. With a correctly functioning hash table (but no NMP or LMR) it won't bog down until 11 or 12...

It's good idea to count the number of hash probes and the outcomes:
- hit with score returned;
- hit with move returned;
- useless hit with no move;
- miss.
Many problems in a TT implementation can be recognised from abnormal percentage misses or useless hits. For instance, if your miss rate is > 50% in reasonably shallow (6--9 ply ) searches from the starting position, something is wrong.

Robert P.
Thanks! I must have a problem since I'm not getting any improvement in the opening position. With null=2 it takes a minute or so to get to 10 ply with or without the hash. What I can't understand is that I get great improvements in endgame positions, so something must be working with the hash??

I'll try to tabulate some hit/miss statistics to see what's going on. I don't have a q-search or even a static exchange eval yet, so maybe the hash will show some improvements when I do?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Any good positions to test hash tables?

Post by bob »

Mark wrote:Just implemented hash tables in my program. While I can now solve Fine #70, I'm not really seeing any improvements in the wac test suite. My eval is basically material and piece-square tables.

Are there any other good positions or test suites to see if my hash is working correctly?

Thanks!
Fine is a really good test. You should hit depths of 30+ instantly if it is working. Hashing should help on other positions once you have a "best move" stored to improve your move ordering. That should be a measurable gain in terms of getting to a specific depth quicker...
JVMerlino
Posts: 1404
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Any good positions to test hash tables?

Post by JVMerlino »

bob wrote:
Mark wrote:Just implemented hash tables in my program. While I can now solve Fine #70, I'm not really seeing any improvements in the wac test suite. My eval is basically material and piece-square tables.

Are there any other good positions or test suites to see if my hash is working correctly?

Thanks!
Fine is a really good test. You should hit depths of 30+ instantly if it is working. Hashing should help on other positions once you have a "best move" stored to improve your move ordering. That should be a measurable gain in terms of getting to a specific depth quicker...
Really "instantly"? My engine takes about 3.6 seconds to reach depth 30, although it finds Kb1 at depth 22 in about 0.2 seconds.

jm
User avatar
hgm
Posts: 28386
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Any good positions to test hash tables?

Post by hgm »

Mark wrote:Thanks! I must have a problem since I'm not getting any improvement in the opening position.
Are you sure yo suppress e.p. rights when there is no enemy Pawn next to the one that just moved? In the opening position ignoring this is very detrimental for hit rate