Sunday, November 06, 2016

[ulfdtybu] Transposition table key width

We modified the Stockfish chess engine, changing the width of the key stored in a transposition table entry, the key16 field in TTEntry, from 16 bits to 32 bits.  This changes the key width effectively from 16+27 = 43 bits to 32+27 = 59 bits.  The 27 comes from, in experiments below, hash table sizes such that there were 2^27 Clusters.  The hash table was 3840 megabytes for 16-bit (with padding / alignment disabled, otherwise it would have been 4096), and 4608 megabytes for 32-bit.  Hash 5000 was sufficient for both.

The tables below give the ranking of black responses to 1.e4, as reported by MultiPV 500 at various depths.  The top line is 16-bit unmodified Stockfish, 1 Thread.  The second line is 32-bit.  The colors are randomly assigned to moves.

Snapshot of the code used to generate the output below is on github.  Here is a patch against Official Stockfish 1c0c4db6775fae5a8b785630f4fd406c235880d9. 

This is a work in progress.  In the future, we hope to explore even wider hashes, wide enough that hash collisions do not occur.  We may also explore the region between 16 and 32 bits.

Here are more complete logs, including scores and pv.  "before" is 16-bit; "after" is 32-bit.

Previous work: Hyatt and Cozzie, "The effect of hash collisions in a Computer Chess program", which concludes that collisions do not affect performance much.  However, we feel that with computers having gotten much more powerful, and people running very long analyses, the birthday paradox is having a significant effect, as seen below.  Hash table collisions are obscuring the answer to the question, what is the ground truth about a position?  What is the best response to 1.e4?  Open game, French, Sicilian, Caro-Kann, or Nimzowitsch?

Depth 1

d5e5e6d6Nf6Nc6h5g6c5Nh6g5b6c6a5h6a6Na6f6f5b5
d5e5e6d6Nf6Nc6h5g6c5Nh6g5b6c6a5h6a6Na6f6f5b5

Depth 2

d5e5e6d6Nc6h5Nf6c5b6g6Na6c6h6a5g5Nh6f5f6a6b5
d5e5e6d6Nc6h5Nf6c5b6g6Na6c6h6a5g5Nh6f5f6a6b5

Depth 3

d5e5Nc6Nf6h5d6e6h6b6c5Na6c6a5Nh6g6a6g5b5f6f5
d5e5Nc6Nf6h5d6e6h6b6c5Na6c6a5Nh6g6a6g5b5f6f5

Depth 4

d5Nc6e5d6e6c6c5f6f5h5Nh6h6g6a5a6g5b5Na6b6Nf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