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.
Glossary
IVFADC (Faiss)

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.
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.
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.
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
nprobemost 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.
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).
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.
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
nprobeis dataset-dependent and is typically found via empirical benchmarking to meet application-specific recall targets (e.g., Recall@10 > 0.95).
Index Construction & Training
Building an IVFADC index is a multi-step, offline process that requires a representative training set.
- Coarse Quantizer Training: A
kmeansalgorithm clusters a sample of training vectors to learn thenlistcentroids for the IVF stage. - Residual Calculation: For each training vector, compute its residual by subtracting its assigned IVF centroid.
- PQ Codebook Training: The residuals are split into
msubvectors. A separatekmeans(with2^nbitscentroids) is run on each subspace to create the product quantization codebooks. - 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.
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.
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 / Metric | IVFADC (IVF + PQ) | Flat (IndexFlatL2) | IVFFlat | HNSW |
|---|---|---|---|---|
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) |
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.
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.
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.
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.
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.
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.
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
IVFADC is a composite index. Understanding its constituent algorithms and the ecosystem it operates within is essential for effective implementation.
Inverted File Index (IVF)
The coarse quantizer in IVFADC. IVF partitions the vector space into Voronoi cells by performing k-means clustering. Each cell centroid is stored in an inverted index that maps it to the list of vectors assigned to that cell.
- Search Process: For a query, the system finds the
nprobenearest centroids and searches only the vectors within those cells. - Primary Trade-off: Controls the speed-accuracy balance via the
nprobeparameter. Highernprobeincreases recall and latency by searching more cells.
Product Quantization (PQ)
The fine quantizer and compression engine in IVFADC. PQ compresses high-dimensional vectors by splitting them into m subvectors and quantizing each subspace using a separate, learned codebook.
- Compression: A 128-D vector might be split into 8 subvectors of 16-D each, each quantized to one of 256 centroids, reducing storage from 512 bytes (float32) to 8 bytes (8 indices).
- Distance Approximation: Enables fast Asymmetric Distance Computation (ADC) via lookup tables, avoiding full decompression.
Asymmetric Distance Computation (ADC)
The distance calculation method used with PQ in IVFADC. ADC computes the approximate distance between an uncompressed query vector and compressed database vectors.
- Mechanism: The query vector is split into subvectors. For each subvector, the distance to every centroid in that subspace's codebook is precomputed and stored in a lookup table. The distance to a database vector is then approximated by summing the precomputed distances for each of its subvector centroid indices.
- Accuracy Advantage: More accurate than Symmetric Distance Computation (SDC), which compares two compressed vectors, because the query side remains full precision.
IVFPQ Index
The immediate parent index structure to IVFADC. IVFPQ combines an IVF coarse quantizer with Product Quantization for compression. The key distinction is in the distance computation:
- IVFPQ: Typically uses Symmetric Distance Computation (SDC), where both the query and database vectors are compressed via PQ before distance calculation. This is faster but less accurate.
- IVFADC: Uses Asymmetric Distance Computation (ADC), keeping the query in full precision for higher accuracy at a slight computational cost. IVFADC is often considered a more accurate variant of IVFPQ.
Multi-Stage Search Pipeline
The architectural pattern that IVFADC exemplifies. This pipeline decouples search into distinct, optimized phases to balance speed and accuracy.
- Stage 1 - Candidate Generation (IVF): A fast, approximate scan using the inverted file to retrieve a shortlist of potential nearest neighbors from a few Voronoi cells.
- Stage 2 - Fine Ranking (ADC): A more precise, but still approximate, re-scoring of the candidate list using the product quantizer and ADC lookup tables to produce the final ranked results.
- Benefit: This design avoids the prohibitive cost of exhaustively comparing the query against every compressed vector in the database.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us