HNSW index

A vector index written from scratch in Rust — the graph, the search, the distance kernels. This page is the index describing itself: it holds this project’s own source, and every number below is measured on the query you run, not quoted from a benchmark.

waking the index…

Run a search

Benchmarks

50,000 vectors · dim 128 · k=10

From cargo run --release --example bench, clustered vectors, seeded and reproducible. Absolute numbers depend on hardware; the ratios hold.

methodef_searchlatency/queryrecall@10speedup
exhaustive scan5472 µs1.0001.0×
HNSW1049 µs0.980112×
HNSW2564 µs0.99586×
HNSW50106 µs1.00052×
HNSW100204 µs1.00027×
HNSW200379 µs1.00014×

Where it fails. On i.i.d. uniform vectors at dim 128 — a distribution real embeddings never follow — recall drops to 0.53 at ef=100 on the same corpus size. Uniform high-dimensional points sit at near-identical distances from each other, so there is no proximity structure for any graph to navigate; production implementations hit the same wall. BENCH_CLUSTERS=0 reproduces it.