Skip to content

@ruvector/diskann-wasm: browser/edge DiskANN via PQ-guided traversal + on-demand vector fetch #676

Description

@ohdearquant

Capstone of the ruvector-diskann series (#673, #674, #675): bring DiskANN to wasm.

Today: @ruvector/diskann is napi-native with per-platform binaries. There's no wasm artifact, even though the repo has a strong *-wasm crate pattern (micro-hnsw-wasm and ~20 siblings) — and DiskANN is arguably the index whose architecture benefits most from wasm.

Why DiskANN specifically works in a browser: a tab can't hold a large index in RAM and has no mmap, but the DiskANN split maps cleanly onto what browsers do have —

With #673 (PQ-guided traversal, so hops never touch full vectors) and #674 (storage abstraction behind FlatVectors), the wasm crate is mostly a thin wasm-bindgen layer plus an async vector-fetch trait. That yields larger-than-RAM ANN inside a browser tab, which very few libraries offer, plus one artifact covering everything outside the napi platform matrix (Alpine, other ARM Linuxes, edge runtimes).

Optional second rung: WebGPU batch kernels for index build, PQ k-means training, and bulk re-rank. Single-query search should stay on CPU — dispatch overhead dominates at the 55µs search latencies in ADR-144 — but build-in-browser is where a compute backend genuinely changes what's possible (Vamana build is single-threaded today, and wasm threads via SharedArrayBuffer are painful to ship in npm). We have WGSL ports of our Metal kernels and would wire them behind a feature flag.

We'd like to build this incrementally as the issues above land, each PR additive and measured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions