DiskANN (Disk-based Approximate Nearest Neighbor) is a graph-based indexing algorithm designed for high-performance similarity search on massive datasets that exceed available RAM. Its core innovation is storing the primary navigable small-world graph index on persistent storage (e.g., SSD) while caching only a small, frequently accessed working set in memory. This architecture enables efficient search on datasets containing billions of high-dimensional vectors using a standard server, as it decouples index size from memory capacity.
Glossary
DiskANN

What is DiskANN?
DiskANN is a graph-based approximate nearest neighbor (ANN) search algorithm engineered for billion-scale datasets, uniquely optimized to operate with a minimal memory footprint by storing the primary index on disk.
The algorithm constructs a Vamana graph, which provides robust search paths with long-range connections. During a query, it performs a greedy beam search on the cached portion of the graph, fetching additional nodes from disk as needed. This design makes DiskANN highly efficient for read-intensive workloads, offering a compelling trade-off between high recall, low query latency, and dramatically reduced infrastructure cost compared to purely in-memory indexes like HNSW.
Key Features of DiskANN
DiskANN is a graph-based approximate nearest neighbor search algorithm optimized for billion-scale datasets. Its core innovation is storing the graph index on disk while caching a small working set in memory, enabling high-performance search with a minimal memory footprint.
Disk-Resident Graph Index
The primary data structure is a graph-based index (like HNSW) that is persisted entirely on disk (e.g., SSD). Only a small, frequently accessed portion—the hot working set—is cached in RAM. This decouples index size from available memory, allowing the system to scale to billions of vectors with a constant, small memory overhead.
In-Memory Cached Navigational Graph
For fast search, DiskANN maintains a compact, cached graph in RAM. This is not the full index but a pruned, memory-optimized version used for navigation. The algorithm performs a greedy beam search on this cached graph to identify candidate nodes, then performs fine-grained distance comparisons by fetching the full-precision vectors of those candidates from disk.
Optimized SSD-Aware Search
The algorithm is explicitly designed for SSD latency and bandwidth characteristics. It minimizes random I/O by:
- Batching candidate vector reads from disk.
- Using a large search frontier (beam width) to amortize I/O cost across many distance computations.
- Organizing on-disk data to maximize sequential read patterns. This makes search latency dominated by SSD bandwidth, not seek time.
Vamana Graph Construction
DiskANN uses the Vamana graph construction algorithm. It builds a robust, small-world graph by iteratively applying two principles:
- Prune: For each node, keep only a set of high-quality, diverse neighbors that preserve short paths.
- Diversify: Ensure long-range "hub" connections exist to prevent search from getting stuck locally. This creates a graph with strong navigability for both in-memory and disk-based traversal.
High Recall with Low Memory
The system achieves high recall (e.g., >95%) competitive with in-memory indexes while using orders of magnitude less RAM. For example, a 1-billion vector index might require >100 GB for a pure in-memory HNSW but only <2 GB of RAM with DiskANN, with the trade-off being higher latency due to disk I/O (typically milliseconds per query).
Static & Dynamic Indexing Modes
Supports two operational modes:
- Static Indexing: For a fixed dataset, the index is built once offline for optimal performance.
- Dynamic Indexing: Supports insertions by attaching new nodes to the existing graph. This avoids a full rebuild but may gradually degrade search performance, necessitating periodic re-indexing or graph consolidation operations.
DiskANN vs. Other ANNS Indexes
A feature and performance comparison of DiskANN against other prominent approximate nearest neighbor search (ANNS) index types, highlighting trade-offs in memory usage, search speed, and scalability.
| Feature / Metric | DiskANN (Graph-on-Disk) | HNSW (In-Memory Graph) | IVFPQ (Clustering + Quantization) | LSH (Hashing-Based) |
|---|---|---|---|---|
Primary Storage Medium | Disk (SSD/HDD) | RAM | RAM | RAM |
In-Memory Working Set | < 5% of dataset | 100% of dataset + graph | Compressed vectors + index | Hash tables |
Billion-Scale Viability | ||||
Dynamic Updates (Insert/Delete) | ||||
Typical Recall@10 (at same QPS) | 95-99% | 98-99% | 90-95% | 70-85% |
Latency at High Throughput | < 10 ms | < 1 ms | 1-5 ms | 5-20 ms |
Index Build Time | High | Very High | Medium | Low |
Distance Computation | Exact (ADC) | Exact | Approximate (PQ) | Approximate (Hamming) |
Use Cases for DiskANN
DiskANN's design—storing the graph index on disk while caching a small working set in memory—makes it uniquely suited for applications where the dataset is too large for RAM but low-latency, high-recall search is still required.
Memory-Constrained Production Deployments
For cost-sensitive production environments, memory is often the primary bottleneck and expense. DiskANN's ability to maintain a high-performance index primarily on NVMe or SSD storage, with only a small hot cache in RAM, dramatically reduces the total cost of ownership (TCO). This enables deployment on machines with limited RAM (e.g., 64GB) to search datasets that would otherwise require terabytes of memory with an in-memory index like HNSW. This architecture is ideal for cloud deployments where memory-optimized instances are significantly more expensive than compute- or storage-optimized ones.
Retrieval-Augmented Generation (RAG) Backends
RAG systems require fast, accurate retrieval of relevant context from a knowledge base to ground large language model (LLM) responses. DiskANN provides the high recall at low latency needed for real-time RAG, especially when the knowledge base is large and dynamic. Its support for filtered search (combining vector similarity with metadata filters) allows for precise retrieval from segmented corpora (e.g., by department, date, or document type). The disk-based design accommodates the continuous ingestion of new documents without expensive index rebuilds, keeping the RAG system's knowledge current.
Multi-Modal and Cross-Modal Retrieval
In multi-modal AI systems, embeddings from different modalities (text, image, audio, video) reside in a shared vector space. DiskANN can index these heterogeneous, high-dimensional embeddings (often 768+ dimensions) for tasks like:
- Text-to-image search: Finding relevant images from a textual description.
- Video moment retrieval: Locating specific scenes using a text query.
- Audio fingerprinting: Identifying music or sounds from a sample. The algorithm's efficiency with high dimensionality and massive scale makes it a foundational component for building unified multi-modal search engines.
Dynamic Datasets with Real-Time Updates
Unlike many graph-based indexes that are static, DiskANN supports efficient dynamic operations. New vectors can be inserted into the graph with minimal disruption, and the system's lazy deletion mechanism handles removals. This makes it suitable for applications with continuously evolving data, such as:
- Real-time analytics and logging: Searching over streaming event embeddings.
- User-generated content platforms: Indexing new social media posts, videos, or products in near real-time.
- Live monitoring systems: Where the state-of-the-system is constantly encoded into embedding vectors.
Scientific and Research Data Exploration
In scientific computing, researchers often work with extremely large, read-heavy datasets that are impractical to load entirely into memory. DiskANN enables similarity search over:
- Genomic sequences represented as embeddings for homology search.
- Astronomical object catalogs for finding similar celestial bodies.
- Chemical compound libraries for drug discovery via molecular similarity.
- Climate simulation outputs for identifying analogous weather patterns. The high recall guarantees and ability to work directly with data on high-performance storage (like Lustre or GPFS) make it a tool for data-intensive research.
Frequently Asked Questions
DiskANN is a graph-based approximate nearest neighbor (ANN) search algorithm designed for billion-scale datasets. It uniquely stores the primary index on disk while caching a small, frequently accessed working set in memory, enabling high-performance search with a drastically reduced memory footprint compared to purely in-memory indexes.
DiskANN is a graph-based approximate nearest neighbor (ANN) search algorithm optimized for datasets that exceed available RAM. It works by constructing a Voronoi graph where nodes are data vectors and edges connect to nearby neighbors. The core innovation is its two-tier storage architecture: the complete graph index resides on SSD or other persistent storage, while a small, frequently accessed subset of vectors (a cached working set) is kept in memory. During a search, the algorithm performs a greedy beam search starting from one or more entry points, navigating the graph by loading necessary nodes from disk into the memory cache as needed. This design decouples index size from RAM capacity, allowing billion-scale search on hardware with limited memory.
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
DiskANN operates within a broader ecosystem of algorithms and data structures designed for high-dimensional vector search. Understanding these related concepts is crucial for selecting the right indexing strategy.
HNSW (Hierarchical Navigable Small World)
HNSW is a graph-based approximate nearest neighbor (ANN) algorithm that constructs a multi-layered graph to enable fast, logarithmic-time search. It is a primary in-memory counterpart to DiskANN.
- Key Difference: HNSW is optimized for in-memory performance, while DiskANN is designed for disk-resident billion-scale datasets.
- Structure: Uses a hierarchy of graphs with varying densities, allowing for rapid long-range navigation at the top layers and fine-grained search at the bottom.
- Trade-off: Offers exceptional speed and recall but requires the entire index to reside in RAM, limiting scalability for massive datasets.
IVF (Inverted File Index)
IVF is a clustering-based indexing method that partitions the vector space into Voronoi cells using a technique like k-means.
- Mechanism: Creates an inverted index mapping each cluster centroid to the list of vectors within its cell.
- Search Process: For a query, the system finds the nearest centroids (coarse quantizer) and searches only the vectors within those corresponding cells.
- Relation to DiskANN: IVF provides the coarse partitioning used in IVFPQ and represents a different architectural approach (clustering vs. graph) for reducing search scope.
Product Quantization (PQ)
PQ is a lossy compression technique for high-dimensional vectors that dramatically reduces memory footprint, enabling billion-scale indexes to fit in RAM.
- Process: Splits a vector into subvectors and quantizes each sub-space using a separate, learned codebook. The original vector is represented by a short code of sub-quantizer indices.
- Asymmetric Distance Computation (ADC): Allows accurate distance estimation between a full-precision query and compressed database vectors.
- DiskANN Context: While DiskANN uses graph-based search on disk, it often employs PQ-like compression for its in-memory cache of frequently accessed nodes to maximize efficiency.
Voronoi Cells
In vector indexing, a Voronoi cell is a region of space containing all points closer to a given centroid than to any other.
- Foundation for Clustering Indexes: Algorithms like IVF use Voronoi cells as the fundamental partitions of the dataset.
- Search Implication: During a query, the search is confined to the cells whose centroids are nearest to the query vector, drastically reducing the number of distance computations.
- Contrast with Graph-Based: DiskANN uses a graph structure for navigation instead of explicit Voronoi partitioning, though the graph itself implicitly defines proximity regions.
ANNS (Approximate Nearest Neighbor Search)
ANNS is the overarching problem domain that DiskANN and all related algorithms aim to solve: finding vectors that are approximately closest to a query, trading perfect accuracy for sub-linear search time.
- Core Trade-off: Balances recall (accuracy), latency (speed), memory footprint, and index build time.
- Algorithm Families: Includes graph-based (DiskANN, HNSW), clustering-based (IVF), hashing-based (LSH), and tree-based methods.
- Evaluation Metric: Performance is measured by metrics like Recall@k, which quantifies how many of the true k-nearest neighbors are found in the top k results.

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