Abstract
Vector quantization (VQ) based ANN indexes, such as Inverted File System (IVF) and Product Quantization (PQ), have been widely applied to embedding based document retrieval thanks to the competitive time and memory efficiency. Originally, VQ is learned to minimize the reconstruction loss, i.e., the distortions between the original dense embeddings and the reconstructed embeddings after quantization. Unfortunately, such an objective is inconsistent with the goal of selecting ground-truth documents for the input query, which may cause severe loss of retrieval quality. Recent works identify such a defect, and propose to minimize the retrieval loss through contrastive learning. However, these methods intensively rely on queries with ground-truth documents, whose performance is limited by the insufficiency of labeled data. In this paper, we propose Distill-VQ, which unifies the learning of IVF and PQ within a knowledge distillation framework. In Distill-VQ, the dense embeddings are leveraged as "teachers", which predict the query's relevance to the sampled documents. The VQ modules are treated as the "students", which are learned to reproduce the predicted relevance, such that the reconstructed embeddings may fully preserve the retrieval result of the dense embeddings. By doing so, Distill-VQ is able to derive substantial training signals from the massive unlabeled data, which significantly contributes to the retrieval quality. We perform comprehensive explorations for the optimal conduct of knowledge distillation, which may provide useful insights for the learning of VQ based ANN index. We also experimentally show that the labeled data is no longer a necessity for high-quality vector quantization, which indicates Distill-VQ's strong applicability in practice.
Introduction: The Objective Mismatch in Vector Quantization
In large-scale Embedding-Based Retrieval (EBR), speed and memory efficiency are paramount. Engineers typically employ Vector Quantization (VQ) techniques like Inverted File Systems (IVF) and Product Quantization (PQ) to compress high-dimensional dense embeddings into compact discrete codes. Traditionally, these VQ methods are trained to minimize reconstruction loss—the Euclidean distance between the original dense vector and its quantized approximation.
However, a fundamental "objective mismatch" exists: minimizing reconstruction error does not necessarily maximize retrieval accuracy. A small distortion in vector space can lead to significant changes in the final ranked list of documents. While recent "retrieval-oriented" methods attempt to minimize retrieval loss via contrastive learning, they are often limited by a heavy reliance on large-scale labeled query-document pairs, which are expensive to obtain.
The Distill-VQ Framework
Distill-VQ addresses these limitations by reframing VQ optimization as a knowledge distillation (KD) problem. Instead of relying on ground-truth labels, it uses the original high-quality dense embeddings as a "teacher" to guide the learning of the quantized "student" embeddings.
Architecture and Process
The framework consists of four main stages:
- Encoding: A fixed document encoder generates dense embeddings ($v_d$).
- Quantization: The document embeddings are processed through IVF centroids ($O$) and PQ codebooks ($C$) to produce reconstructed embeddings ($\hat{v}_d$ and $\hat{u}_d$).
- Scoring: For a given query, the teacher (dense embeddings) and the student (quantized embeddings) calculate relevance scores for a set of sampled documents.
- Distillation: The student is trained to mimic the teacher's ranking distribution using similarity functions like ListNet or KL-Divergence.
Ranking Order Invariance
A key insight of Distill-VQ is focusing on ranking order rather than exact score matching. By using listwise distillation losses, the model ensures that the compressed vectors preserve the relative importance of documents as determined by the dense teacher. This approach is more robust and directly aligns with the ultimate goal of retrieval.
Efficient Sampling
To facilitate training on massive unlabeled datasets, Distill-VQ employs a hybrid sampling strategy. It combines "Top-K" documents (the most relevant according to the teacher) with "In-Batch" negatives. This provides the student with highly informative training signals from the most critical regions of the embedding space without requiring explicit labels.
Experimental Evaluation
The researchers evaluated Distill-VQ on two major benchmarks: MS MARCO Passage Retrieval (~8.8M passages) and Natural Questions (NQ) (~21M passages).
Key Findings
- State-of-the-Art Accuracy: On MS MARCO, Distill-VQ achieved an MRR@10 of 0.3607, surpassing existing SOTA methods like JPQ and RepCONC.
- Label-Free Effectiveness: Remarkably, Distill-VQ performs exceptionally well even without any labeled data. The "soft" signals from the teacher's rankings are often more informative than binary ground-truth labels.
- High Compression Performance: In scenarios with extreme compression (e.g., 4x8 codebooks), Distill-VQ maintained significantly higher recall and MRR than traditional baselines, demonstrating its robustness.
- Search Efficiency: These accuracy gains were achieved while searching only a tiny fraction (e.g., 1%) of the total index, enabling massive speedups over brute-force search.
Conclusion
Distill-VQ represents a significant shift in how vector quantization is optimized for retrieval. By moving from reconstruction-based or label-hungry contrastive objectives to a knowledge distillation framework, it enables the creation of highly accurate, compressed indexes using entirely unlabeled data. This makes the method highly applicable to real-world scenarios where massive document collections are available but labeled queries are scarce.
Summary updated