Inferensys

Glossary

DiskANN

DiskANN is an approximate nearest neighbor search system designed for billion-scale datasets that stores the vector index on disk (SSD) while caching a small working set in memory, enabling high-performance search with a drastically reduced memory footprint.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
RETRIEVAL LATENCY OPTIMIZATION

What is DiskANN?

DiskANN is a high-performance approximate nearest neighbor (ANN) search system designed for billion-scale vector datasets.

DiskANN is an approximate nearest neighbor search system designed for billion-scale datasets that stores the vector index on disk (SSD) while caching a small working set in memory, enabling high-performance search with a drastically reduced memory footprint. It uses a graph-based index optimized for solid-state drive access patterns, allowing it to efficiently handle datasets far larger than available RAM by minimizing random I/O and maximizing sequential reads.

The system's core innovation is its Vamana graph algorithm, which constructs a navigable graph where each node connects to its nearest neighbors. During a query, DiskANN performs a greedy search on this graph, loading only the necessary vector pages from disk into a managed cache. This architecture provides a superior recall-latency trade-off compared to purely in-memory indexes at the same memory budget, making it a foundational technology for cost-effective, large-scale retrieval-augmented generation (RAG) and semantic search systems.

DISKANN

Key Features and Architecture

DiskANN (Disk-based Approximate Nearest Neighbor) is engineered for billion-scale vector datasets by fundamentally rearchitecting the memory-storage hierarchy of ANN search. Its core innovation is maintaining a high-performance graph index primarily on fast storage (SSD) with a minimal, intelligent in-memory cache.

01

SSD-Optimized Graph Index

DiskANN stores the primary search index—a Navigable Small World (NSW) graph—directly on Solid State Drive (SSD). Vectors are stored contiguously on disk, and the graph structure holds pointers (offsets) to these vector locations. This design exploits the high sequential read bandwidth and low random access latency of modern SSDs, allowing the system to hold orders of magnitude more data than RAM-limited indexes like pure HNSW.

  • The on-disk graph is built to maximize locality, grouping connected nodes close together on disk to minimize seek times during traversal.
  • Search involves greedily walking this graph, reading vector data from disk only for the nodes visited.
02

In-Memory Caching Strategy

To mitigate SSD access latency, DiskANN maintains a small, dynamic in-memory cache of frequently accessed data. Crucially, it caches two distinct elements:

  • Graph Neighborhood: The connectivity list (edges) of the NSW graph for cached nodes. This is tiny (just lists of IDs) and allows the algorithm to plan its traversal without disk I/O.
  • Vector Data: The actual vector embeddings for a subset of nodes. The system employs a cost-aware caching policy that prioritizes caching vectors for nodes that are central hubs in the graph, as visiting them is highly probable during many searches.

This hybrid approach ensures that RAM is used as a smart accelerator, not a storage bottleneck, typically requiring only 1-5% of the total dataset size in memory.

03

Vamana Graph Construction Algorithm

DiskANN uses the Vamana algorithm to build its underlying graph index. Vamana is a graph construction method similar to HNSW but optimized for a disk-resident setting. Its key features include:

  • Robust Pruning: During insertion, Vamana aggressively prunes edges from new and existing nodes to maintain a constant out-degree (e.g., 64-128), which is critical for controlling the size of the on-disk index and the cache footprint.
  • Long-Range "RNG" Edges: It ensures the graph contains Relative Neighborhood Graph (RNG) edges, which act as "highways" for greedy search, preventing traversal from getting stuck in local minima and enabling high recall with short search paths.
  • The construction is a single-pass process, making it suitable for large-scale batch indexing.
04

Beam Search for I/O Efficiency

DiskANN's query algorithm uses a beam search (or greedy beam search) strategy tailored for disk I/O. Instead of exploring one path at a time, it maintains a priority queue (candidate list) of fixed size (L).

  1. The search starts from a few entry points.
  2. It expands the top candidates in the queue by fetching their graph neighbors and corresponding vectors from disk (or cache).
  3. New candidates are added to the queue, which is then pruned back to size L.

This approach is I/O-efficient because it amortizes the cost of a disk read: fetching one vector from disk allows the evaluation of all its neighbors in the queue. The beam width L is a tunable parameter that balances I/O, accuracy, and latency.

05

Tunable Quality-Latency Trade-off

Performance is controlled via intuitive search-time parameters that directly manage the I/O-compute trade-off:

  • L (Search List Size): The beam width. A larger L explores more candidates per iteration, increasing accuracy (recall) and disk I/O.
  • R (Beam Width): Often synonymous with L, controlling the breadth of the search.

These parameters allow operators to dial in the required Service Level Agreement (SLA). For example, a low-latency application might use a small L, accepting slightly lower recall, while a batch processing job can use a large L for maximum accuracy. The design ensures that even at the highest quality settings, the memory footprint remains constant.

06

Comparison to In-Memory ANN (e.g., HNSW)

DiskANN solves a different scalability problem than purely in-memory indexes like HNSW.

AspectDiskANNIn-Memory HNSW
Primary StorageSSDRAM
Max Dataset SizeBillion+ vectors (limited by SSD)10s-100s of millions (limited by RAM)
Memory Footprint1-5% of dataset size (cache)100%+ of dataset size (full index)
Query LatencyMilliseconds, dominated by SSD I/OSub-millisecond, dominated by CPU cache.
Use CaseLarge-scale archival or streaming data where fitting in RAM is cost-prohibitive.Hot data where ultimate low latency is critical and dataset fits in RAM.

DiskANN is not a replacement for HNSW but a complementary technology for the next order of magnitude in data scale.

RETRIEVAL LATENCY OPTIMIZATION

How DiskANN Works: The SSD-Memory Hierarchy

DiskANN is an approximate nearest neighbor (ANN) search system engineered for billion-scale vector datasets, uniquely leveraging a tiered storage hierarchy to balance performance and cost.

DiskANN (Disk-based Approximate Nearest Neighbor) is a graph-based index designed to store the primary data structure on solid-state drives (SSDs) while caching a small, frequently accessed working set in RAM. This architecture decouples index size from available server memory, enabling cost-effective search over datasets far larger than a machine's RAM capacity. The system builds a Voronoi graph on the full dataset stored on disk, where nodes are vectors and edges connect neighboring points.

During a query, search begins from a few in-memory entry points, performing a greedy beam search on the cached portion of the graph. When traversal requires a vector not in the cache, it is paged in from SSD with low latency. This memory-SSD hierarchy, combined with optimized I/O scheduling and SSD-friendly access patterns, allows DiskANN to achieve query latencies close to in-memory ANN systems while using orders of magnitude less RAM, making it pivotal for large-scale retrieval-augmented generation (RAG) deployments.

ARCHITECTURE COMPARISON

DiskANN vs. Fully In-Memory ANN: A Trade-off Analysis

A direct comparison of the DiskANN system, which uses disk-based indices, against traditional fully in-memory approximate nearest neighbor (ANN) systems, highlighting key engineering trade-offs for billion-scale datasets.

Feature / MetricDiskANN (Disk-Based)Fully In-Memory ANN (e.g., HNSW, IVF)

Primary Storage Medium

Solid-State Drive (SSD)

RAM

Maximum Practical Dataset Size

10 Billion vectors

~1-2 Billion vectors (per node)

Memory Footprint (Working Set)

~5-10% of dataset size

100% of dataset size + index overhead

Typical Query Latency (P50)

1-10 milliseconds

<1 millisecond

Index Build Time

Hours to days

Minutes to hours

Incremental Update Support

Yes (via SSD-friendly merges)

Limited / often requires full rebuild

Hardware Cost (for 1B vectors)

$10k - $50k (SSD-centric)

$100k+ (RAM-centric)

Optimal Use Case

Billion-scale, cost-sensitive, read-heavy workloads

Millions-scale, latency-critical, dynamic workloads

DISKANN

Primary Use Cases and Applications

DiskANN is engineered for scenarios where massive vector datasets exceed available RAM, prioritizing high-throughput, low-latency search on cost-effective hardware. Its core applications leverage its unique disk-memory hybrid architecture.

01

Billion-Scale Vector Search

DiskANN's primary application is enabling approximate nearest neighbor (ANN) search on datasets with hundreds of millions to billions of vectors. By storing the primary graph index on Solid-State Drives (SSD) and caching only a small working set in RAM, it bypasses the memory bottleneck of purely in-memory indices like HNSW or IVFPQ. This makes it feasible to search colossal embedding spaces—common in web-scale recommendation, image retrieval, or enterprise document search—on servers with tens of GBs of RAM instead of terabytes.

1B+
Vectors Supported
~10-100GB
Typical RAM Cache
02

Cost-Effective Retrieval for RAG

In Retrieval-Augmented Generation (RAG) pipelines, DiskANN drastically reduces the infrastructure cost of the retrieval layer. It allows enterprises to deploy a high-performance semantic search over a large, proprietary knowledge base without provisioning expensive, high-memory cloud instances. The system maintains millisecond-level query latencies for cached hot data while efficiently handling cold data from disk, enabling accurate context retrieval for LLMs from massive internal document repositories, codebases, or support ticket histories on a budget.

03

High-Throughput Recommendation Systems

DiskANN is deployed in large-scale recommendation engines where the candidate pool (e.g., products, videos, articles) is represented as dense embeddings. Its ability to perform fast Maximum Inner Product Search (MIPS) or cosine similarity search on a disk-resident index supports real-time personalization for millions of users. The architecture allows for efficient batch querying, maximizing SSD I/O bandwidth to serve thousands of queries per second, making it suitable for news feeds, e-commerce platforms, and streaming media services.

04

Dynamic and Fresh Data Environments

Unlike systems requiring full index rebuilds, DiskANN supports incremental updates. New vectors can be inserted into the graph index with minimal disruption, enabling near-real-time retrieval on evolving datasets. This is critical for applications like:

  • Social media search with constantly new content.
  • Log and telemetry analysis where new events are continuously indexed.
  • Financial time-series retrieval with streaming market data. The system manages these updates while maintaining search quality and performance, avoiding costly downtime for re-indexing.
05

Multi-Tenant & Isolated Search Services

The disk-based design makes DiskANN ideal for multi-tenant SaaS applications where each tenant has a large, isolated vector dataset. A single server can host dozens of separate DiskANN indices on its storage drive, each serving a different customer, with memory caching adapted per tenant's query patterns. This provides strong resource isolation and cost efficiency compared to loading all tenant data into a shared, monolithic in-memory index, which would require prohibitively large RAM.

06

Hybrid Filtering with Metadata

DiskANN efficiently combines vector similarity search with metadata filtering. During search, the algorithm can prune graph traversal paths based on attached scalar attributes (e.g., date > 2023, category = 'legal'). This enables complex, multi-modal queries common in enterprise search: "Find technical documents about neural networks from the last quarter." The filtering is integrated into the graph search process, avoiding the latency penalty of a naive post-filtering approach that might discard all initially retrieved results.

DISKANN

Frequently Asked Questions

DiskANN is a high-performance, disk-based approximate nearest neighbor (ANN) search system designed for billion-scale vector datasets. This FAQ addresses its core mechanisms, trade-offs, and practical applications in retrieval-augmented generation (RAG) and enterprise search.

DiskANN is an approximate nearest neighbor (ANN) search system designed for billion-scale datasets that stores the primary vector index on solid-state drives (SSD) while caching a small, frequently accessed working set in RAM. It works by constructing a graph-based index where each data point (vector) is a node connected to its nearest neighbors. During a search, the algorithm performs a greedy traversal of this graph starting from a few entry points, navigating towards the query vector. The key innovation is its SSD-optimized layout and caching strategy, which ensures that only the small subset of graph nodes needed for the current search trajectory are fetched from disk, minimizing I/O latency and enabling high-throughput search with a drastically reduced memory footprint compared to in-memory indexes.

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.