Support SVSVamana as IVF coarse quantizer via index_factory#5175
Open
mnorris11 wants to merge 1 commit intofacebookresearch:mainfrom
Open
Support SVSVamana as IVF coarse quantizer via index_factory#5175mnorris11 wants to merge 1 commit intofacebookresearch:mainfrom
mnorris11 wants to merge 1 commit intofacebookresearch:mainfrom
Conversation
Contributor
|
@mnorris11 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103568560. |
b5ac782 to
ea1c11a
Compare
mnorris11
pushed a commit
to mnorris11/faiss
that referenced
this pull request
May 4, 2026
…research#5175) Summary: Enable IndexSVSVamana to be used as a coarse quantizer for Faiss IVF indexes, following the same pattern as IndexHNSWFlat and IndexNSGFlat. Changes: 1. index_factory.cpp: Add `IVF<nlist>_SVSVamana<degree>` regex pattern in `parse_coarse_quantizer()` and explicit `get_trains_alone()` return for IndexSVSVamana (training mode 2: k-means on flat index, then centroids added to the graph). Both guarded by `#ifdef FAISS_ENABLE_SVS`. 2. IndexSVSVamana.h/.cpp: Add `reconstruct()` support with a `stored_vectors` buffer. The SVS runtime API does not expose vector retrieval, so we keep a copy of added vectors. This is needed for IVF residual computation (`by_residual = true`) and `check_compatible_for_merge()`. When used as a coarse quantizer, the buffer holds only `nlist` centroids (trivial memory cost). Also clears `stored_vectors` on `reset()`. Example factory string: `"IVF65536_SVSVamana32,SQ8"` Differential Revision: D103568560
Summary: Enable IndexSVSVamana to be used as a coarse quantizer for Faiss IVF indexes, following the same pattern as IndexHNSWFlat and IndexNSGFlat. Changes: 1. index_factory.cpp: Add `IVF<nlist>_SVSVamana<degree>` regex pattern in `parse_coarse_quantizer()` and explicit `get_trains_alone()` return for IndexSVSVamana (training mode 2: k-means on flat index, then centroids added to the graph). Both guarded by `#ifdef FAISS_ENABLE_SVS`. 2. IndexSVSVamana.h/.cpp: Add `reconstruct()` support with a `stored_vectors` buffer. The SVS runtime API does not expose vector retrieval, so we keep a copy of added vectors. This is needed for IVF residual computation (`by_residual = true`) and `check_compatible_for_merge()`. When used as a coarse quantizer, the buffer holds only `nlist` centroids (trivial memory cost). Also clears `stored_vectors` on `reset()`. Example factory string: `"IVF65536_SVSVamana32,SQ8"` Differential Revision: D103568560
ea1c11a to
b32097b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Enable IndexSVSVamana to be used as a coarse quantizer for Faiss IVF indexes, following the same pattern as IndexHNSWFlat and IndexNSGFlat.
Changes:
index_factory.cpp: Add
IVF<nlist>_SVSVamana<degree>regex pattern inparse_coarse_quantizer()and explicitget_trains_alone()return for IndexSVSVamana (training mode 2: k-means on flat index, then centroids added to the graph). Both guarded by#ifdef FAISS_ENABLE_SVS.IndexSVSVamana.h/.cpp: Add
reconstruct()support with astored_vectorsbuffer. The SVS runtime API does not expose vector retrieval, so we keep a copy of added vectors. This is needed for IVF residual computation (by_residual = true) andcheck_compatible_for_merge(). When used as a coarse quantizer, the buffer holds onlynlistcentroids (trivial memory cost). Also clearsstored_vectorsonreset().Example factory string:
"IVF65536_SVSVamana32,SQ8"Differential Revision: D103568560