Skip to content

turbovec

A compressed vector search index for Python and Rust that runs inside your own process.

Stars
17.5k
Forks
1.5k
Licence
MIT
Language
Rust
Last update
30 days ago
Type
Library

What it is

turbovec stores embedding vectors (lists of numbers that represent text or other content) in a compressed form using 2 or 4 bits per dimension, based on Google Research's TurboQuant method. It then finds the vectors closest to a query, which is the core step in semantic search and retrieval-augmented generation (RAG). It runs as a library inside your program rather than as a separate server.

  • Index a set of 1536-dimensional embeddings in memory and run top-k nearest-neighbour searches
  • Save an index to disk with sync() so later changes are written incrementally
  • Use IdMapIndex to keep your own uint64 ids and remove entries by id
  • Restrict searches to an allowlist of ids approved by another system
  • Plug it into a LangChain, LlamaIndex, Haystack or Agno retriever

Great for

  • Python or Rust developers building semantic search over a few million or fewer embeddings on a single machine
  • RAG pipelines that need a local, offline vector store
  • Projects where memory use for embeddings is a constraint
  • Apps that frequently add and remove vectors and need fast updates
  • Teams already using LangChain, LlamaIndex, Haystack or Agno who want a drop-in store

Not ideal for

  • Very large corpora with strict latency needs: the README says turbovec scans every vector and suggests a graph index such as HNSW for hundreds of millions of vectors
  • Cases needing exact float results, since quantization is lossy and recall depends on your data
  • Teams wanting a hosted or networked vector database, because it has no server, replication or multi-tenant API
  • Vectors whose dimension is not a multiple of 8 or exceeds 16,384, since those are stated limits
Step-by-step guide: how to use turbovecInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python (version not stated in the README excerpt) or Rust with Cargo · NumPy for Python usage

    Install the Python package

    pip install turbovec

    Add the Rust crate

    cargo add turbovec
  2. 2

    Run it

    • Install turbovec with pip install turbovec or cargo add turbovec
    • Load your embeddings as a 2-D float32 NumPy array of shape (n, dim)
    • Create a TurboQuantIndex with dim and bit_width=4, then call add() with your vectors
    • Call search() with a query vector and k to get scores and slot indices
    • Call sync() to save the index to a file
  3. 3

    Get the most out of it

    • Use IdMapIndex with your own uint64 ids so results map directly to your records and deletes stay O(1)
    • Use sync() instead of repeated full writes, since it saves only changes since the last call
    • Pass an allowlist to search() to filter results by ids from a SQL query, ACL or time window
    • Run calibrate(sample) on data that drifts from the asymptotic distribution, per the README's description of the optional step
    • Normalise vectors if you want cosine similarity, since scores are inner products

Downloads

Strengths

  • Much lower memory use than float32 storage: the README reports 7.8× smaller at 4-bit and 15.5× at 2-bit
  • Benchmarks in the README show faster search than FAISS at matched recall, on the stated hardware and corpora
  • Runs locally with no network service, and supports incremental, crash-safe saves

Trade-offs

  • Search cost grows linearly with corpus size because it scans every vector, per the README's own benchmarks
  • Quantization is lossy, so top results can differ from exact float search; the README says to check recall on your own data
  • Benchmarks are the author's, run on specific GCP machines, so results on your hardware may differ

How it compares

ProjectStarsTypeLevelUpdatedBest for
turbovec (this)17.5kLibraryintermediate30 days agoPython or Rust developers building semantic search over a few million or fewer embeddings on a single machine
faiss41.2kLibraryintermediate4 days agoDevelopers building semantic search or recommendation features over embedding vectors
LEANN13.8kLibraryintermediate4 days agoDevelopers building a private RAG prototype on a personal machine
llama_index52.8kLibraryintermediate10 days agoPython developers building retrieval-augmented generation (RAG) apps over private documents
LightRAG40.5kLibraryintermediate8 days agoDevelopers building question-answering over their own document collections
PageIndex40kLibraryintermediate7 days agoDevelopers building question-answering over long PDFs such as annual reports or manuals

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.