A 10 million document corpus takes 31 GB of RAM as float32. turbovec fits it in 4 GB – and searches it faster than FAISS.
turbovec is a Rust vector index with Python bindings, built on Google Research’sTurboQuantalgorithm — a data-oblivious quantizer with near-optimal distortion and no separate training phase.
Building RAG where privacy, memory, or latency matters?You’re in the right place.
vectorsandqueryare 2-Dfloat32arrays of shape(n, dim)— other dtypes are rejected rather than silently converted, so cast withnp.asarray(x, dtype=np.float32)first if needed.
Need stable ids that survive deletes? UseIdMapIndex:
Restrict results to a candidate set produced by another system (SQL, BM25, ACL, time window, …):
Filtering happens inside the SIMD kernel at 32-vector block granularity: blocks with no allowed slots are short-circuited before any LUT lookup or scoring work, and individual non-allowed slots inside scored blocks are dropped at heap-insert. Selective allowlists (small fraction of the index allowed) therefore avoid most of the SIMD cost rather than paying it and discarding the result afterwards.
The output length ismin(k, n_allowed), wheren_allowedcountsdistinctallowed vectors — when fewer vectors are allowed thankyou get exactly that many results rather than padded fallbacks.
Seedocs/api.mdfor the full reference.
Drop-in replacements for the in-tree reference vector / document stores in each framework. Same public surface, same persistence semantics, same retriever and pipeline wiring — swap the import and keep your pipeline.
For stable external ids that survive deletes:
TurboQuant vs FAISSIndexPQ(LUT256, nbits=8) — the paper’s Section 4.4 baseline. 100K vectors, k=64. FAISS PQ sub-quantizer counts sized to match TurboQuant’s bit rate (m=d/4 at 2-bit, m=d/2 at 4-bit).