Inferensys

Glossary

Asymmetric Distance Computation (ADC)

An efficient distance approximation where only the database vectors are compressed via quantization, while the query vector remains in full precision, yielding higher accuracy than symmetric computation.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
QUANTIZATION STRATEGY

What is Asymmetric Distance Computation (ADC)?

A distance approximation method in vector search where the query vector remains uncompressed while database vectors are quantized, improving accuracy over symmetric approaches.

Asymmetric Distance Computation (ADC) is a technique for approximating the distance between a query vector and database vectors where only the database vectors are compressed via product quantization (PQ), while the query vector remains in full precision. This asymmetry yields higher accuracy than symmetric distance computation (SDC) because the query is not subjected to quantization error, preserving its fine-grained information during the distance calculation.

In practice, ADC pre-computes distance lookup tables between the full-precision query subvectors and each codebook entry. During search, the distance to a compressed database vector is reconstructed by summing the pre-computed distances corresponding to its PQ codes, avoiding decompression overhead. This approach is fundamental to IVFPQ indices and libraries like FAISS, balancing the memory savings of compression with superior recall compared to fully symmetric quantization.

ASYMMETRIC DISTANCE COMPUTATION

Key Characteristics of ADC

A vector compression and distance approximation strategy where only the database vectors are quantized, while the query vector remains in full precision. This asymmetry yields higher accuracy than symmetric methods by eliminating query-side quantization error.

01

Asymmetric vs. Symmetric Computation

The fundamental distinction lies in which vectors undergo quantization:

  • Symmetric Distance Computation (SDC): Both the query vector and the database vectors are compressed via product quantization. Distance is approximated between two quantized representations, introducing error on both sides.
  • Asymmetric Distance Computation (ADC): Only the database vectors are compressed. The query vector remains in full floating-point precision.

The result: ADC eliminates the quantization error on the query side entirely. The distance between a precise query and an approximate database vector is inherently more accurate than the distance between two approximations.

~50%
Error Reduction vs. SDC
0
Query-Side Quantization Error
02

Distance Computation Mechanics

ADC leverages pre-computed lookup tables to accelerate the distance calculation between a full-precision query and product-quantized database vectors.

The process:

  1. The database vector is decomposed into M subvectors, each quantized to a centroid index from its sub-codebook.
  2. For the incoming query, the distance from the query subvector to every centroid in each sub-codebook is computed once and stored in an M × K lookup table (where K is the number of centroids per sub-codebook).
  3. The approximate distance to any database vector is then computed by summing M table lookups, avoiding expensive high-dimensional distance calculations.

This makes ADC both memory-efficient for storage and computationally fast during search.

M × K
Lookup Table Size
03

Role in Product Quantization (PQ)

ADC is the standard distance computation method paired with Product Quantization for nearest neighbor search.

  • Encoding Phase: Database vectors are compressed using PQ. Each vector is represented by a short code (a sequence of centroid indices), not its original floating-point values.
  • Search Phase: For a query vector, the ADC lookup table is built. The distance to every compressed database code is approximated by summing the pre-computed partial distances.

This pairing is the engine behind indices like IVFPQ, where an Inverted File Index first prunes the search space, and ADC computes the fine-grained residual distances to the remaining candidates.

04

Accuracy-Recall Tradeoff

The primary benefit of ADC is a superior accuracy-speed tradeoff compared to symmetric computation at the same memory footprint.

  • Higher Recall@K: By preserving the query's full precision, ADC more reliably ranks true nearest neighbors at the top of the result list. The quantization error is isolated to the database side.
  • Negligible Speed Overhead: The cost of building the lookup table for a full-precision query is a small, one-time overhead per search, making it the default operational mode in libraries like FAISS for virtually all PQ-based indices.

In practice, ADC provides a 'free' accuracy boost over SDC with no meaningful increase in query-time latency.

~10-20%
Typical Recall@K Improvement
05

Memory Footprint and Storage

ADC enables massive compression of the database while retaining high search fidelity:

  • Database Storage: Only the short PQ codes (typically 8-64 bytes per vector) need to be stored in memory, not the original high-dimensional vectors. For a billion-scale dataset, this can reduce storage from terabytes to gigabytes.
  • Codebook Storage: The full-precision sub-codebooks must be retained to reconstruct the lookup table distances for each query. These codebooks are small relative to the database size.
  • Query Handling: The query vector itself is ephemeral and processed in full precision, requiring no persistent storage beyond the duration of the search.

This asymmetry is ideal for read-heavy workloads where the database is static or infrequently updated but queries arrive in real-time.

06

Implementation in FAISS

The Facebook AI Similarity Search (FAISS) library provides a canonical implementation of ADC within its product quantization indices.

  • The IndexPQ class stores database vectors as compressed PQ codes.
  • During a search, the search() method automatically performs asymmetric distance computation by default, computing exact query-to-centroid distances and using them to approximate query-to-database distances.
  • For composite indices like IndexIVFPQ, ADC operates on the residual vectors—the difference between the query and the coarse cluster centroid—further improving accuracy by quantizing only the local distribution.

This built-in behavior makes ADC the standard, high-accuracy mode for any engineer using FAISS for large-scale vector search.

DISTANCE COMPUTATION STRATEGIES

ADC vs. Symmetric Distance Computation (SDC)

Comparison of asymmetric and symmetric distance computation approaches for quantized vector search, highlighting accuracy, speed, and memory tradeoffs.

FeatureAsymmetric (ADC)Symmetric (SDC)

Query vector precision

Full precision (uncompressed)

Quantized (compressed)

Database vector precision

Quantized (compressed)

Quantized (compressed)

Distance computation

Query-to-codebook centroid

Code-to-code centroid

Search accuracy (recall)

Higher

Lower

Distance table precomputation

Query-time compression overhead

Typical recall@10 improvement

2-5%

Baseline

Memory footprint

Identical

Identical

ASYMMETRIC DISTANCE COMPUTATION

Frequently Asked Questions

Clarifying the mechanics and trade-offs of Asymmetric Distance Computation (ADC), a core technique for efficient, high-accuracy similarity search in compressed vector spaces.

Asymmetric Distance Computation (ADC) is an efficient distance approximation technique where only the database vectors are compressed via quantization, while the query vector remains in full precision. The process works by first encoding all database vectors into short codes using a technique like Product Quantization (PQ). At query time, the uncompressed query vector is compared against the codebooks to pre-compute a distance lookup table. The approximate distance to any database vector is then reconstructed by summing the pre-computed distances corresponding to its stored codes. This asymmetry—full-precision query, compressed database—yields higher accuracy than Symmetric Distance Computation (SDC), where both query and database vectors are quantized, because the query's fine-grained information is preserved without distortion.

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.