Skip to content

Project

Memory and recall

Bytes per vector and recall@10 for every SrvDB mode on DBpedia OpenAI embeddings, NYTimes and GloVe, with the environment and command to reproduce them.

How much memory does each SrvDB mode need per vector, and what recall does it keep? Every number on this page is read at build time from website/src/data/benchmarks/memory-recall.json, a copy of benchmarks/social/results.json. Nothing is typed by hand. Speed is not measured here; it waits for an idle-machine run.

Bar chart of search code bytes per vector for each SrvDB mode on DBpedia OpenAI ada-002 embeddings Bar chart of recall@10 for each SrvDB mode on DBpedia OpenAI ada-002 embeddings
  • Search bytes/vector: what a search scans per vector, db.memory_report()["vector_bytes"] / n. float32 for flat, codes otherwise.
  • Disk total/vector: every file in the database directory divided by n. Files are preallocated beyond n, and RaBitQ keeps the float32 vectors on disk for exact rerank, so this is larger than the search bytes.
  • Recall@10: against the dataset’s ground truth (ann-benchmarks neighbours, or exact numpy search), default settings. “No rerank” is RaBitQ with set_rabitq_rerank(0).
  • Peak RSS: of the measuring process, including the benchmark’s own copy of the vectors.

How to read the tables: bold recall is the highest recall on that dataset. The row marked ★ best trade-off is the smallest mode whose recall is within 0.005 of exact float32 search. That’s the mode to pick when you want exact-search quality at the lowest memory. PQ is never marked, even though it is small, because its recall is far below exact search.

NYTimes (256-d, ann-benchmarks)

Source: http://ann-benchmarks.com/nytimes-256-angular.hdf5. Licence: derived from UCI Bag of Words (NYTimes), CC BY 4.0. Ground truth: ann-benchmarks neighbors (first queries).

ModeSearch bytes/vectorSmaller than float32Disk total/vectorRecall@10No rerankPeak RSS (MiB)
float32 (flat)1,0241.0×1,2380.9846–839
SQ82564.0×3330.9768–633
PQ3232.0×700.5881–522
RaBitQ 4-bit1367.5×1,3810.98480.9133769
RaBitQ 2-bit ★ best trade-off7214.2×1,3120.98270.7652754
RaBitQ 1-bit4025.6×1,2770.94690.5859783

GloVe-100 (100-d, ann-benchmarks)

Source: http://ann-benchmarks.com/glove-100-angular.hdf5. Licence: GloVe vectors, PDDL 1.0. Ground truth: ann-benchmarks neighbors (first queries).

ModeSearch bytes/vectorSmaller than float32Disk total/vectorRecall@10No rerankPeak RSS (MiB)
float32 (flat)4001.0×6160.9999–1,620
SQ81004.0×1780.9765–1,332
PQ2516.0×680.3927–1,221
RaBitQ 4-bit ★ best trade-off586.9×6890.99990.84391,378
RaBitQ 2-bit3312.1×6550.97580.52941,414
RaBitQ 1-bit2119.0×6390.76850.23851,510

DBpedia, OpenAI ada-002 (1536-d, 100k)

Source: https://huggingface.co/datasets/KShivendu/dbpedia-entities-openai-1M. Licence: MIT (Hugging Face dataset card). Ground truth: numpy exact cosine brute force.

ModeSearch bytes/vectorSmaller than float32Disk total/vectorRecall@10No rerankPeak RSS (MiB)
float32 (flat)6,1441.0×6,2521.0000–1,397
SQ81,5364.0×1,5870.9963–977
PQ19232.0×2420.7882–835
RaBitQ 4-bit7767.9×7,3331.00000.94431,451
RaBitQ 2-bit39215.7×6,7951.00000.83541,415
RaBitQ 1-bit ★ best trade-off20030.7×6,5260.99990.70351,400

Synthetic clustered (768-d, seed 42)

Source: seeded clustered Gaussian (numpy, seed 42), offline. Licence: generated. Ground truth: numpy exact cosine brute force.

ModeSearch bytes/vectorSmaller than float32Disk total/vectorRecall@10No rerankPeak RSS (MiB)
float32 (flat)3,0721.0×4,1791.0000–452
SQ87684.0×1,0690.9637–323
PQ9632.0×1780.1235–285
RaBitQ 4-bit ★ best trade-off3927.8×4,6621.00000.7301467
RaBitQ 2-bit20015.4×4,4230.99000.3626450
RaBitQ 1-bit10429.5×4,3030.99340.1677452

PQ recall is low on every dataset here (see the tables). This is tracked in issue #95; use RaBitQ for compressed search until it is fixed.

  • CPU: AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (8 logical CPUs), 16.9 GiB RAM
  • OS: Linux 7.0.0-43-generic, Python 3.12.13
  • SrvDB 0.4.0, commit 6a3635f
  • Command: python benchmarks/social/run.py --crash
Terminal window
uv venv -p 3.12 .bench-venv
uv pip install -p .bench-venv/bin/python numpy matplotlib h5py pyarrow maturin
VIRTUAL_ENV=$PWD/.bench-venv .bench-venv/bin/maturin develop --release
.bench-venv/bin/python benchmarks/social/run.py

Datasets are downloaded by the benchmark script (never by SrvDB) into a gitignored cache and verified by size and SHA256. See benchmarks/social/README.md and the full report.