mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1908 To search the best combination of codebooks, the method that was implemented so far is via a beam search. It is possible to make this faster for a query vector q by precomputing look-up tables in the form of LUT_m = <q, cent_m> where cent_m is the set of centroids for quantizer m=0..M-1. The LUT can then be used as inner_prod = sum_m LUT_m[c_m] and L2_distance = norm_q + norm_db - 2 * inner_prod This diff implements this computation by: - adding the LUT precomputation - storing an exhaustive table of all centroid norms (when using L2) This is only practical for small additive quantizers, eg. when a residual vector quantizer is used as coarse quantizer (ResidualCoarseQuantizer). This diff is based on AdditiveQuantizer diff because it applies equally to other quantizers (eg. the LSQ). Reviewed By: sc268 Differential Revision: D28467746 fbshipit-source-id: 82611fe1e4908c290204d4de866338c622ae4148