RAG, Context & Media AI

RAG Vector Database RAM & HNSW Storage Calculator

Calculate exact RAM and disk footprint for HNSW vector indexes across Float32, Float16, Int8 scalar quantization, and Binary vectors.

Input Parameters

vectors
links/node
bytes
x
Calculated Output
Primary Result
—
Adjust inputs to recalculate immediately.

1 Million Vectors (1536 Dimensions, HNSW M=16, 200B Metadata)

Notice how HNSW graph pointers (~0.15 GiB per 1M at M=16) remain fixed regardless of vector quantization.

Vector PrecisionRaw VectorsHNSW + MetadataTotal RAM (w/ 1.2x)Hosting Tier Fit
Float32 (4 B/dim)5.72 GiB0.34 GiB7.27 GiB16 GB VPS / RAM Node
Float16 (2 B/dim)2.86 GiB0.34 GiB3.84 GiB8 GB Budget VPS
Int8 Scalar Quant (1 B/dim)1.43 GiB0.34 GiB2.12 GiB4 GB Budget VPS
Binary Quant (1-bit)0.18 GiB0.34 GiB0.62 GiBFits anywhere (with rescore)

Formula & Engineering Methodology

HNSW keeps bidirectional adjacency lists (~2 * M * 4-byte uint32 node IDs plus ~25% level/structural overhead) in RAM for millisecond ANN traversal alongside raw quantized vectors and indexed metadata fields.

raw_vectors_gib = (num_vectors * dimensions * precision) / 1073741824 hnsw_gib = (num_vectors * (2 * hnsw_m * 4) * 1.25) / 1073741824 metadata_gib = (num_vectors * metadata_bytes) / 1073741824 total_ram_gib = (raw_vectors_gib + hnsw_gib + metadata_gib) * headroom_mult

Variable Definitions

Practical Note: On Qdrant/Milvus with disk-backed payloads and memory-mapped original FP32 vectors, you only need to hold Int8/Binary vectors + HNSW edges in hot RAM.

Frequently Asked Questions

Why do HNSW index edges still use RAM after Int8 or Binary quantization?
Vector quantization shrinks the embedding coordinates, not the graph node adjacency pointers (2 * M * 4 bytes per vector), which become a larger percentage of memory at high compression.
When does pgvector fit on a cheap single VPS vs dedicated Qdrant/Milvus?
Up to 1–3 million vectors (with halfvec FP16 or int8 quantization), pgvector or single-node Qdrant runs comfortably inside 4–16 GB RAM on a €10–€30/month VPS.
How does changing HNSW M from 16 to 32 impact RAM and recall?
Doubling M doubles graph edge memory and slows index ingestion, typically yielding only 1–2% higher recall—M=16 is optimal for most 1536d RAG workloads.

Related Engineering Calculators

ComputeSizer runs 100% locally in your browser with open formulas and zero account gates. If these VRAM and GPU cost tools saved your team money, support us via Fourthwall or sponsor an ad-free developer placement.