You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add QT_0bit to ScalarQuantizer for centroid-only IVF distance (facebookresearch#5079)
Summary:
Adds a new ScalarQuantizer::QT_0bit type that encodes 0 bits per component, enabling IndexIVFScalarQuantizer to operate in centroid-only distance mode (code_size=0). In this mode, distance_to_code() returns the coarse distance from the quantizer, no per-vector data is stored, and reconstruction returns the centroid vector.
This is useful for IVF configurations where only query-to-centroid distances are needed (e.g., Unicorn's SQ0 use case).
Changes:
- Add QT_0bit enum to ScalarQuantizer::QuantizerType
- Add IVFCoarseDistanceScanner that returns coarse_dis from set_list()
- Handle code_size=0 in encode/decode/reconstruct/add paths
- Add 'SQ0' to index_factory
- Force by_residual=false for QT_0bit
- Guard memcpy in ArrayInvertedLists for code_size=0
- Handle QT_0bit in index_read.cpp validation switch
- Add tests for L2, IP, and index_factory
---
Differential Revision: D100348052
0 commit comments