Inferensys

Glossary

DiskANN

DiskANN is a graph-based approximate nearest neighbor (ANNS) algorithm designed for billion-scale datasets, storing the graph index on disk and caching a small working set in memory to enable high-performance search with minimal RAM.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
VECTOR INDEXING ALGORITHM

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.

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.

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.

GRAPH-BASED ANNS

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.

01

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.

02

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.

03

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.
04

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.
05

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).

>95%
Typical Recall@10
<2 GB
RAM for 1B Vectors
06

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.
ARCHITECTURAL COMPARISON

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 / MetricDiskANN (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)

PRACTICAL APPLICATIONS

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.

02

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.

10-100x
Larger than RAM datasets
03

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.

< 10ms
P95 Latency at Scale
04

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.
05

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.
06

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.
DISKANN

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.

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.