Inferensys

Glossary

Asymmetric Distance Computation (ADC)

Asymmetric Distance Computation (ADC) is a method for approximating distances in vector search where the query vector is kept in full precision while database vectors are quantized, improving accuracy over symmetric quantization.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
VECTOR INDEXING ALGORITHM

What is Asymmetric Distance Computation (ADC)?

A method for approximating vector distances in similarity search that prioritizes query accuracy by treating query and database vectors differently.

Asymmetric Distance Computation (ADC) is a technique for approximating distances between vectors where the query vector is kept in its original, full-precision form while the database vectors are quantized (compressed). This asymmetry yields more accurate distance estimates than Symmetric Distance Computation (SDC), where both vectors are quantized, because it minimizes the quantization error introduced on the query side. It is a core component of efficient Approximate Nearest Neighbor Search (ANNS) in systems like FAISS and is often paired with Product Quantization (PQ).

The primary advantage of ADC is its improved accuracy-for-memory trade-off. By calculating distances between a full-precision query and quantized database vectors, the system avoids compounding errors. This is implemented by pre-computing lookup tables of distances between the query's subvectors and all quantization centroids. During search, distances are approximated via efficient table lookups rather than expensive full-precision calculations. ADC is fundamental to the IVFPQ index, enabling fast, high-recall search in billion-scale vector databases.

VECTOR INDEXING ALGORITHMS

Key Characteristics of ADC

Asymmetric Distance Computation (ADC) is a core technique in vector search that optimizes the trade-off between memory, speed, and accuracy by applying quantization asymmetrically between stored and query vectors.

01

Asymmetric Quantization Principle

The defining mechanism of ADC is its asymmetric treatment of query and database vectors. Database vectors are compressed (quantized) for storage efficiency, while the query vector remains in its original, full-precision form during distance calculation. This contrasts with Symmetric Distance Computation (SDC), where both query and database vectors are quantized, leading to compounded quantization error. By keeping the query vector pristine, ADC provides a more accurate approximation of the true distance to each compressed database point.

02

Accuracy vs. Symmetric Computation

ADC is explicitly designed to deliver higher search accuracy than its symmetric counterpart for the same level of compression. The error in distance estimation comes solely from quantizing the database vector, not the query. This is critical for maintaining high Recall@k in production systems. For example, in a Product Quantization (PQ) setup, using ADC instead of SDC can improve recall by a significant margin (e.g., 5-15 percentage points) without increasing memory usage, as the compressed database representation remains identical.

03

Integration with Composite Indexes (IVFPQ)

ADC is most famously employed within the IVFPQ (Inverted File with Product Quantization) index architecture. Here, it operates on the residual vectors within each Voronoi cell:

  • The Inverted File (IVF) acts as a coarse quantizer, narrowing the search to a few candidate cells.
  • Product Quantization (PQ) compresses the residual vectors within those cells.
  • ADC is then used to compute the approximate distance between the full-precision query residual and each PQ-compressed database residual. This combination makes IVFPQ a powerhouse for billion-scale searches, balancing speed, memory efficiency, and accuracy.
04

Computational and Memory Trade-off

ADC introduces a specific cost-benefit profile:

  • Memory Efficiency: Database vectors are heavily compressed (e.g., to 8-32 bytes per vector using PQ), enabling massive datasets to reside in RAM.
  • Computational Overhead: Distance calculations are more expensive than with SDC. ADC requires reconstructing an approximation of the database vector from codes and computing the distance to the full-precision query. This is often accelerated via precomputed lookup tables that store partial distances between query subvectors and quantization centroids.
  • The Trade-off: You exchange some CPU cycles for significantly higher accuracy at a fixed memory budget, which is almost always the preferred trade-off in large-scale retrieval.
05

Lookup Table (LUT) Optimization

A key performance optimization for ADC, especially with Product Quantization, is the use of precomputed lookup tables (LUTs). Since the query is full-precision and known at search time:

  • For each subsegment (subvector) of the query, the distance to every possible centroid in the PQ codebook for that segment is precomputed.
  • To compute the distance to a compressed database vector, the system simply fetches and sums the precomputed distances for each of its subvector codes from the LUTs.
  • This transforms a complex floating-point operation into efficient memory-bound table lookups and additions, making ADC searches remarkably fast despite the asymmetric calculation.
06

Application in Maximum Inner Product Search (MIPS)

ADC is not limited to Euclidean (L2) distance. It is equally crucial for Maximum Inner Product Search (MIPS), a common operation in recommendation systems. The asymmetric principle remains: the full-precision query vector's inner product is approximated with quantized database vectors. Libraries like Google's SCANN use advanced variants of anisotropic vector quantization specifically designed for ADC in the MIPS context, demonstrating the technique's fundamental importance across different similarity metrics.

VECTOR QUANTIZATION COMPARISON

ADC vs. Symmetric Distance Computation (SDC)

A comparison of two fundamental distance approximation methods used in vector search, focusing on their quantization strategies, accuracy, and computational trade-offs.

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

Core Principle

Query vector is full-precision; database vectors are quantized.

Both query and database vectors are quantized to the same representation.

Quantization Error Source

Error originates only from the quantization of database vectors.

Error is compounded from the quantization of both the query and database vectors.

Typical Accuracy (Recall@10)

Higher (e.g., 95-99% for same memory budget)

Lower (e.g., 85-92% for same memory budget)

Query-Time Compute Cost

Higher (requires computing distances to quantized centroids or codebooks)

Lower (pre-computed lookup tables can be used for quantized distances)

Memory Footprint for Vectors

Lower for database; query vector stored in memory at full precision.

Lower for both database and query vectors.

Primary Use Case

Prioritizing high search accuracy and recall.

Prioritizing ultra-low latency and maximum query throughput.

Common Implementation

Used as the fine quantizer in IVFPQ and similar composite indexes.

Used in standalone Product Quantization (PQ) for in-memory search.

Distance Calculation

Asymmetric distance: d(q, x) ≈ d(q, q(x)) where q(x) is quantized x.

Symmetric distance: d(q, x) ≈ d(q(q), q(x)) where both are quantized.

IMPLEMENTATION CONTEXTS

Where is ADC Implemented?

Asymmetric Distance Computation (ADC) is a core algorithmic technique integrated into vector search libraries and database engines to balance accuracy with memory efficiency. Its primary implementation is within multi-stage indexing architectures that separate coarse and fine quantization.

02

Vector Databases (e.g., Pinecone, Weaviate, Milvus)

Commercial and open-source vector databases implement ADC under the hood when using IVF-PQ composite indexes. The database engine handles:

  • Transparent quantization of ingested vectors into PQ codes.
  • Asymmetric distance calculation at query time, where the incoming query vector is not quantized.
  • Integration with filtering, ensuring ADC works seamlessly with metadata filters. This abstraction allows developers to benefit from ADC's memory savings and accuracy without managing the low-level complexity of distance computations.
03

IVFPQ Index Architecture

ADC is fundamentally the distance computation layer within an IVFPQ (Inverted File with Product Quantization) index. The implementation follows a two-stage process:

  1. Coarse Quantizer (IVF): The query is compared to cluster centroids using full-precision distances to select the nearest Voronoi cells.
  2. Fine Quantizer (PQ) with ADC: For each candidate vector in the selected cells, the distance is computed asymmetrically between the full-precision query and the PQ-compressed database vector. This involves looking up pre-computed distance tables between the query's subvectors and the PQ codebooks, a process far faster than reconstructing the database vector.
04

Maximum Inner Product Search (MIPS)

ADC is critically adapted for Maximum Inner Product Search (MIPS), a common similarity metric in recommendation systems. The asymmetric computation for MIPS involves:

  • Transforming the database vectors via asymmetric transformation (e.g., adding a sufficiently large constant to make all entries non-negative).
  • Quantizing the transformed database vectors.
  • Computing the inner product between the full-precision query and the quantized, transformed database vector. Libraries like ScaNN from Google Research implement specialized anisotropic quantization techniques that are inherently asymmetric to optimize for MIPS accuracy.
05

Two-Stage Search with Exact Re-ranking

ADC is often deployed as the first, fast retrieval stage in a two-stage search pipeline.

  • Stage 1 (ADC): A compressed index (like IVFPQ) uses asymmetric distances to rapidly produce a shortlist of candidate vectors (e.g., top 1000).
  • Stage 2 (Exact Re-ranking): The shortlist is re-scored using exact, full-precision distances between the original query and the original, uncompressed database vectors fetched from a separate store. This hybrid approach combines ADC's scalability with the perfect accuracy of exact search for the final result set.
06

Custom Search Kernels & Hardware

For ultimate performance, ADC logic is implemented in low-level, optimized kernels:

  • GPU Kernels: Libraries like FAISS write CUDA kernels that parallelize the ADC distance table lookups and accumulations across thousands of threads.
  • Neural Processing Units (NPUs): Custom compilers for AI accelerators can map ADC's operations to specialized matrix multiplication and lookup units.
  • CPU SIMD Instructions: Optimized C++ implementations use AVX-512 or Neon instructions to accelerate the subvector distance computations that underpin ADC. This hardware-level implementation is key to achieving low-latency search at scale.
VECTOR INDEXING

Frequently Asked Questions

Asymmetric Distance Computation (ADC) is a core technique in vector search that optimizes the trade-off between memory, speed, and accuracy. These questions address its mechanics, advantages, and practical applications.

Asymmetric Distance Computation (ADC) is a method for approximating the distance between vectors where the query vector is kept in its original, full-precision form while the database vectors are stored in a compressed, quantized representation. This asymmetry yields a more accurate distance estimate than Symmetric Distance Computation (SDC), where both query and database vectors are quantized. The technique is foundational to efficient Approximate Nearest Neighbor Search (ANNS) in large-scale vector databases, as it dramatically reduces memory usage and accelerates search while preserving high recall.

ADC operates by pre-computing and storing quantized representations of database vectors (e.g., using Product Quantization). During a search, the system calculates distances between the full-precision query and these pre-computed quantized forms using lookup tables for speed. This approach is central to composite indexes like IVFPQ (Inverted File Index with Product Quantization).

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.