Expected Fingerprint Collisions Among Cache Keys

Last updated: November 29, 2026

Quick Overview

A cache stores 100,000 keys by a 32-bit hash fingerprint. Assuming a uniform hash, how many pairs of keys are expected to share a fingerprint, and what is the probability of no collision at all? How many bits would make the collision probability below one in a million?

Meta
Statistics & Math
Software Engineer
Meta
November 29, 2026
Software Engineer
Onsite
Statistics & Math
Medium

0

0

0 solved


A cache stores 100,000 keys by a 32-bit hash fingerprint. Assuming a uniform hash, how many pairs of keys are expected to share a fingerprint, and what is the probability of no collision at all? How many bits would make the collision probability below one in a million?

Meta runs massive caching layers where keys are often compared by fingerprint. Interviewers ask this to check that a systems candidate can do birthday-bound arithmetic quickly and turn it into a design decision about hash width.

What the Interviewer Expects
  • Use indicators over pairs: $E = \binom{m}{2}/N$
  • Compute about 1.16 expected colliding pairs
  • Approximate $P(\text{none}) \approx e^{-m^2/2N} \approx 0.31$
  • Solve for bits: about 53 to 54 bits for one in a million
  • Recommend 64-bit fingerprints or verifying full keys
Key Topics to Cover
Birthday bound
Hash collisions
Indicator variables
Poisson approximation
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • How does the answer change at 10 billion keys?
  • What is the expected number of empty buckets for a hash table with as many buckets as keys?
  • How would you verify that a hash function is close to uniform?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

m=105m = 10^5 keys, each hashed uniformly and independently to N=232≈4.29×109N = 2^{32} \approx 4.29 \times 10^9 values. A collision is a pair with equal fingerprints....

Approach

Use an indicator for each pair: P(pair collides)=1/NP(\text{pair collides}) = 1/N. Linearity gives the expected count. Since collisions are rare and nearly independent, the count is close to Poisson, which gives the pr...


Submit Your Answer
Markdown supported