Why weaken independence at all?
- The Chernoff proof genuinely needs full independence of the
Xi; the union-bound proof does not23:33,24:02. - The union-bound proof only used
E[Π_{i∈T} Xi] = Π_{i∈T} E[Xi] = 1/n^kfor setsTof sizek— an expectation over exactlykvariables24:33,25:06,25:23,25:39. - So any
kitems behaving as if independent suffices — strictly weaker than allnitems being independent25:56.
Two definitions
- k-wise independent random variables:
X1, …, Xnare k-wise independent if for every index seti1 < i2 < … < ik, the variablesXi1, …, Xikare independent26:18. - k-wise independent hash family:
His k-wise independent if, drawinghuniformly at random fromH, the random variablesh(0), h(1), …, h(u-1)are k-wise independent27:56,28:45,29:15,29:48. - Later refinement raised by a student: the definition should also require near-uniformity, not only independence; many textbook definitions fold that in
1:24:12.
Example families and their storage cost
| Family | Construction | Bits to store one h |
|---|---|---|
All functions U → M | any mapping; k-wise independent for every k ≤ u 29:48, 30:15, 31:22 | u·log m (≈ u log u) 32:26, 32:51, 33:39 |
Degree k-1 polynomials mod p | u = m = p prime, h(x) = Σ_{i=0}^{k-1} a_i x^i mod p 31:22, 31:57 | k·log p = k·log u 33:22, 33:39 |
- The storage gap is the whole point: for constant
k(2-wise, 3-wise, …) a polynomial hash costsO(log u)bits versusu log ufor a truly random function33:39,33:58. - Applying this back to load balancing:
log n / log log n-wise independence is enough for the balls-and-bins result — no truly random hash needed33:58,34:44.
Why polynomials are k-wise independent: polynomial interpolation
- Fix any
kdistinct inputsx1, …, xkand any target valuesy1, …, yk37:17. - By polynomial interpolation there is exactly one coefficient vector making
h(x1)=y1, …, h(xk)=yk37:17,37:49. - Counting:
p^kpossibley-tuples,p^kpossible coefficient vectors, and the map is a bijection ⇒ each outcome has probability exactly1/p^k, the same as truly random38:19,38:33. - A student's equivalent framing — the Vandermonde matrix is nonsingular — is correct, but interpolation is the less intimidating way to say it
36:30,36:57. - Why not fully independent: once any
kevaluations are fixed, every remaining evaluation is determined — again by interpolation50:12,50:40.
Handling m ≠ u: the "mod p mod m" family and its wraparound bias
- Real applications need
m ≈ n, far smaller thanu, so theu = m = passumption must go34:44,35:48. - Construction: take
u = pprime (a prime always sits within a factor of 2 of any target, so assuming primality is cheap) and defineh(x) = (Σ a_i x^i mod p) mod m, withm < p35:17,35:48,39:24,40:24. - The problem: a uniform value in
[0, p-1]reduced modmis not uniform in[0, m-1]. Values before the last partial wraparound get extra mass39:03,41:48,42:13. It is the same reason truncating a random number to get a range gives nonuniform counts41:27. - The guarantee that survives: no output gets more than a
2/mshare, so for allx1..xk, y1..yk,Pr[h(x1)=y1 ∧ … ∧ h(xk)=yk] ≤ (2/m)^k42:34,42:56,43:20. - Worst case is
p = m + 1: exactly one residue is hit twice, making it twice as likely as the others. More wraparounds even things out, so the factor 2 is a sloppy upper bound44:31,45:04,45:24,46:06. - Still good enough: rerunning the balls-and-bins calculation with
(2/n)^kinstead of(1/n)^kstill gives max load ≈log n / log log n43:20,44:11.
Student proposal: rejection sampling, and why it fails here
- Idea raised: re-feed the output through
h(or resample) until it falls belowm, i.e. deterministic rejection sampling47:23,47:48,48:05. - Objections given
48:21,48:36,48:53:- There are
nhash values in play; rejecting whenever any of them is bad happens often and costs a lot of time. - Redrawing coefficients per-key means storing a different
hperx, which destroys the entire space saving that motivated k-wise families in the first place.
- There are