Skip to content

Support SVSVamana as IVF coarse quantizer via index_factory#5175

Open
mnorris11 wants to merge 1 commit intofacebookresearch:mainfrom
mnorris11:export-D103568560
Open

Support SVSVamana as IVF coarse quantizer via index_factory#5175
mnorris11 wants to merge 1 commit intofacebookresearch:mainfrom
mnorris11:export-D103568560

Conversation

@mnorris11
Copy link
Copy Markdown
Contributor

@mnorris11 mnorris11 commented May 4, 2026

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

@meta-cla meta-cla Bot added the CLA Signed label May 4, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 4, 2026

@mnorris11 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103568560.

@meta-codesync meta-codesync Bot changed the title Support SVSVamana as IVF coarse quantizer via index_factory Support SVSVamana as IVF coarse quantizer via index_factory (#5175) May 4, 2026
@mnorris11 mnorris11 force-pushed the export-D103568560 branch from b5ac782 to ea1c11a Compare May 4, 2026 17:29
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
@meta-codesync meta-codesync Bot changed the title Support SVSVamana as IVF coarse quantizer via index_factory (#5175) Support SVSVamana as IVF coarse quantizer via index_factory May 4, 2026
@mnorris11 mnorris11 force-pushed the export-D103568560 branch from ea1c11a to b32097b Compare May 4, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant