vexdbLive demo
A Vector Database in Rust
- Rust
- HNSW
- SIMD
- WASM
- axum
- proptest
Overview
vexdb is a vector database written from scratch in Rust. It has a hand-rolled HNSW index following Malkov and Yashunin — including Algorithm 4 neighbour selection with keepPrunedConnections — AVX2 distance kernels, binary snapshot persistence, payload filtering evaluated during beam traversal, and a Qdrant-shaped HTTP API on axum. There are no faiss bindings anywhere in it.
Using a vector database teaches you its API. Writing one teaches you why the API looks like that: why recall is a tuning knob rather than a guarantee, why the graph's degree bound governs memory, why the distance kernel is the only inner loop that matters. Eleven checkpointed phases later, the engine is backed by 67 tests including proptest cases at 256 generated cases each — because a layered proximity graph has invariants that example-based tests simply cannot cover.
The honest result of the faiss comparison: recall tracks faiss within ±0.03 at every ef_search setting, so the graph construction is sound. faiss is still 2 to 2.5× faster in queries per second, and profiling puts that gap in distance-kernel throughput rather than in graph quality — faiss has years of hand-tuned kernel work that a single-author AVX2 implementation does not. Adding SIMD closed part of it: 2.5× faster builds and roughly 2× query throughput over the scalar baseline.
The Benchmark
Both indexes were built over identical splitmix64-generated data with identical parameters and queried single-threaded on the same machine. Recall and throughput are reported at each ef_search setting rather than as a single headline number, because a vector index without its recall operating point is not a measurement.
| ef_search | vexdb recall@10 | vexdb QPS | faiss recall@10 | faiss QPS |
|---|---|---|---|---|
| 10 | 0.431 | 19,610 | 0.459 | 41,351 |
| 20 | 0.602 | 11,753 | 0.630 | 29,235 |
| 40 | 0.773 | 6,930 | 0.801 | 17,608 |
| 80 | 0.916 | 4,022 | 0.933 | 9,628 |
| 160 | 0.973 | 1,989 | 0.986 | 5,190 |
| 320 | 0.995 | 1,033 | 0.998 | 2,624 |
100k vectors × dim 32, k=10, M=16, efConstruction=200 · identical splitmix64-generated data · single thread · x86_64 with AVX2+FMA.
Exact (flat) baseline: vexdb 504 QPS, faiss 1,058 QPS.
Build time: vexdb 48.4s, faiss 31.1s.
See It In Action
The demo site carries the full write-up — the phase-by-phase build log, the SIMD work, the filtering design, and the complete benchmark methodology.