[DRAFT][Feature] Add scalar quantization support for vector extension#28
Open
rahul-iyer wants to merge 1 commit into
Open
[DRAFT][Feature] Add scalar quantization support for vector extension#28rahul-iyer wants to merge 1 commit into
rahul-iyer wants to merge 1 commit into
Conversation
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.
Adds scalar quantization support for HNSW vector indexes behind the quantization option.
This PR supports:
Dot product with quantization is rejected for now because the quantized metric path currently supports
L2/L2SQ/Cosine-style scoring.
Behavior
Without quantization, HNSW continues to use the existing full-precision float embedding path.
With quantization enabled:
Benchmark
Dataset: real-world OpenAI/DBPedia-style benchmark subset
Metric: recall@10 against full-precision ground truth
Query workload: repeated ANN search over loaded benchmark DB
With Cache Embeddings = true
base load=7.145s index=72.196s ingest=79.342s ms/query=19.812 db_mib=606.4 peak_rss_mib(load/index/query/acc)=9140.5/1366.2/751.1/725.3 recall@10=0.9960
sq8 load=6.678s index=10.762s ingest=17.439s ms/query=15.544 db_mib=606.5 peak_rss_mib(load/index/query/acc)=9138.5/812.1/823.0/803.0 recall@10=0.9460
sq16 load=4.338s index=13.876s ingest=18.215s ms/query=16.214 db_mib=606.4 peak_rss_mib(load/index/query/acc)=9599.7/883.7/896.1/876.2 recall@10=0.9950
Observations
SQ8 gives the largest indexing speedup and lower query latency, with an expected recall tradeoff.
SQ16 keeps recall very close to full precision while still reducing index build time substantially.
The biggest win is index construction time:
Correctness Notes
This PR also fixes several issues found during testing:
Quantized cache invalidation is currently coarse-grained: mutations invalidate the full quantized cache.
A future improvement should make this transaction-aware and row/version based.