turboquant-js
A zero-dependency TypeScript implementation of Google's TurboQuant vector quantization algorithm that runs in both Node.js and browsers, for compressing embeddings used in search, retrieval-augmented generation and LLM key-value caches.
turboquant-js implements the TurboQuant algorithm for near-optimal, data-oblivious vector quantization, achieving distortion within about 2.7x of information-theoretic lower bounds with no training or fine-tuning step. A two-stage quantization scheme gives unbiased dot-product estimates, which the library exposes through two application APIs: VectorIndex for nearest-neighbor search and KVCacheCompressor for compressing LLM attention keys and values.
Because it has no runtime dependencies and a small bundle size, it is intended for client-side use cases such as semantic search over bookmarks or notes inside a browser extension, offline-capable retrieval-augmented generation with a local model, in-browser document search, and deployment on edge runtimes such as Cloudflare Workers or Vercel Edge Functions where WebAssembly is not an option. It also supports deterministic, seeded vector search for reproducible tests without a running vector database.
It installs from npm and runs the same way in Node.js and in browsers.