Source-linked AI summary

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

Yutong Gou, Jianyang Gao, Yuexuan Xu, Cheng Long

arXiv:2411.12229v1cs.DBcs.IR

TL;DR

Graph-based ANN search offers a strong time-accuracy trade-off, but random memory accesses and exact-distance computations remain costly, and NGT-QG retains re-ranking and graph-alignment limitations. SymphonyQG integrates RaBitQ with graph search, changes the search and index-building procedures, and refines the graph for FastScan. On tested real-world datasets, it establishes a new state of the art in time-accuracy trade-off.

  • Problem

    Graph-based ANN search requires costly random accesses to separately stored neighbor vectors and repeated exact-distance computations, while NGT-QG retains re-ranking and graph-alignment limitations.

    Source: §1 · p. 2
  • Method

    SymphonyQG integrates RaBitQ with graph search, avoids explicit re-ranking through exact-distance updates during search, accelerates index construction, and refines the graph to align with FastScan batches.

    Source: §1 · p. 2
  • Results

    At 95% recall (K=10), SymphonyQG achieves 1.5x-4.5x QPS versus the most competitive baselines across tested datasets and establishes a new state of the art in time-accuracy trade-off.

    Source: §1 · p. 3
  • Takeaways & Limitations

    The experiments report that SymphonyQG scales to datasets with 100 million vectors and that its index construction is at least 8x faster than NGT-QG on real-world datasets.

    Source: §1 · pp. 2–3

    SymphonyQG's relatively large index size limits its application scenarios, though compression algorithms such as dimension reduction can reduce memory consumption.

    Source: §6 · p. 14

Abstract

from arXiv · show

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.

1 INTRODUCTION

Graph-based ANN methods offer a strong time-accuracy trade-off, but random memory accesses and exact-distance computation constrain search, while NGT-QG leaves quantization and graph design incompletely integrated. SymphonyQG addresses these issues with changes to quantization, search, index construction, and graph structure.

1 INTRODUCTION

  • Graph-based ANN search is costly because it repeatedly accesses separately stored neighbor vectors and computes their exact distances.These accesses are random and unfriendly to cache.Source: §1 · p. 1
  • NGT-QG uses compact neighbor quantization codes and batched FastScan, but its PQ estimates can fail on some real-world datasets and its explicit re-ranking adds random accesses.Its graph structure can also leave FastScan with non-full batches; about 23% of vertices on Deep-1M have them.Source: §1 · p. 2
  • SymphonyQG combines RaBitQ with graph search, avoids explicit re-ranking through exact-distance updates during search, and uses multiple estimated distances to reduce the chance of missing true nearest neighbors.Its index construction is at least 8x faster than NGT-QG on real-world datasets, and graph refinement aligns vertex out-degrees with FastScan batches.Source: §1 · p. 2
  • SymphonyQG is presented as an ANN algorithm, alongside an open-source library with C++ header-only implementations and Python APIs.The library is intended to let researchers and practitioners evaluate and use the method with a few lines of Python code.Source: §1 · pp. 2–3
  • At 95% recall (K=10), SymphonyQG achieves 1.5x-4.5x QPS versus the most competitive baselines and 3.5x-17x QPS versus HNSWlib across tested datasets.The experiments also report scalability on two datasets with 100 million vectors.Source: §1 · p. 3

2 PRELIMINARIES

The preliminaries frame ANN as a search for better accuracy-efficiency trade-offs and introduce graph-based search, RaBitQ, and FastScan. Together, these provide the background for the paper’s quantized graph-search method.

2 PRELIMINARIES

  • The preliminaries define ANN as a way to seek better accuracy-efficiency trade-offs than exact nearest-neighbor search as vector databases grow.The paper focuses on in-memory queries, with vectors and indices stored in RAM.Source: §2.1 · p. 3

2.1 ANN and Graph-based Methods

  • Graph-based ANN builds a graph over data vectors and uses greedy beam search to explore a limited candidate set, with larger beam sizes trading higher accuracy for greater latency.The beam set retains up to n_b candidates; search returns its nearest vector when all beam-set vectors have been visited.Source: §2.1 · p. 3

2.2 RaBitQ and FastScan

  • RaBitQ uses quantization codes to estimate distances through an unbiased estimator with a theoretical error bound, and reports better empirical accuracy than PQ with shorter codes.Its normalized-vector formulation reduces distance estimation to estimating an inner product; FastScan batches code computations using SIMD-based look-up tables.Source: §2.2 · pp. 3–4

3 METHODOLOGY

SymphonyQG combines RaBitQ and FastScan with graph search, avoiding explicit re-ranking and adapting graph construction to FastScan’s batch size. Its stated metric scope is Euclidean space and cosine similarity.

3 METHODOLOGY

  • The query phase searches a graph index with FastScan and RaBitQ and avoids explicit re-ranking to reduce random memory accesses.The paper’s memory-access comparison also describes the method as avoiding random accesses during re-ranking.Source: §3 · p. 4
  • The FastScan implementation is largely based on Faiss.Source: §3 · p. 4
  • Graph construction uses the efficient search algorithm to accelerate candidate finding and prunes edges so each vertex’s degree is a multiple of FastScan’s batch size.The adaptive pruning rule makes each vertex’s edge count strictly a multiple of the batch size.Source: §3 · p. 4
  • SymphonyQG supports ANN search only for Euclidean space and cosine similarity because its RaBitQ quantizer is designed for those metrics.Source: §3 · p. 4

3.1 The Query Phase

The query phase combines vertex-centered RaBitQ codes with FastScan and an implicit re-ranking strategy. It uses repeated estimates to support search accuracy, and a sequential per-object layout to improve locality.

3.1.1 Searching on Graphs with FastScan and RaBitQ for Boosting Search Performance.

  • Neighbor vectors are normalized using the current vertex, and their RaBitQ codes are stored beside it for batched FastScan distance estimates.Because normalization varies by vertex, a vector that neighbors multiple vertices has different stored codes at each vertex.Source: §3.1.1 · pp. 4–5
  • Preparing FastScan look-up tables per visited vertex would limit their reuse to that vertex’s neighbors, so the method reformulates the computation to prepare query-time tables shareable across database vectors.The reformulation uses a computation independent of the normalization center.Source: §3.1.1 · p. 5

3.1.2 Avoiding Explicit Re-Ranking for Reducing Random Memory Accesses.

  • SymphonyQG implicitly re-ranks by reusing the exact distance computed for each visited vertex, returning the best exact-distance candidate without a final re-ranking pass.With its specialized data layout, this avoids extra random memory accesses for re-ranking.Source: §3.1.2 · p. 6
  • The search appends unvisited neighbors even when already present in the beam set, allowing multiple estimated distances per vector to reduce the chance that an overestimated true neighbor is missed.RaBitQ gives each estimate a 50% probability of underestimating a true nearest neighbor’s distance; its error bound also limits deviations for other vectors.Source: §3.1.2 · p. 6

3.1.3 Summary of Querying Algorithm.

  • Each object’s sequential memory block stores its raw vector, FastScan data, and graph neighbors, so visiting a vertex accesses a continuous memory segment.The algorithm repeatedly selects the unvisited vertex with the smallest estimated distance, computes its exact distance, then estimates its neighbors’ distances and returns the maintained nearest neighbor.Source: §3.1.3 · p. 6

3.1.4 Implementation Techniques.

  • Implementation techniques include prefetching the next vertex’s data, extending SIMD acceleration through the algorithm with AVX512 support, and using Fast Hadamard Transformation for faster random rotation.Fast JLT reduces random-rotation complexity from O(D^2) to O(D log D), where D is the vector dimension.Source: §3.1.4 · p. 7

3.2 The Index Phase

SymphonyQG accelerates graph-index construction with FastScan-based candidate generation, then refines graph degrees to match FastScan’s batch size. The resulting indexing is faster than NGT-QG, while graph refinement improves search performance on tested datasets.

3.2.1 Leveraging FastScan for Building Graph-based Indices Effi-

  • Indexing is at least 8x faster than NGT-QG, while the query-based construction is at least 2.5x faster than original NSG without harming search performance.The NSG comparison concerns the indexing algorithm described for candidate generation and pruning.Source: §3.2.1 · p. 7

3.2.2 Refining Graph-based indices towards Better Alignment with FastScan.

  • Adaptive pruning supplements vertices with fewer than R edges until each has exactly R out-edges, aligning graph degrees with FastScan batches.The pruning threshold is chosen by binary search and may differ across vertices.Source: §3.2.2 · pp. 7–8
  • Because FastScan estimates distances in batches, filling batches with edges does not increase distance-estimation time; refinement consistently improves search performance on tested datasets.The passage links the additional edges to a lower likelihood of missing the true nearest neighbor during graph search.Source: §3.2.2 · p. 8

3.2.1 Leveraging FastScan for Building Graph-based Indices Effi-

  • Each iteration prepares FastScan data, generates neighbor candidates with the querying algorithm, applies NSG pruning, and adjusts the graph; vertex operations are highly parallelizable.The graph is randomly initialized and adjusted for 3 or 4 iterations in practice.Source: §3.2.1 · p. 7, §3.2.2 · p. 8

3.3 The Summary

SymphonyQG combines RaBitQ and FastScan for graph search, avoids explicit re-ranking, and aligns graph degrees with FastScan batches. Experiments report improved time-accuracy trade-offs and faster indexing, alongside added memory use for neighbor codes.

  • For ANN queries, SymphonyQG uses RaBitQ and FastScan and avoids explicit re-ranking; its graph refinement aligns out-degrees with FastScan’s batch size.When candidates are fewer than the maximum out-degree, randomly selected neighbors can fill out-degrees to a multiple of 32.Source: §3.3 · p. 8
  • At 95% recall (K=10), SymphonyQG achieves 1.5x-4.5x QPS versus the most competitive baselines and 3.5x-17x versus HNSWlib on tested datasets.Source: §3.3 · p. 8
  • Indexing is at least 2.5x faster than NSG and at least 8x faster than NGT-QG.Source: §3.3 · p. 8
  • Neighbor-code storage adds D×R bits per vector; at R=32 or 64, this equals 1x or 2x the storage for raw vectors, respectively.Source: §3.3 · p. 8

4 EXPERIMENTS

Experiments compare SymphonyQG with optimized ANN libraries on six million-scale datasets and assess scalability on two 100-million-vector datasets. SymphonyQG leads the reported search comparisons, with ablations and parameter tests examining its components and settings.

4.1 Experimental Setup

  • Experiments benchmark six million-scale datasets against four optimized graph-based libraries, using QPS, recall, and average distance ratio to assess search trade-offs.The study also reports indexing time and memory footprint, and uses two 100-million-vector datasets for scalability evaluation.Source: §4.1 · pp. 8–9, §4 · p. 8

4.2.1 Performance Study.

  • At K=10, SymQG achieves 1.5x–4.5x QPS over the most competitive baselines at 95% recall across six datasets, and leads QPS-ADR at both K=10 and K=100.It also achieves 3.5x–17x QPS over HNSWlib at 95% recall.Source: Figure 4 · p. 9, Figure 5 · p. 10, §4.2.1 · p. 11

4.2.2 Scalability Study.

  • On Deep-100M and MSTuring-100M, SymQG delivers at least 2.5x QPS over OG-LVQ at 95% recall.NGT-QG could not build an index within one day using 1TB memory, while SymQG finished indexing within two hours; SymQG’s memory footprint was larger than other methods.Source: Figure 7 · p. 12, §4.2.2 · p. 12

4.2.3 Ablation Study.

  • SymQG builds indexes at least 2.5x faster than SymQG-NSG while retaining competitive or better query performance across six datasets.SymQG also has higher memory use than vanilla graph methods but lower memory use than NGT-QG, and its indexing time is comparable with HNSWlib.Source: §4.2.1 · p. 11, Table 3 · p. 11, §4.2.3 · p. 12
  • Removing multiple estimated distances or graph refinement reduces query performance; without refinement, vertex out-degrees are not aligned with FastScan’s batch size.With refinement, each vertex’s out-degree is guaranteed to be 32.Source: §4.2.3 · p. 12, Table 5 · p. 13

4.2.4 Parameter Study.

  • Search performance remains stable from three graph-construction iterations onward on two datasets, motivating a default of three or four iterations.Figure 9 reports QPS at 95% recall for K=10 across iteration counts.Source: Figure 9 · p. 13, §4.2.4 · p. 13

5 RELATED WORK

Related work spans four ANN method families, while SymphonyQG focuses on integrating quantization with graph-based indices. The paper places this goal alongside prior graph optimizations and identifies other similarity-search settings as outside its scope.

5 RELATED WORK

  • ANN methods are grouped into graph-based, quantization-based, hashing-based, and tree-based approaches, with graph methods offering state-of-the-art time-accuracy trade-offs on real-world datasets.Quantization estimates distances from compressed codes; hashing offers theoretical guarantees but often struggles with high practical recall and efficiency, while trees suffer in high dimensions.Source: §5 · p. 13
  • Prior work optimizes graph structure, distance computation, memory footprint, and index construction, while SymphonyQG targets tighter integration of quantization and graph indices.The paper leaves applying or adapting those optimization techniques to SymphonyQG as future work.Source: §5 · p. 13
  • The library focuses on Euclidean ANN, including Euclidean distance and cosine similarity; adapting its ideas to other similarity-search tasks is outside this paper’s scope.The authors note that such development involves non-trivial challenges and workloads.Source: §5 · p. 13

6 CONCLUSION AND DISCUSSION

SymphonyQG combines quantization and graph-search changes to improve the time-accuracy trade-off and indexing speed, while retaining memory and metric constraints.

6 CONCLUSION AND DISCUSSION

  • SymphonyQG establishes a new state-of-the-art time-accuracy trade-off and significantly speeds up index construction.Its approach combines RaBitQ, multiple estimated distances during graph search, and a graph structure refined for FastScan's in-batch computations.Source: §6 · p. 13
  • SymphonyQG stores duplicated quantization codes, increasing space consumption and potentially making it unsuitable for memory-limited scenarios.The paper names cloud functions as an example of such a scenario.Source: §6 · p. 13
  • RaBitQ limits SymphonyQG to Euclidean distance and cosine similarity; the paper identifies extending techniques to other metrics as future work.The conclusion also notes that compression, such as dimension reduction, can reduce memory consumption.Source: §6 · pp. 13–14

A INDEXING PARAMETERS FOR DIFFERENT METHODS

The appendix reports the indexing parameters selected for comparing methods' query performance.

A INDEXING PARAMETERS FOR DIFFERENT METHODS

B ABLATION STUDY OF PROPOSED TECHNIQUES

Across six moderate-scale datasets, SymphonyQG outperforms variants without multiple estimated distances or graph refinement under the tested settings.

B ABLATION STUDY OF PROPOSED TECHNIQUES

Loading 2411.12229v1…