Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Asymmetric Distance Computation (ADC): for each query, precompute a pq_m x 256 table of query to centroid distances.
Imagine you have a million items in a warehouse, each described by 32 'category tags'. A new query arrives and you want to find the closest items. The slow way is to fully expand every tag back into its full description and compare. The clever way: first, for each query, compute once how 'close' the query is to each of the 256 possible values of each tag. Now you have a small cheat-sheet. To score any warehouse item, just look up its 32 tags in the cheat-sheet and add up the 32 numbers. No real math per item, just lookups and adds. That is **asymmetric distance computation**.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: name ADC + per query setup vs per database cost + table size and cache fit + why ADC beats SDC + why GPU doesn't dominate.
| Approach | Per query setup | Per DB vector cost | Recall |
|---|---|---|---|
| Full float distance | 0 | O(d) multiplies + adds | Exact |
| Decode then compare PQ | 0 | O(d) multiplies + adds (after decode) | Approx (quantization) |
| SDC (symmetric) | 0 (table precomputed at index time) | pq_m lookups + adds | Approx (both sides quantized) |
| ADC (asymmetric) | pq_m * 256 distance ops | pq_m lookups + adds | Approx (only DB quantized; best of the three approx options) |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming the speedup comes from compression alone. Smaller vectors do help with memory bandwidth, but the headline win is the table-lookup arithmetic: pq_m additions per vector instead of d float multiplies and adds.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.