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.
Glossary
DiskANN

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.
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.
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.
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.
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.
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.
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.
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.
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%.
DiskANN vs. HNSW vs. FAISS IVF
Architectural and operational comparison of three leading approximate nearest neighbor search algorithms for billion-scale vector retrieval.
| Feature | DiskANN | HNSW | FAISS 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 |
| N/A (memory-bound) |
|
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) |
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.
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
Essential algorithms and techniques that underpin DiskANN's billion-scale vector search capabilities on commodity hardware.
Graph-Based ANN
A family of indexing algorithms that represent vectors as nodes in a proximity graph. DiskANN builds a single-layer graph with a carefully controlled graph degree, using greedy traversal over edges connecting similar items. Unlike HNSW's multi-layer hierarchy, DiskANN optimizes for SSD-friendly access patterns by minimizing random reads during search.
Product Quantization (PQ)
A vector compression technique that decomposes high-dimensional vectors into smaller subvectors, quantizing each independently using a distinct codebook. DiskANN uses PQ to compress full-precision vectors stored on SSD, dramatically reducing I/O during search. The compressed representation enables fast asymmetric distance computation (ADC) where the query remains uncompressed for higher accuracy.
Vamana Indexing Algorithm
The core graph construction algorithm behind DiskANN. Vamana builds a directed graph with a bounded maximum degree by iteratively connecting each node to a diverse set of approximate nearest neighbors. Key properties include:
- GreedySearch with a beam width parameter for robust graph traversal
- RobustPrune operation that ensures edge diversity by removing redundant connections
- Out-of-core construction that processes data in passes, never requiring the full graph in RAM
SSD-Optimized Layout
DiskANN's key innovation is reorganizing graph data for sequential SSD reads rather than random access. The graph adjacency lists and PQ-compressed vectors are stored in an interleaved layout so that a single SSD read retrieves both the neighbor IDs and their compressed vectors. This minimizes expensive I/O operations per query, typically requiring only 1-2 disk reads for high recall.
Re-Ranking with Full Vectors
A two-stage retrieval pipeline where the SSD-based graph search retrieves a candidate set using PQ-compressed vectors, then a final re-ranking step computes exact distances using full-precision vectors cached in RAM. This architecture decouples the graph traversal cost from the final accuracy, achieving near-exact recall while keeping the working set on SSD.
Filtered ANN with DiskANN
The constrained search problem of finding nearest neighbors that satisfy structured metadata filters. DiskANN implements pre-filtering by generating a candidate set from the graph, then applying predicates during the beam search. For strict filters, it supports post-filtering where the graph search retrieves extra candidates that are then filtered and re-ranked, balancing recall against filter selectivity.

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