Table of Contents
Fetching ...

SymphonyQG: Towards Symphonious Integration of Quantization and Graph for Approximate Nearest Neighbor Search

Yutong Gou, Jianyang Gao, Yuexuan Xu, Cheng Long

TL;DR

S symphonious integration of quantization and graph is presented, which achieves more symphonious integration of quantization and graph and establishes the new state-of-the-art in terms of the time-accuracy trade-off.

Abstract

Approximate nearest neighbor (ANN) search in high-dimensional Euclidean space has a broad range of applications. Among existing ANN algorithms, graph-based methods have shown superior performance in terms of the time-accuracy trade-off. However, they face performance bottlenecks due to the random memory accesses caused by the searching process on the graph indices and the costs of computing exact distances to guide the searching process. To relieve the bottlenecks, a recent method named NGT-QG makes an attempt by integrating quantization and graph. It (1) replicates and stores the quantization codes of a vertex's neighbors compactly so that they can be accessed sequentially, and (2) uses a SIMD-based implementation named FastScan to efficiently estimate distances based on the quantization codes in batch for guiding the searching process. While NGT-QG achieves promising improvements over the vanilla graph-based methods, it has not fully unleashed the potential of integrating quantization and graph. For instance, it entails a re-ranking step to compute exact distances at the end, which introduces extra random memory accesses; its graph structure is not jointly designed considering the in-batch nature of FastScan, which causes wastes of computation in searching. In this work, following NGT-QG, we present a new method named SymphonyQG, which achieves more symphonious integration of quantization and graph (e.g., it avoids the explicit re-ranking step and refines the graph structure to be more aligned with FastScan). Based on extensive experiments on real-world datasets, SymphonyQG establishes the new state-of-the-art in terms of the time-accuracy trade-off.

SymphonyQG: Towards Symphonious Integration of Quantization and Graph for Approximate Nearest Neighbor Search

TL;DR

S symphonious integration of quantization and graph is presented, which achieves more symphonious integration of quantization and graph and establishes the new state-of-the-art in terms of the time-accuracy trade-off.

Abstract

Approximate nearest neighbor (ANN) search in high-dimensional Euclidean space has a broad range of applications. Among existing ANN algorithms, graph-based methods have shown superior performance in terms of the time-accuracy trade-off. However, they face performance bottlenecks due to the random memory accesses caused by the searching process on the graph indices and the costs of computing exact distances to guide the searching process. To relieve the bottlenecks, a recent method named NGT-QG makes an attempt by integrating quantization and graph. It (1) replicates and stores the quantization codes of a vertex's neighbors compactly so that they can be accessed sequentially, and (2) uses a SIMD-based implementation named FastScan to efficiently estimate distances based on the quantization codes in batch for guiding the searching process. While NGT-QG achieves promising improvements over the vanilla graph-based methods, it has not fully unleashed the potential of integrating quantization and graph. For instance, it entails a re-ranking step to compute exact distances at the end, which introduces extra random memory accesses; its graph structure is not jointly designed considering the in-batch nature of FastScan, which causes wastes of computation in searching. In this work, following NGT-QG, we present a new method named SymphonyQG, which achieves more symphonious integration of quantization and graph (e.g., it avoids the explicit re-ranking step and refines the graph structure to be more aligned with FastScan). Based on extensive experiments on real-world datasets, SymphonyQG establishes the new state-of-the-art in terms of the time-accuracy trade-off.

Paper Structure

This paper contains 25 sections, 4 equations, 10 figures, 6 tables, 2 algorithms.

Figures (10)

  • Figure 1: An illustration of data layout. As illustrated, quantization codes of the red vertex's neighbors are packed and stored together at the red vertex's side. The same applies to the green vertex.
  • Figure 2: Data layout and memory access pattern of vanilla graph-based methods, NGT-QG and our method. As illustrated, vanilla graph-based methods introduce plenty of random memory accesses when checking a vertex's neighbors in each iteration of searching the graph since the neighbors could be stored at different places. In NGT-QG, the neighbors of each vertex are stored sequentially at the vertex's side and they can be sequentially scanned for estimating their distances with FastScan, but it entails a re-ranking stage, which computes the exact distances of those candidates and incurs random memory accesses. Compared with NGT-QG, our method avoids the explicit re-ranking stage - instead it conducts implicit re-ranking (details will be introduced in Section \ref{['subsec: greedy search']}) and thus it has no random memory accesses for re-ranking.
  • Figure 3: Refining a graph towards better alignment with FastScan by supplementing edges. Here, we assume $R$ and the batch size are 5 for the simplicity of illustration. The out-degree of the green vertex is only 3 in the original graph because the original pruning rule is too restrictive. After supplementing edges with an adaptive pruning rule, its out-degree is guaranteed to be 5. For the red vertex, its out-degree is already aligned with the batch size, so we do not need to supplement edges for this vertex.
  • Figure 4: Comparison of all methods on 6 real-world datasets (QPS-Recall). The missing curve of a certain method indicates that it fails to achieve at least 80% recall on the dataset.
  • Figure 5: Comparison of all methods on 6 real-world datasets (QPS-Ave Distance Ratio). The missing curve of a certain method indicates that it fails to achieve at least 1.004 average distance ratio on the dataset.
  • ...and 5 more figures