←→ previous / next paget contentsg glossaryb browse by kind/ search
5.2
Amplification
Turning a gentle slope into a cliff
One bit barely separates neighbours from strangers. Combine k bits with AND and L tables with OR and the collision curve becomes an S. Choosing k and L is the whole design problem, and it has a closed form.
Build L independent tables, each with its own k bits. A point is a candidate if it shares a bucket with the query in any table:
Pr[candidate]=1−(1−pk)L
This is the AND-OR construction, or amplification. As a function of similarity it is an S-curve: near zero for dissimilar points, near one for similar points, with a transition that sharpens as k and L grow together.
Fig 5.2.1The LSH S-curve
Set k and L The faint dotted line is a single bit. The dashed markers are a true 10th neighbour and a random pair on Marginalia’s data. Where a marker meets the curve is, roughly, your recall (green) and the share of the database you will have to scan (red). When your settings match a measured configuration, the measurement appears below.
Every table stores a pointer for every vector. L tables cost L×N×4 bytes before you store a single vector: at L=64 that is 256 bytes per vector of index overhead, as much as an HNSW graph and far more than an IVF index, which stores each vector once.