ANN Index Size Calculator
Estimate the memory size of an approximate nearest neighbor search index.
About ANN Index Size Calculator
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
Worked example
With the default values below, ANN Index Size Calculator returns Total Index Size of 5.84. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Number of Vectorsminimum 1
- 1,000,000
- Dimensionsminimum 1
- 1,536
- HNSW M (connections per node)accepts 4–128
- 16
- Bytes per Floataccepts 1–4
- 4
Results
- Total Index Size
- 5.84 GB
- Graph Overhead
- 122 MB
Step by step
- 1Vector storage= 5.72 GB
- 2HNSW graph overhead: n × M × 2 × 4 bytes= 122 MB
- 3Total index size= 5.84 GB
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
