About this project
turbovec is a vector index implemented in Rust and exposed to Python through bindings. It is built around Google Research's TurboQuant algorithm, a data-oblivious quantization approach that uses normalization, a fixed random rotation, distribution-based Lloyd-Max scalar quantization, bit-packing, and length-renormalized inner-product scoring. The project targets memory-constrained, low-latency local vector search and does not require a managed service.
The main TurboQuantIndex is created with a dimension and bit width, with 2-bit and 4-bit indexing documented. Vectors are added incrementally without a separate training step, parameter-tuning phase, or index rebuild. Python inputs use float32 NumPy arrays; other dtypes are rejected rather than silently converted. The API provides add, search, write, load, and sync operations. Search returns scores and indices for the requested k nearest results.
IdMapIndex adds stable uint64 external IDs, add_with_ids, and O(1) removal by ID according to the documentation. It supports the same whole-file write/load workflow and incremental sync persistence. The sync method is described as persisting only changes since the previous sync, using one fsync per call and allowing small appends or removals without rewriting the entire index. write and load remain available for complete snapshots.
Filtered or hybrid retrieval is supported through an ID allowlist or slot bitmask passed to search. The allowlist can come from an external system such as SQL, BM25, access-control logic, or a time filter. The README states that filtering is applied inside the SIMD search kernel, blocks without allowed vectors are skipped, and the result count is min(k, number of distinct allowed vectors).
Search uses hand-written SIMD kernels with runtime feature selection. Documented targets include ARM NEON SDOT/SMMLA, x86 AVX-512 VNNI and vpermb, plus AVX2 and scalar fallbacks. The Rust build uses an x86-64-v2 baseline while enabling newer kernels on supporting hardware. Multi-threading is provided through Rayon in the described benchmark configuration.
An optional TQ+ calibration step can fit per-coordinate shift and scale values from a representative sample before indexing. The README describes this as improving recall in finite-dimensional or low-bit settings, particularly GloVe-style embeddings, while remaining reusable for subsequent additions. An uncalibrated index uses plain TurboQuant.
Python installation is available through pip, and Rust usage through cargo add turbovec. The project documents optional integrations for LangChain, LlamaIndex, Haystack, and Agno, positioned as drop-in replacements for their in-memory or reference vector stores. These integrations are installed through optional package extras.
The repository includes project-run benchmarks comparing turbovec with FAISS IndexPQFastScan and IndexPQ configurations. The README reports lower memory use, faster measured search in its tested ARM and x86 configurations, insertion and removal latency measurements, recall charts, compression results, and save/load timings. These are supplied benchmark results rather than independent third-party measurements. Scripts for downloading GloVe and OpenAI embedding datasets, running recall/speed/compression suites, saving JSON results, and regenerating charts are included in the benchmarks directory.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.