← Home
BrowserVec Examples
In-browser WebGPU vector store — learn every concept through runnable examples.
Most examples run on any browser via BrowserVec's CPU fallback; the quantization/IVF-focused examples (02, 03, 04, 09-worker-ingest, 10-chunking) require WebGPU.
Real-world use cases
Core concepts
- M1 Basic flat search fp32 brute-force GPU scan with cosine, dot, and L2 metrics
- M3 TurboQuant quantization int8 / int4 quantized storage with asymmetric query + exact re-rank
- M4 IVF approximate index cluster-based ANN, nprobe sweep, recall vs speed trade-off
- M4 IVF × quant combo clustered + quantized — the 1M-vector path with int8 or int4
- M4 IVF auto-tuning targetRecall picks nprobe for you — recall estimated on your own data at build time
- M7 HNSW graph index graph-based ANN, efSearch sweep, incremental inserts, works without WebGPU
- M7b GPU graph search CAGRA-style beam search in one dispatch — queryBatch, CPU vs GPU crossover
- React React hooks useVectorStore, useSimilaritySearch, useEmbedding, useRetriever — reusable React patterns
- Vue Vue composables useVectorStore, useSimilaritySearch, useEmbedding, useRetriever — reusable Vue patterns
Text & embeddings
Persistence & encryption
Data management
Performance & scale
- NFR-8 Worker ingest rotate+quantize offloaded to a Web Worker — no main-thread freeze
- NFR-10 Corpus chunking spread vectors across multiple GPU buffers past the per-buffer limit
- Bench Performance benchmark Large-scale perf test: ingest rate, query latency, recall across index types
- Bench Benchmark dashboard BrowserVec vs. hnswlib-wasm vs. voy-search vs. Orama vs. Vectorious vs. naive JS — latency, CPU/GPU/transfer breakdown, recall, memory (synthetic vectors)
- Bench Real-embeddings benchmark BrowserVec only (flat/int8/1-bit), real sentence embeddings (MiniLM, BGE, E5, Nomic) over 180 real documents, plus qualitative semantic search
Open each in a WebGPU-capable browser after running npm run dev.