Approximate Nearest Neighbor Search (ANNS) plays a critical role in applications such as search engines, recommender systems, and RAG for LLMs. Vector quantization (VQ), a crucial technique for ANNS, is commonly used to reduce space overhead and accelerate distance computations. However, despite significant research advances, state-of-the-art VQ methods still face challenges in balancing encoding efficiency and quantization accuracy. To address these limitations, we propose a novel VQ method called SAQ. To improve accuracy, SAQ employs a new dimension segmentation technique to strategically partition PCA-projected vectors into segments along their dimensions. By prioritizing leading dimension segments with larger magnitudes, SAQ allocates more bits to high-impact segments, optimizing the use of the available space quota. An efficient dynamic programming algorithm is developed to optimize dimension segmentation and bit allocation, ensuring minimal quantization error. To speed up vector encoding, SAQ devises a code adjustment technique to first quantize each dimension independently and then progressively refine quantized vectors using a coordinate-descent-like approach to avoid exhaustive enumeration. Extensive experiments demonstrate SAQ's superiority over classical methods (e.g., PQ, PCA) and recent state-of-the-art approaches (e.g., LVQ, Extended RabitQ). SAQ achieves up to 80% reduction in quantization error and accelerates encoding speed by over 80x compared to Extended RabitQ.
翻译:近似最近邻搜索(ANNS)在搜索引擎、推荐系统及大语言模型的检索增强生成等应用中至关重要。向量量化(VQ)作为ANNS的核心技术,常用于降低存储开销并加速距离计算。然而,尽管研究已取得显著进展,现有前沿VQ方法仍在编码效率与量化精度之间的平衡上面临挑战。为突破这些局限,我们提出了一种名为SAQ的新型向量量化方法。在精度提升方面,SAQ采用创新的维度分割技术,将PCA投影后的向量沿维度方向进行策略性分段。通过优先处理幅值较大的主导维度段,SAQ为高影响力段分配更多比特,从而优化有限空间配额的使用。我们开发了一种高效的动态规划算法,以最小化量化误差为目标,同步优化维度分割与比特分配。在编码加速方面,SAQ设计了码本调整技术:先对各维度进行独立量化,再采用类坐标下降法逐步优化量化向量,避免穷举搜索。大量实验证明,SAQ在量化误差上较经典方法(如PQ、PCA)和近期前沿方法(如LVQ、Extended RabitQ)均具有显著优势。相较于Extended RabitQ,SAQ最高可降低80%的量化误差,并将编码速度提升超过80倍。