-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVS v0.0.3 #19
Merged
Merged
SVS v0.0.3 #19
Conversation
This file contains 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
aguerreb
approved these changes
Feb 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me
marianotepper
approved these changes
Feb 7, 2024
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.
SVS 0.0.3 Release Notes
Highlighted Features
Turbo LVQ: A SIMD optimized layout for LVQ that can improve end-to-end search
performance for LVQ-4 and LVQ-4x8 encoded datasets.
Split-buffer: An optimization that separates the search window size used during greedy
search from the actual search buffer capacity. For datasets that use reranking (two-level
LVQ and LeanVec), this allows more neighbors to be passed to the reranking phase without
increasing the time spent in greedy search.
LeanVec dimensionality reduction is now included as
an experimental feature!
This two-level technique uses a linear transformation to generate a primary dataset with
lower dimensionality than full precision vectors.
The initial portion of a graph search is performed using this primary dataset, then uses
the full precision secondary dataset to rerank candidates.
Because of the reduced dimensionality, LeanVec can greatly accelerate index constructed
for high-dimensional datasets.
As an experimental feature, future changes to this API are expected.
However, the implementation in this release is sufficient to enable experimenting with
this technique on your own datasets!
New Dependencies
Required by LeanVec.
pysvs
(Python)Additions and Changes
Added the
LeanVecLoader
class as a dataset loader enabling use ofLeanVec dimensionality reduction.
The main constructor is shown below:
where:
loader
is the loader for the uncompressed dataset.leanvec_dims
is the target reduced dimensionality of the primary dataset.This should be less than
loader.dims
to provide a performance boost.primary
is the encoding to use for the reduced-dimensionality dataset.secondary
is the encoding to use for the full-dimensionality dataset.Valid options for
pysvs.LeanVecKind
are:float16, float32, lvq4, lvq8
.See the documentation for docstrings and an example.
Search parameters controlling recall and performance for the Vamana index are now set and
queried through a
pysvs.VamanaSearchParameters
configuration class. The layout of thisclass is as follows:
with
pysvs.SearchBufferConfig
defined byExample usage is shown below.
Split search buffer for the Vamana search index. This is achieved by using different
values for the
search_window_size
andsearch_buffer_capacity
fields of thepysvs.SearchBufferConfig
class described above.An index configured this way will maintain more entries in its search buffer while still
terminating search relatively early. For implementation like two-level LVQ that use
reranking, this can boost recall without significantly increasing the effective
search window size.
For uncompressed indexes that do not use reranking, split-buffer can be used to decrease
the search window size lower than the requested number of neighbors (provided the
capacity is at least the number of requested neighbors). This enables continued trading
of recall for search performance.
Added
pysvs.LVQStrategy
for picking between different flavors of LVQ. The valuesand meanings are given below.
Auto
: Let pysvs decide from among the available options.Sequential
: Use the original implementation of LVQ which bit-packs subsequent vectorelements sequentially in memory.
Turbo
: Use an experimental implementation of LVQ that permutes the packing ofsubsequent vector elements to permit faster distance computations.
The selection of strategy can be given using the
strategy
keyword argument ofpysvs.LVQLoader
and defaults topysvs.LVQStrategy.Auto
.Index construction and loading methods will now list the registered index specializations.
Assigning the
padding
keyword toLVQLoader
will now be respected when reloading apreviously saved LVQ dataset.
Changed the implementation of the greedy-search visited set to be effective when operating
in the high-recall/high-neighbors regime. It can be enabled with:
Experimental Features
Features marked as experimental are subject to rapid API changes, improvement, and
removal.
Added the
experimental_backend_string
read-only parameter topysvs.Vamana
to aid inrecording and debugging the backend implementation.
Introduced
pysvs.Vamana.experimental_calibrate
to aid in selecting the best runtimeperformance parameters for an index to achieve a desired recall.
This feature can be used as follows:
See the documentation for a more detailed explanation.
Deprecations
Versions
0.0.1
and0.0.2
ofVamanaConfigParameters
(the top-level configuration filefor the Vamana index) are deprecated. The current version is now
v0.0.3
. Older versionswill continue to work until the next minor release of SVS.
To upgrade, use the
convert_legacy_vamana_index
binary utility described below.The attribute
pysvs.Vamana.visisted_set_enabled
is deprecated and will be removed in thenext minor release of SVS. It is being replaced with
pysvs.Vamana.search_parameters
.The LVQ loader classes
pysvs.LVQ4
,pysvs.LVQ8
,pysvs.LVQ4x4
,pysvs.LVQ4x8
andpysvs.LVQ8x8
are deprecated in favor of a single classpysvs.LVQLoader
. This classhas similar arguments to the previous family, but encodes the number of bits for the
primary and residual datasets as run-time values.
For example,
Version
v0.0.2
of serialized LVQ datasets is broken, the current version is nowv0.0.3
. This change was made to facilitate a canonical on-disk representation of LVQ.Goind forward, previously saved LVQ formats can be reloaded using different runtime
alignments and different packing strategies without requiring whole dataset recompression.
Any previously saved datasets will need to be regenerated from uncompressed data.
Build System Changes
Building
pysvs
usingcibuildwheel
now requires a custom docker container with MKL.To build the container, run the following commands:
cd ./docker/x86_64/manylinux2014/ ./build.sh
libsvs
(C++)Changes
Added
svs::index::vamana::VamanaSearchParameters
andsvs::index::vamana::SearchBufferConfig
. The latter contains parameters for the searchbuffer sizing while the former groups all algorithmic and performance parameters of search
together in a single class.
API addition of
get_search_parameters()
andset_search_parameters()
tosvs::Vamana
and
svs::DynamicVamana
as the new API for getting and setting all search parameters.Introducing split-buffer for the search buffer (see description in the Python section)
to potentially increase recall when using reranking.
Overhauled LVQ implementation, adding an additional template parameter to
lvq::CompressedVectorBase
and friends. This parameter assumes the following types:lvq::Sequential
: Store dimension encodings sequentially in memory. This correspondsto the original LVQ implementation.
lvq::Turbo<size_t Lanes, size_t ElementsPerLane>
: Use a SIMD optimized format,optimized to use
Lanes
SIMD lanes, storingElementsPerLane
. Selection of theseparameters requires some knowledge of the target hardware and appropriate overloads
for decompression and distance computation.
Accelerated methods require AVX-512 and are:
Turbo<16, 8>
(targeting AVX 512)
Turbo<16, 4>
.Added the following member function to
svs::lib::LoadContext
:Context-free saveable/loadable classes can now be saved/loaded directly from a TOML file
without a custom directory using
svs::lib::save_to_file
andsvs::lib::load_from_file
.Distance functors can prevent missing
svs::distance::maybe_fix_arguments()
calls intohard errors by defining
in the class definition. Without this,
svs::distance::maybe_fix_argument()
will SFINAEaway if a suitable
fix_argument()
member function is not found (the original behavior).The namespace
svs::lib::meta
has been removed. All entities previously defined thereare now in
svs::lib
.Added a new Database file type. This file type will serve as a prototype for SSD-style
data base files and is implemented in a way that can be extended by concrete
implementations.
This file has magic number
0x26b0644ab838c3a3
and contains a 16-byte UUID, 8-byte kindtag, and 24-byte version number. The 8-byte kind is the extension point that concrete
implementations can use to define their own concrete implementations.
Changed the implementation of the greedy search visited set to
svs::index::vamana::VisitedFilter
. This is a fuzzy associative data structure that mayreturn false negatives (marking a neighbor as not visited when it has been visited) but
has very fast lookups.
When operating in the very high-recall/number of neighbors regime, enabling the visited
set can yield performance improvements.
It can be enabled with the following code:
Deprecations
visited_set_enabled
,enable_visited_set
, anddisable_visited_set
forsvs::Vamana
andsvs::DynamicVamana
are deprecated and willbe removed in the next minor release of SVS.
svs::index::vamana::VamanaConfigParameters
has been renamed tosvs::index::vamana::VamanaIndexParameters
and its serialization version has beenincremented to
v0.0.3
. Versions 0.0.1 and 0.0.2 will be compatible until the next minorrelease of SVS. Use the binary utility
convert_lebacy_vamana_index_config
to upgrade.v0.0.2
ofsvs::quantization::lvq::LVQDataset
has been upgraded tov0.0.3
ina non-backward-compatible way. To facilitate a canonical on-disk representation of LVQ.
Binary Utilities
Added
convert_legacy_vamana_index_config
to upgrade Vamana index configuration filefrom version 0.0.1 or 0.0.2 to 0.0.3.
Removed
generate_vamana_config
which created a Vamana index config file from extremelylegacy formats.
Testing
benchmarking framework.
Build System
The CMake variables were added.
SVS_EXPERIMENTAL_LEANVEC
: Enable LeanVec support, which requires MKL as a dependency.OFF
ON
SVS_EXPERIMENTAL_CUSTOM_MKL
: Use MKL's custom shared object builder to create a minimallibrary to be installed with SVS. This enables relocatable builds to systems that do not
have MKL installed and removes the need for MKL runtime environment variables.
With this feature disabled, SVS builds against the system's MKL.
OFF
ON