Inferensys

Glossary

DiskANN

DiskANN is a graph-based approximate nearest neighbor (ANN) search algorithm that indexes billion-scale vector datasets on a single commodity machine by storing the graph structure and compressed vectors on SSD, dramatically reducing RAM requirements compared to in-memory indices.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
SSD-RESIDENT INDEXING

What is DiskANN?

DiskANN is a graph-based approximate nearest neighbor search algorithm engineered to index billion-scale vector datasets on a single commodity machine by storing the graph structure and compressed vectors on SSD, minimizing RAM requirements.

DiskANN (Disk-based Approximate Nearest Neighbor) is a graph-based ANN algorithm that decouples index storage from main memory. It builds a Hierarchical Navigable Small World (HNSW)-like proximity graph but stores the full graph adjacency list and Product Quantization (PQ) compressed vectors on SSD rather than RAM. During search, only a small, cached subset of the graph—the entry point and frequently traversed nodes—resides in memory, enabling billion-scale similarity search without requiring terabytes of expensive DRAM.

The algorithm introduces Vamana, a specialized graph construction routine that optimizes the graph's graph degree and diameter for SSD access patterns, minimizing random reads. At query time, DiskANN employs a beam search that overlaps I/O requests with distance computations, using Asymmetric Distance Computation (ADC) where full-precision query vectors are compared against PQ-compressed database vectors. This architecture achieves high Recall@K with sub-millisecond latency, making it a foundational technique for cost-efficient, large-scale vector index deployments.

SSD-Resident Graph Indexing

Key Features of DiskANN

DiskANN is a graph-based approximate nearest neighbor search algorithm engineered to index billion-scale vector datasets on a single commodity machine by storing the graph structure and compressed vectors on SSD, minimizing RAM requirements.

01

SSD-Resident Architecture

DiskANN stores the proximity graph and compressed vectors directly on SSD, not in RAM. This design fundamentally breaks the memory wall, allowing a single machine with limited DRAM to serve indices that are an order of magnitude larger than main memory. During search, only a small, relevant subset of graph nodes and their full-precision vectors are paged into RAM via efficient I/O, minimizing latency.

1B+
Scale on a Single Node
< 64GB
Typical RAM Footprint
02

Vamana Graph Construction

The core indexing algorithm, Vamana, builds a graph with a constant out-degree optimized for fast, greedy traversal. Unlike HNSW's layered structure, Vamana constructs a single, high-quality graph with a carefully controlled diameter. The key innovation is the robust prune step, which ensures the graph remains connected and navigable even with a limited number of edges per node, preventing search paths from getting stuck in local minima.

03

Product Quantization Compression

To minimize SSD storage and I/O, DiskANN compresses the original high-dimensional vectors using Product Quantization (PQ). The graph structure is stored alongside these compact PQ codes. During search, the query is compared against the PQ-compressed vectors for fast, approximate distance calculations. The full-precision vectors are stored separately and only accessed for the final, high-accuracy re-ranking of a small candidate set.

04

Asymmetric Distance Computation

DiskANN employs Asymmetric Distance Computation (ADC) for its PQ-based scoring. The query vector remains in full precision, while the database vectors are represented by their PQ codes. This approach yields significantly higher recall than symmetric computation (where both are quantized) because only one side of the distance calculation is approximated, preserving more of the query's information.

05

Beam Search with Caching

The search algorithm is a beam search over the Vamana graph. To mitigate the latency of random SSD reads, DiskANN caches the visited graph nodes in a small in-memory buffer. This exploits the observation that many queries traverse similar paths in the graph, turning repeated random I/O into cache hits. The beam width parameter directly controls the trade-off between search accuracy and speed.

06

Full-Precision Re-Ranking

DiskANN operates as a two-stage pipeline. First, a fast, approximate search using the graph and PQ codes generates a candidate set. Then, the original, full-precision vectors for these candidates are read from SSD and used to compute exact distances. This re-ranking step corrects the quantization error, ensuring the final top-K results have high recall, often exceeding 95%.

ALGORITHM COMPARISON

DiskANN vs. HNSW vs. FAISS IVF

Architectural and operational comparison of three leading approximate nearest neighbor search algorithms for billion-scale vector retrieval.

FeatureDiskANNHNSWFAISS IVF

Index Structure

SSD-resident graph with compressed vectors in memory

Multi-layer in-memory proximity graph

Inverted file with Voronoi cell partitioning

Primary Storage Medium

SSD + RAM hybrid

RAM only

RAM (with optional GPU)

Billion-Scale Support on Single Node

Memory Footprint

Low (64GB for 1B vectors)

High (requires full graph in RAM)

Medium (depends on compression)

Graph Degree Hyperparameter

Controlled via beam width during build

M (typically 16-64)

N/A (cluster-based)

Distance Metric

Euclidean, Cosine, Inner Product

Euclidean, Cosine, Inner Product

Euclidean, Inner Product (optimized)

Recall@10 at 1B Scale

95%

N/A (memory-bound)

90%

Index Build Time

Hours (SSD-optimized one-pass)

Hours (multi-layer construction)

Minutes to hours (k-means clustering)

Query Latency (p99)

< 3ms with SSD

< 1ms (in-memory)

< 2ms (GPU-accelerated)

Vector Compression

Product Quantization (PQ)

PQ, Scalar Quantization (SQ)

Dynamic Insertion Support

Filtered ANN Support

Post-filtering

Pre-filtering or post-filtering

Pre-filtering via IVF cells

Open Source Implementation

Microsoft DiskANN

hnswlib, FAISS

FAISS (Meta)

DISKANN DEEP DIVE

Frequently Asked Questions

Explore the architectural details and operational trade-offs of DiskANN, the graph-based algorithm designed to index billion-scale vector datasets on a single commodity machine with minimal RAM.

DiskANN (Disk-based Approximate Nearest Neighbor) is a graph-based ANN algorithm specifically architected to index billion-scale, high-dimensional vector datasets on a single commodity server by storing the majority of the index on SSD rather than in RAM. It works by constructing a Vamana graph—a proximity graph with a carefully controlled graph degree and a pruning strategy that optimizes the recall-latency tradeoff. During search, DiskANN performs a greedy walk on this graph, but unlike in-memory algorithms like HNSW, it intelligently caches only a small set of frequently accessed nodes in memory. The bulk of the vector data and graph structure remains on the SSD, accessed via fast, asynchronous I/O. This architecture minimizes the memory footprint to just a few gigabytes, enabling cost-effective similarity search over datasets that would traditionally require expensive, memory-heavy clusters.

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.