Abstract
Vector quantization is a cornerstone of large-scale similarity search, enabling the compression of high-dimensional embeddings into compact codes. Traditional Residual Quantization (RQ) methods rely on fixed codebooks that fail to account for the specific context of previous compression steps. We present QINCo (Quantization with Implicit Neural Codebooks), a novel approach that dynamically generates specialized codebooks using a neural network conditioned on partial data reconstructions. By adapting the codebook to the residual distribution on the fly, QINCo achieves state-of-the-art retrieval accuracy, with 12-byte codes outperforming previous 16-byte state-of-the-art methods across multiple benchmarks.
Introduction
In modern machine learning, data such as text, images, and user profiles are typically represented as dense vector embeddings. To facilitate efficient search through billions of these vectors—essential for recommendation systems and search engines—they must be compressed into short, fixed-length codes.
Residual Quantization (RQ) is a widely adopted technique for this task. RQ operates iteratively: it quantizes a vector, calculates the error (the "residual") between the original and the quantized version, and then quantizes that residual in the subsequent step. However, standard RQ is limited by its use of a fixed codebook at each step. Because the distribution of residual errors is highly dependent on the codewords selected in previous steps, an ideal system would utilize a unique, specialized codebook for every possible sequence of past choices. Given that the number of possible paths grows exponentially with each step, explicit storage of these codebooks is computationally impossible. QINCo addresses this "exponential explosion" by modeling these codebooks implicitly.
Methods: Implicit Neural Codebooks
QINCo (Quantization with Implicit Neural Codebooks) replaces static codebooks with a dynamic neural generation process. Instead of explicitly storing billions of potential codebooks, QINCo employs a neural network to predict the optimal codebook for the current residual distribution.
Dynamic Codebook Generation
At each quantization step, the QINCo neural network takes two primary inputs:
- A base codebook (a set of prototype vectors).
- The partial reconstruction of the vector from all preceding steps.
The network then outputs a specialized codebook tailored specifically to the current residual. This approach ensures that the quantization cells are always optimized for the specific region of the vector space where the residual resides.
Scalability and Search
To make QINCo practical for billion-scale datasets, the authors integrate it with an Inverted File Index (IVF) and an approximate linear decoder. This hybrid architecture allows the system to rapidly narrow down billions of vectors to a shortlist of candidates, which are then re-ranked with high precision using the full QINCo decoder. This ensures that the computational overhead of the neural network does not compromise search latency.
Experimental Evaluation
The performance of QINCo was evaluated across several high-dimensional benchmarks, including Deep1B (image embeddings), BigANN (SIFT descriptors), and FB-ssnpp (copy detection). The authors also introduced Contriever1M, a dataset consisting of 21 million text passage embeddings from Wikipedia.
Key Results
- State-of-the-Art Accuracy: QINCo significantly outperforms previous neural and traditional quantizers. On the BigANN1M dataset, QINCo achieved a Recall@1 of 71.9% using 16-byte codes, a substantial leap over the previous best of 59.3% (UNQ).
- Superior Compression Ratios: The efficiency of the implicit codebooks allows QINCo to achieve higher accuracy with less memory. Specifically, QINCo’s 12-byte codes outperform the 16-byte codes of previous state-of-the-art methods on both BigANN1M and Deep1M.
- Billion-Scale Efficiency: When paired with an IVF index, QINCo maintains high throughput (hundreds to thousands of queries per second) while providing a 10 to 20 percentage point improvement in recall over standard IVF-RQ.
Discussion and Insights
Transforming Codebooks vs. Data
Unlike previous neural quantization methods (such as UNQ or DeepQ) that attempt to transform the input data to fit a fixed quantizer, QINCo transforms the codebook to fit the data. This distinction is critical; it helps QINCo avoid "posterior collapse," a common failure mode where the model maps all data to a single centroid. Furthermore, this design simplifies training by removing the need for complex gradient estimation techniques like Gumbel-Softmax.
Dynamic Multi-Rate Encoding
QINCo naturally functions as a multi-rate codec. A model trained for 16-byte codes can be truncated to 8-byte codes during inference without a loss in performance relative to a model trained specifically for 8 bytes. This flexibility simplifies deployment in environments with varying memory constraints.
Limitations and Future Work
The primary trade-off in QINCo is encoding latency. The sequential nature of the neural network passes makes encoding computationally more intensive than traditional methods like Optimized Product Quantization (OPQ). While decoding and searching are efficient enough for CPU deployment, encoding typically requires GPU acceleration.
Future research directions include applying implicit neural codebooks to other schemes like Product Quantization (PQ), exploring beam search during the encoding phase to further enhance accuracy, and extending the method to the direct compression of raw media such as audio and video.
Summary updated