Inferensys

Glossary

IVFADC (Faiss)

IVFADC is a composite index structure in the Faiss library that combines an Inverted File (IVF) for coarse quantization with Asymmetric Distance Computation (ADC) using Product Quantization for fine quantization, balancing speed and accuracy.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
VECTOR QUERY OPTIMIZATION

What is IVFADC (Faiss)?

IVFADC is a composite index structure in the Faiss library that combines an Inverted File (IVF) for coarse quantization with Asymmetric Distance Computation (ADC) using Product Quantization for fine quantization, balancing speed and accuracy.

IVFADC (Inverted File with Asymmetric Distance Computation) is a two-stage approximate nearest neighbor (ANN) search algorithm in Facebook AI's Faiss library. It first uses an Inverted File (IVF) index to perform a coarse-level search, restricting the scan to a subset of data partitions. For the vectors within those selected partitions, it then performs a fine-grained comparison using Product Quantization (PQ) with Asymmetric Distance Computation (ADC), which compresses the database vectors for memory efficiency while keeping queries uncompressed for accuracy.

This architecture creates a critical speed-accuracy trade-off. The IVF stage's nprobe parameter controls how many partitions are searched, directly impacting recall and query latency. The PQ stage's design—defined by the number of subvectors (m) and bits per subquantizer—determines the reconstruction error. IVFADC is engineered for billion-scale datasets where an exhaustive search is impossible, making it a cornerstone for semantic search and recommendation systems requiring high throughput and manageable memory footprint.

FAISS INDEX ARCHITECTURE

Key Features of IVFADC

IVFADC (Inverted File with Asymmetric Distance Computation) is a composite index in Faiss that combines coarse and fine quantization for high-speed, high-recall similarity search at scale.

01

Two-Stage Quantization

IVFADC employs a coarse quantizer (typically an Inverted File index) to partition the dataset into Voronoi cells, followed by a fine quantizer (Product Quantization) to compress residual vectors within each cell.

  • First Stage (IVF): A query is compared to cluster centroids to select the nprobe most promising cells.
  • Second Stage (ADC): Distances are computed between the query and the PQ-compressed residuals of vectors within those cells using lookup tables. This hierarchical approach drastically reduces the number of full-precision distance calculations required.
02

Asymmetric Distance Computation (ADC)

ADC is the distance calculation method that gives IVFADC its name and accuracy advantage. Unlike symmetric computation, ADC compares an uncompressed query vector to compressed database vectors.

  • The query vector is decomposed into subvectors aligned with the Product Quantization codebooks.
  • For each subvector, distances to all centroid in that subspace are pre-computed, creating a distance lookup table.
  • The approximate distance to a database vector is then the sum of looked-up distances for each of its PQ codes. This asymmetry preserves more query information, leading to more accurate distance approximations than symmetric product quantization (SQ).
03

Memory Efficiency via Compression

The Product Quantization component enables massive memory savings, often achieving compression ratios of 16x to 32x compared to storing full-precision (FP32) vectors.

  • A 128-dimensional vector (512 bytes as FP32) can be represented with just 16 bytes using 8-bit PQ codes (e.g., m=16, nbits=8).
  • This compression allows billion-scale vector datasets to reside in RAM on a single server, which is critical for low-latency search.
  • The trade-off is a loss of precision, which ADC mitigates by using the uncompressed query during distance calculation.
04

The nprobe Trade-Off

The nprobe parameter is the primary lever for controlling the speed-recall trade-off in IVFADC. It defines how many Voronoi cells (clusters) are searched for each query.

  • Low nprobe (e.g., 1-10): Fastest query latency, as only a few cells are examined. However, recall may suffer if the true nearest neighbors are spread across many clusters.
  • High nprobe (e.g., 50-200): Higher recall, as more of the dataset is searched, but with linearly increasing query time and distance computations.
  • Tuning: Optimal nprobe is dataset-dependent and is typically found via empirical benchmarking to meet application-specific recall targets (e.g., Recall@10 > 0.95).
05

Index Construction & Training

Building an IVFADC index is a multi-step, offline process that requires a representative training set.

  1. Coarse Quantizer Training: A kmeans algorithm clusters a sample of training vectors to learn the nlist centroids for the IVF stage.
  2. Residual Calculation: For each training vector, compute its residual by subtracting its assigned IVF centroid.
  3. PQ Codebook Training: The residuals are split into m subvectors. A separate kmeans (with 2^nbits centroids) is run on each subspace to create the product quantization codebooks.
  4. Encoding: All database vectors are assigned to an IVF centroid and their residuals are encoded using the learned PQ codebooks. This training requirement means the index is static; substantial data drift necessitates retraining.
06

Use Case: Billion-Scale Search

IVFADC is engineered for scenarios where the vector dataset is too large for purely in-memory graph indexes (like HNSW) but requires sub-100ms query latency.

  • Typical Scale: Effective for datasets from 10 million to over 1 billion vectors.
  • Performance Profile: At billion scale, IVFADC can achieve ~50ms query latency with high recall by searching a small fraction of the total dataset (controlled by nprobe).
  • Comparison to HNSW: For the same memory footprint, IVFADC typically handles larger datasets than HNSW but may have lower recall at equivalent speed for smaller datasets (e.g., <10M vectors). Its strength is scalable, memory-efficient search.
PERFORMANCE COMPARISON

IVFADC vs. Other Faiss Index Types

A comparison of the IVFADC composite index against other core Faiss index types, highlighting trade-offs in memory usage, query speed, accuracy, and use-case suitability.

Feature / MetricIVFADC (IVF + PQ)Flat (IndexFlatL2)IVFFlatHNSW

Indexing Method

Coarse IVF + Fine PQ

Brute-force (none)

Coarse IVF only

Multi-layer graph

Memory Footprint

Very Low (compressed)

Very High (raw vectors)

High (raw vectors)

High (graph + vectors)

Build Time

Medium (clustering + PQ training)

Low (none)

Medium (clustering)

High (graph construction)

Query Latency

Very Low

Very High (exhaustive)

Low

Very Low

Search Accuracy (Recall)

High (configurable via nprobe)

Perfect (100%)

High (configurable via nprobe)

Very High (configurable via ef)

Supports Filtered Search

Primary Use Case

Billion-scale, memory-constrained search

Small datasets (<100K vectors), exact search

Large-scale, high-accuracy search

Ultra-low latency, high-recall search

Distance Computation

Asymmetric (ADC)

Exact (e.g., L2)

Exact (e.g., L2)

Exact (e.g., L2)

PRACTICAL APPLICATIONS

Where is IVFADC Used?

IVFADC (Inverted File with Asymmetric Distance Computation) is a composite index in Faiss designed for high-throughput, memory-efficient similarity search on massive datasets. Its primary use cases involve balancing speed, accuracy, and resource constraints.

02

Recommendation System Candidate Generation

In two-stage recommendation pipelines, IVFADC performs the first-stage retrieval (candidate generation), rapidly filtering millions of user or item embeddings to a small relevant set for precise ranking.

  • How it works: User preferences and item attributes are represented as dense embeddings. For a given user embedding, IVFADC searches for the top-K most similar item embeddings.
  • Example: An e-commerce platform uses it to find 1,000 candidate products from a catalog of 100 million items based on a user's session embedding. The coarse quantizer (IVF) selects the 10-100 most promising product clusters, and ADC refines the selection within those clusters.
  • Key Benefit: Provides the necessary speed (thousands of queries per second) and high recall for the initial broad retrieval, which is critical for overall recommendation quality and latency.
03

Deduplication & Near-Duplicate Detection

IVFADC is deployed to identify and cluster near-duplicate content—such as articles, videos, or user profiles—across massive datasets, a critical task for data hygiene and fraud prevention.

  • How it works: Content is hashed into vector representations. IVFADC performs a range search or high-recall k-NN search to find all vectors within a small distance threshold, flagging them as potential duplicates.
  • Example: A news aggregator uses it to cluster articles covering the same event from different sources, even if the wording differs. The system processes millions of new articles daily, requiring the efficiency of IVFADC.
  • Key Benefit: The asymmetric distance computation provides more accurate similarity judgments on compressed data than symmetric methods, reducing false positives in duplicate detection.
04

Semantic Search & RAG Backends

IVFADC powers the retrieval core of Retrieval-Augmented Generation (RAG) systems and semantic search engines that query over dense text embeddings.

  • How it works: Text chunks are converted into embeddings via models like BERT or OpenAI embeddings. IVFADC indexes these vectors. A user's natural language query is embedded, and IVFADC retrieves the most semantically relevant text chunks.
  • Example: An enterprise knowledge base with 10 million document chunks uses IVFADC to ground an LLM's responses in factual, company-specific data. The IVF stage ensures low latency, while ADC maintains high recall of relevant context.
  • Key Benefit: Enables real-time, accurate semantic search over private corpora, which is fundamental for reducing LLM hallucinations and providing source-attributed answers.
05

Multimodal & Cross-Modal Search

IVFADC facilitates search across different data modalities, such as finding images with a text query (text-to-image) or finding text relevant to an image (image-to-text).

  • How it works: A multimodal model (e.g., CLIP) embeds images and text into a shared vector space. IVFADC indexes all embeddings (both image and text). A query in one modality retrieves relevant items from the other.
  • Example: A stock photo library allows designers to search for images using descriptive text. The text query "a serene mountain lake at sunrise" is embedded, and IVFADC retrieves the closest image embeddings from an index of 50 million photos.
  • Key Benefit: The efficiency of IVFADC makes large-scale cross-modal search commercially viable, as it handles the high-dimensional, unified embeddings efficiently.
06

Biometric Identification & Matching

In security and authentication systems, IVFADC is used for fast 1:N matching of biometric templates, such as face, fingerprint, or iris embeddings.

  • How it works: Biometric samples are processed into standardized template vectors. IVFADC indexes a gallery of known identities (e.g., millions of face embeddings). A probe template is searched against the gallery to find the top matches.
  • Example: An airport security system verifies a passenger's identity by searching their face embedding against a watchlist of 10 million individuals in near real-time. The IVF structure allows for immediate pruning of irrelevant population segments.
  • Key Benefit: Meets the stringent latency and accuracy requirements of real-time identification systems while operating on compressed data, which is essential for on-device or edge deployments with limited memory.
< 500ms
Typical Search Latency
99.9%+
Required Recall
IVFADC (FAISS)

Frequently Asked Questions

IVFADC is a composite index structure in the Faiss library that combines an Inverted File (IVF) for coarse quantization with Asymmetric Distance Computation (ADC) using Product Quantization for fine quantization, balancing speed and accuracy.

IVFADC is a two-stage approximate nearest neighbor (ANN) search index in the Faiss library that combines an Inverted File (IVF) for coarse, fast filtering with Product Quantization (PQ) and Asymmetric Distance Computation (ADC) for fine, memory-efficient distance calculation. It works by first partitioning the vector space into clusters using k-means (IVF stage). During a search, the system identifies the nprobe nearest clusters to the query. Then, instead of comparing the full-precision query to all vectors in those clusters, it uses ADC: database vectors are compressed via PQ into compact codes, and distances are approximated by computing the distance between the uncompressed query and these compressed database vectors using precomputed lookup tables. This hybrid approach dramatically reduces both memory footprint and query latency compared to a flat index.

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.