# How often do hash collisions occur in modern chess engines?

This is a question I am asking for a chess engine I am attempting to create.

I have read that engines like Stockfish can look at around 100 million positions per second on a good computer. The code on GitHub (line 104) shows that Stockfish uses "uint64_t", a 64-bit int for hash keys. This Wikipedia page shows that for a hash table with 64 bit entries (4th line reading down), the probability of a collision after 6.1×10^8=600 million hashes (in the p=0.01 column) is 1%.

So at 100 million positions per second, giving the engine 6 seconds per half-move, 600 million positions would be analyzed for each half-move. A collision would occur 1 in every 100 half-moves. Thus, a collision would happen about once per game (50 moves per game seems roughly typical).

Am I missing something?

• That sounds about right. It would be interesting to see if using a 128 bit hash produces better results at longer time control. Part of the problem with testing this is that most fishtest runs ar at 10+.1, which would dramatically lower the chance of collision. If there was a similarly fast 128 bit hash, it could make a big difference at TCEC or other big events where there are way more nodes per move. Jan 31 at 1:10
• Interesting question about something I don’t know much about. What is the impact of a collision and how often might it be detectable? E.g. if the opponent plays identically how often would Stockfish play differently? Thanks Feb 14 at 3:06
• The impact of a collision would be that Stockfish mistakes a position (B) for a position that it has already evaluated (A). It would consider that posittion (B) has the same evaulation as position A which could be very wrong.
– user21794
Feb 15 at 0:30
• Also worth noting that most evaluated positions are maybe not important for the final evaluation, and that it'd require the depth of that evaluation to be more than or equal to the one it requires. So, tldr: it's not really gonna matter. Mar 3 at 23:57