ANN Index Size Calculator
Estimate the memory size of an approximate nearest neighbor search index.
Inputs
Total Index Size
5.84GB
Graph Overhead
122MB
Step by step
Vector storage
1,000,000 × 1536 × 4
= 5.72 GB
HNSW graph overhead: n × M × 2 × 4 bytes
1,000,000 × 16 × 2 × 4
= 122 MB
Total index size
vectors + graph
= 5.84 GB
How it works
An HNSW (Hierarchical Navigable Small World) index stores raw vectors plus a graph structure connecting each vector to M neighbors across multiple layers. Total memory = vector storage + graph overhead. Higher M improves recall but increases memory and build time.
Formula
HNSW Index Size
size = (n × d × bytes_per_float) + (n × M × 2 × 4)
- M
- Number of bi-directional links per node in the HNSW graph
Frequently Asked Questions
What M value should I use?
M=16 is a good default balancing recall and memory. Higher M (32-64) improves recall@k but increases memory linearly. For production, benchmark recall vs memory on your data.
How does the index compare to raw vector storage?
HNSW graph overhead is typically 5-15% of raw vector storage for M=16. The dominant cost is always the vectors themselves.