Skip to content

RaBitQ Library · C++17 & Python

Vector search with
compact RaBitQ codes.

Compress vectors and search for nearest neighbors. RaBitQ estimates distances from 1–9-bit codes with a theoretical error bound, and its multi-bit extension is asymptotically optimal. Use ready-made indexes in Python or C++, or integrate quantization and distance estimation into your own C++ search engine.

python -m pip install "rabitqlib>=0.8.5"

Installation and supported platforms · How RaBitQ works

Choose your index

All three indexes support L2 and inner-product search, with save/load support. Start with IVF-RaBitQ for the complete introductory example, then compare on your own data.

IVF-RaBitQ

Search selected clusters of compressed vectors. Tune the bit width and number of clusters probed to balance storage, recall, and query time.

Updates: append and remove vectors.

GIST1M, 5-bit: 976 QPS at 93.3% Recall@10; 0.60 GiB index.

HNSW-RaBitQ

Traverse a graph over compressed vectors. Graph links add storage; tune the search window and graph degree alongside the code precision.

Updates: append and remove vectors.

GIST1M, 5-bit: 2,027 QPS at 92.7% Recall@10; 0.72 GiB index.

SymphonyQG

Build a graph directly from vectors, without a separate clustering step. Combine batched neighbor scoring with raw or 4/8-bit vector storage.

Updates: rebuild to change the dataset.

GIST1M, 4-bit: 3,070 QPS at 90.5% Recall@10; 4.39 GiB index.

For input shapes, distance conventions, memory estimates, and threading, see shared index contracts.

Build on the library

  • Bring your own storage: use the stable C++ core API to encode vectors and estimate distances in caller-owned buffers. Add FastScan for batch scoring.
  • Train clusters: use RaBitQKMeans or QGKMeans to prepare centroids and assignments for IVF-RaBitQ or HNSW-RaBitQ.

Compare measured performance

The GIST1M numbers above are the fastest measured setting with Recall@10 ≥ 90%, using one search thread and one query per call with RaBitQ-Library 0.8.2; index size is serialized storage. See the benchmark results for datasets, baselines, settings, and limitations. Evaluate recall and query time on your own dataset when choosing an index.

Built with RaBitQ-Library

  • txtai uses the Python IVF-RaBitQ and HNSW-RaBitQ indexes as an embedding-search backend. See how to select the backend and its search settings.
  • zvec uses core quantization in its IVF-RaBitQ and HNSW-RaBitQ implementations, with FastScan batch scoring in IVF-RaBitQ. See the integration walkthrough for storage, scoring, and platform boundaries.

Explore further