Email

Lab / Vector search

Vector search in your browser.

A Rust HNSW graph searches 59 passages from this site. The WebAssembly engine is 18.5 KB when gzipped.

59
chunks indexed
384
dimensions per vector
22.9 KB
int8 vector payload
23.0 KB
keyword index

What this is

The site search starts with BM25 keyword matching. Optional semantic search uses an HNSW graph over int8 vectors. This demo exposes that graph, built by Index::build when you open the page.

I implemented graph construction, neighbour selection, search, the quantised vector format, and WebAssembly bindings in crates/hnsw/src/.

With only 59 passages, a full scan is a useful baseline. Each recall measurement compares the graph's results against brute_force. Timings are measured in this tab.

Loading the index…

Where the code is

crates/hnsw/src/hnsw.rs is the algorithm, with no WebAssembly in it: construction, ALG 4’s neighbour heuristic, the layer descent, and a brute-force scan kept for grading. quant.rs is the on-the-wire vector format. lib.rs handles the JavaScript boundary and the introspection API used here. The Rust tests compare recall with exhaustive search results.