Quicker ADC : Unlocking the Hidden Potential of Product Quantization With SIMD
Efficient Nearest Neighbor (NN) search in high-dimensional spaces is a foundation of many multimedia retrieval systems. A common approach is to rely on Product Quantization, which allows the storage of large vector databases in memory and efficient distance computations. Yet, implementations of nearest neighbor search with Product Quantization have their performance limited by the many memory accesses they perform. Following this observation, André et al. proposed Quick ADC with up to <inline-formula><tex-math notation="LaTeX">$6{\times }$</tex-math><alternatives><mml:math><mml:mrow><mml:mn>6</mml:mn><mml:mo>×</mml:mo></mml:mrow></mml:math><inline-graphic xlink:href="lescouarnec-ieq1-2952606.gif"/></alternatives></inline-formula> faster implementations of PQ <inline-formula><tex-math notation="LaTeX">${m}{\times }{4}$</tex-math><alternatives><mml:math><mml:mrow><mml:mi>m</mml:mi><mml:mo>×</mml:mo><mml:mn>4</mml:mn></mml:mrow></mml:math><inline-graphic xlink:href="lescouarnec-ieq2-2952606.gif"/></alternatives></inline-formula> product quantizers (PQ) leveraging specific SIMD instructions. Quicker ADC is a generalization of Quick ADC not limited to PQ <inline-formula><tex-math notation="LaTeX">${m}{\times }{4}$</tex-math><alternatives><mml:math><mml:mrow><mml:mi>m</mml:mi><mml:mo>×</mml:mo><mml:mn>4</mml:mn></mml:mrow></mml:math><inline-graphic xlink:href="lescouarnec-ieq3-2952606.gif"/></alternatives></inline-formula> codes and supporting AVX-512, the latest revision of SIMD instruction set. In doing so, Quicker ADC faces the challenge of using efficiently 5,6 and 7-bit shuffles that do not align to computer bytes or words. To this end, we introduce (i) <italic>irregular product quantizers</italic> combining sub-quantizers of different granularity and (ii) <italic>split tables</italic> allowing lookup tables larger than registers. We evaluate Quicker ADC with multiple indexes including Inverted Multi-Indexes and IVF HNSW and show that it outperforms the reference optimized implementations (i.e., FAISS and polysemous codes) for numerous configurations. Finally, we release an open-source fork of FAISS enhanced with Quicker ADC.