Inferensys

Glossary

Asymmetric Distance Computation (ADC)

Asymmetric Distance Computation (ADC) is a technique used with Product Quantization where distances are calculated between an uncompressed query vector and compressed database vectors, providing more accurate approximations than symmetric computation.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
VECTOR QUERY OPTIMIZATION

What is Asymmetric Distance Computation (ADC)?

A core technique in vector database indexing that enables fast, accurate similarity search on compressed data.

Asymmetric Distance Computation (ADC) is a distance approximation technique used with Product Quantization (PQ) where the distance is calculated between an uncompressed (full-precision) query vector and compressed database vectors. This asymmetry yields a more accurate approximation than symmetric computation between two compressed vectors. The method is fundamental to the IVFADC index in libraries like Faiss, enabling high-recall nearest neighbor search at a fraction of the memory cost of storing full vectors.

ADC operates by pre-computing a lookup table of distances between the uncompressed query subvectors and all centroids in the PQ codebook for each subspace. The approximate distance to a compressed database vector is then efficiently computed by summing the looked-up values for its assigned centroid IDs. This provides a superior distance estimation compared to symmetric lookup, directly improving search recall without sacrificing the memory efficiency and speed gains of vector compression.

VECTOR QUERY OPTIMIZATION

Key Characteristics of ADC

Asymmetric Distance Computation (ADC) is a core technique for accelerating similarity search in compressed vector spaces. It is primarily used with Product Quantization to enable fast, approximate distance calculations with higher accuracy than symmetric alternatives.

01

Asymmetry in Distance Calculation

The defining feature of ADC is the asymmetric nature of its distance computation. Unlike symmetric methods, ADC calculates distances between an uncompressed query vector and compressed database vectors. This asymmetry is crucial because the original, high-fidelity query vector is compared against a quantized approximation of the database vector. This preserves more information from the query side, leading to a more accurate distance approximation than if both vectors were compressed (symmetric computation).

02

Integration with Product Quantization

ADC is not a standalone compression method; it is the distance calculation protocol used with Product Quantization (PQ). In this system:

  • Database vectors are compressed offline using PQ, splitting them into subvectors and replacing each with a codebook centroid index.
  • At query time, the uncompressed query vector is split into the same subvectors.
  • Distances are computed by looking up pre-computed distance tables between the query's subvectors and the PQ codebook centroids, then summing these partial distances. This lookup-table approach is the engine of ADC's speed.
03

Memory Efficiency vs. Query Accuracy Trade-off

ADC enables a favorable operational trade-off. By storing only compact PQ codes (e.g., 8 bytes per vector instead of 128 bytes for a full-precision vector), it achieves massive memory footprint reduction, often 10x or more. This allows billion-scale vector datasets to reside in RAM. The cost is a loss in distance calculation precision versus an exhaustive search. However, ADC's asymmetric design minimizes this accuracy loss compared to symmetric PQ, making it a preferred choice for high-recall, memory-constrained applications.

04

Use in Multi-Stage Indexes (IVFADC)

ADC is commonly deployed in hybrid, multi-stage indexes to balance speed and accuracy. The most prominent example is the IVFADC index in Facebook AI Similarity Search (Faiss). This architecture combines:

  1. A coarse quantizer (Inverted File, IVF) that narrows the search to a subset of promising database vectors.
  2. A fine quantizer using PQ with ADC to compute precise distances within that subset. This structure provides fast candidate retrieval via IVF and accurate re-ranking via ADC, making it a production-standard for large-scale similarity search.
05

Computational Overhead at Query Time

While ADC saves memory, it introduces computational overhead during a query. The system must perform multiple table lookups and additions—one for each PQ subspace—to reconstruct the approximate distance. This is more expensive than computing a simple dot product or L2 distance between two full vectors. However, this cost is fixed and predictable (O(m) for m subspaces), and is dramatically offset by the reduced number of comparisons needed due to efficient indexing structures like IVF.

06

Contrast with Symmetric Distance Computation (SDC)

ADC's advantages are clearest when contrasted with Symmetric Distance Computation (SDC). In SDC, both the query and database vectors are compressed using the same PQ codebooks before distance calculation. This double compression amplifies quantization error, leading to less accurate distance estimates. ADC avoids this by keeping the query in its original, high-dimensional space. The trade-off is that SDC can have even faster query times if its distance tables can be precomputed, but this is typically at a significant cost to search recall and accuracy.

QUANTIZATION DISTANCE CALCULATION

ADC vs. Symmetric Distance Computation (SDC)

A comparison of the two primary methods for calculating distances when using Product Quantization (PQ) for vector compression, highlighting the trade-offs between accuracy and computational cost.

Feature / MetricAsymmetric Distance Computation (ADC)Symmetric Distance Computation (SDC)

Core Definition

Calculates distance between an uncompressed (full-precision) query vector and compressed database vectors.

Calculates distance between two compressed vectors (both query and database vectors are quantized).

Query Vector Representation

Uncompressed, full-precision (e.g., 32-bit float).

Compressed using the same Product Quantization codebooks as the database.

Distance Calculation Accuracy

Higher accuracy. Avoids quantization error on the query side, leading to better approximations of true distances.

Lower accuracy. Suffers from double quantization error, as both vectors in the comparison are approximated.

Pre-Computation Potential

Low. Distances must be computed at query time via lookup table (LUT) operations, as the query is unique.

High. Distances between compressed codes can be fully pre-computed into a static lookup table, enabling extremely fast table lookups.

Memory Overhead at Query Time

Moderate. Must store and compute a distance lookup table (LUT) for the specific query subvectors.

Minimal. Uses a single, static distance table pre-computed for all possible codebook centroid pairs.

Typical Query Latency

Higher than SDC due to on-the-fly LUT computation, but lower than brute-force search on uncompressed data.

Extremely low. Distance reduces to a single lookup in a pre-computed matrix of centroid distances.

Primary Use Case

Standard vector search where query accuracy is paramount and queries are unique. The default mode for IVFADC and similar indices.

Extremely high-throughput scenarios where queries are also quantized and some accuracy loss is acceptable (e.g., batch processing, re-ranking stages).

Impact on Recall@K

Higher recall for a given compression level and candidate list size.

Lower recall compared to ADC at equivalent settings, due to query-side quantization error.

IMPLEMENTATION

ADC in Libraries and Databases

Asymmetric Distance Computation (ADC) is a core technique for efficient similarity search, implemented in major vector databases and libraries to balance accuracy with performance.

ASYMETRIC DISTANCE COMPUTATION (ADC)

Frequently Asked Questions

Asymmetric Distance Computation (ADC) is a core technique in vector database optimization that enables fast and accurate similarity search on compressed data. These questions address its mechanics, trade-offs, and role in modern retrieval systems.

Asymmetric Distance Computation (ADC) is a distance approximation technique used with Product Quantization (PQ) where distances are calculated between an uncompressed (full-precision) query vector and compressed database vectors. It works by splitting both the query and database vectors into subvectors. A codebook of centroids is learned for each subspace. During search, the uncompressed query subvectors are compared to all centroids in each codebook, and the resulting partial distance lookup tables are pre-computed. The distance to any compressed database vector—which is stored as a tuple of centroid indices—is then approximated by summing the pre-computed partial distances fetched from these tables. This asymmetric approach (full-precision query vs. compressed database) yields more accurate distance estimates than Symmetric Distance Computation (SDC), where both vectors are compressed.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.