Abstract: Nowadays, data is represented by vectors. Retrieving those vectors, among millions and billions, that are similar to a given query is a ubiquitous problem, known as similarity search, of relevance for a wide range of applications. Graph-based indices are currently the best performing techniques for billion-scale similarity search. However, their random-access memory pattern presents challenges to realize their full potential. In this work, we present new techniques and systems for creating faster and smaller graph-based indices. To this end, we introduce a novel vector compression method, Locally-adaptive Vector Quantization (LVQ), that uses per-vector scaling and scalar quantization to improve search performance with fast similarity computations and a reduced effective bandwidth, while decreasing memory footprint and barely impacting accuracy. LVQ, when combined with a new high-performance computing system for graph-based similarity search, establishes the new state of the art in terms of performance and memory footprint. For billions of vectors, LVQ outcompetes the second-best alternatives: (1) in the low-memory regime, by up to 20.7x in throughput with up to a 3x memory footprint reduction, and (2) in the high-throughput regime by 5.8x with 1.4x less memory.
Introduction
In the modern landscape of Large Language Models (LLMs) and massive recommendation engines, data is increasingly represented as high-dimensional vectors, or embeddings. Finding the "nearest neighbor" to a query vector among billions of entries—a process known as similarity search—is the fundamental engine behind image generation, semantic search, and personalized advertising.
While graph-based indices are currently the gold standard for accuracy in this domain, they face two significant hurdles: memory bloat and the "memory wall." Storing billions of high-dimensional vectors in RAM is prohibitively expensive, and the random-access nature of graph traversal defeats standard hardware prefetchers. This leads to bottlenecks where the CPU remains idle while waiting for data from RAM. To address these challenges, we introduce Locally-adaptive Vector Quantization (LVQ) and a high-performance system implementation, OG-LVQ.
Methodology
Locally-adaptive Vector Quantization (LVQ)
Traditional quantization methods typically attempt to fit all data into a global "box," which often leads to significant precision loss. LVQ adopts a more granular approach. First, it centers the data by subtracting the global mean, which tightens the distribution of vector values. Second, it calculates unique scaling bounds for each individual vector.
By using per-vector bounds, LVQ ensures that the available bits (either 8-bit or 4-bit integers) are utilized to represent the most relevant range of values for that specific vector. For applications requiring extreme precision, we employ a two-level quantization strategy that stores a "compressed residual"—the error remaining after the first round of compression—to refine results during a final re-ranking step.
System-Level Optimizations
To fully realize the benefits of LVQ, we developed the OG-LVQ library, which incorporates several deep system-level optimizations:
- Custom Software Prefetching: Because hardware prefetchers cannot predict the random jumps inherent in graph traversal, we implemented custom instructions to "look ahead" and pull neighbor vectors into the cache before they are required.
- Huge Pages: By utilizing 1GB "huge pages," we reduce the overhead associated with translating virtual addresses to physical ones, a common performance killer in large-scale database operations.
- AVX Acceleration: We leveraged SIMD (Single Instruction, Multiple Data) instructions to perform distance calculations on compressed integers, achieving speeds up to 2.12x faster than standard floating-point operations.
Experimental Evaluation
We evaluated our system against industry-standard benchmarks, including GIST-1M, SIFT-1M, and the billion-scale Deep-1B dataset. Additionally, we introduced DPR-768-10M, a new benchmark consisting of 10 million 768-dimensional embeddings generated by modern Dense Passage Retrieval (DPR) models, reflecting the high-dimensional workloads typical of contemporary AI applications.
Performance Results
Our results demonstrate that reducing vector size through compression directly translates to higher throughput by maximizing available memory bandwidth. Compared to leading methods like Vamana (DiskANN), HNSWlib, and Google’s ScaNN, OG-LVQ showed:
- Low-Memory Regime: On the Deep-1B dataset, OG-LVQ provided 20.7x higher throughput while using 3x less memory than the next-best alternative.
- High-Throughput Regime: It outperformed the fastest existing methods by 5.8x while maintaining a 1.4x smaller memory footprint.
- Accuracy: Despite heavy compression, LVQ maintains high recall, often matching the accuracy of full-precision vector searches.
Conclusion and Future Work
LVQ and the OG-LVQ system establish a new state of the art for billion-scale similarity search by effectively bypassing the memory wall. While these results are transformative for static datasets, future research will focus on adapting LVQ for dynamic indices where vectors are constantly added or deleted. Furthermore, we plan to explore the integration of dimensionality reduction techniques like PCA and investigate intra-query parallelism to further accelerate single-query performance across multiple CPU cores.
Summary updated