Vector Database HNSW RAM, Disk & Quantization Sizing Calculator
One million 1,536-dimensional FP32 vectors take ~6.14 GB for raw vectors alone plus ~1.2–1.8 GB for HNSW graph links (M=16) and safety overhead (~8.5 GB RAM total); Int8 scalar quantization cuts vector RAM nearly 4x down to ~2.8 GB.
Interactive Parameters & Live Verdict
Rule Diagnostics & Recommendations
Engineering Formula & Verification Notes
Computes binary GiB as N × Dimensions × Bytes_per_Dim / 2^30, adds HNSW bi-directional graph adjacency list memory (~M × 8 bytes × 1.2 layer overhead per vector), and applies a 25% operational headroom buffer for segment merges and OS page cache.
Worked Example: 2 Million 1536d OpenAI Embeddings
In FP32, 2M vectors consume 11.44 GB plus ~0.29 GB for HNSW M=16 links, requiring ~14.7 GB RAM with merge headroom. Switching to Int8 quantization drops total RAM to ~3.9 GB with under 1% recall loss when paired with top-k rescoring.
- Always budget extra RAM for payload metadata indexes (tenant_id, timestamps, ACL tags).
- Matryoshka models allow slicing 3072d down to 1024d or 512d with minimal accuracy loss.
Common Vector DB Sizing Mistakes
Teams often budget only raw vector bytes and crash with OOM during HNSW background indexing.
- Omitting payload/JSON metadata size from disk and RAM budgets.
- Setting M=64 unnecessarily, quadrupling graph memory and index build time.
1 Million 1536d Vectors by Precision Mode
| Precision | Raw Vectors | Recommended RAM |
|---|---|---|
| FP32 (4B) | 5.72 GB | ~7.3 GB |
| Int8 (1B) | 1.43 GB | ~2.0 GB |
| Binary (1-bit) | 0.18 GB | ~0.4 GB (+disk rescore) |
Frequently Asked Technical Questions
What HNSW M value should I choose for RAG?
M=16 is the standard balanced default; use M=32 only for very high-dimensional recall-critical datasets.
Does binary quantization work on all embedding models?
Binary quantization works best on high-dimensional (>=1024d) normalized embeddings with oversampling + rescoring.
Can I keep vectors on NVMe SSD instead of RAM?
Yes—mmap or DiskANN modes keep cold vectors on fast NVMe while pinning the HNSW navigation graph or quantized vectors in RAM.