Skip to main content

The RaBitQ Library

New: We have recently open-sourced the GPU implementation of RaBitQ for high-dimensional vector search. See cuvs_rabitq.

The RaBitQ Library provides efficient and lightweight implementations of the RaBitQ quantization algorithm (1-bit version and multi-bit version) and its applications in high-dimensional vector search. It also provides a GPU implementation. The core algorithm RaBitQ is based on the research from VectorDB group at Nanyang Technological University, Singapore.

The library is developped by Yutong Gou, Jianyang Gao, Yuexuan Xu, Jifan Shi and Zhonghao Yang.

The library provides the following key features:

  • RaBitQ - a vector quantization algorithm as a drop-in replacement of binary and scalar quantization, offering an optimal theoretical error bound
  • RaBitQ for Vector Search - a reference implementation of RaBitQ's combination with popular vector search indexes

RaBitQLib supports estimating similarity metrics including Euclidean distance, inner product and cosine similarity.

RaBitQ

RaBitQ is a vector quantization algorithm as a drop-in replacement of binary and scalar quantization. The key advantages of RaBitQ include

  • High Accuracy with Tiny Space - RaBitQ achieves the state-of-the-art accuracy under diverse bit-width for the estimation of similarity metrics. It produces promising accuracy with even 1-bit per dimension.
  • Fast Distance Estimation - RaBitQ supports to estimate the similarity metrics with high efficiency based on bitwise operations or FastScan.
  • Theoretical Error Bound - RaBitQ provides an asymptotically optimal error bound for the estimation of distances and inner product. The error bound can be used for reliable ordering and reranking.

In this library, we provide simple interfaces to support advanced features of RaBitQ. The details are presented in the documentation.

RaBitQ for Vector Search

In the library, RaBitQ is combined with IVF, HNSW and QG to deliever different trade-offs among time, space and accuracy.

Using RaBitQ with IVF and HNSW targets a balance between memory consumption and query performance. Only the quantization codes produced by RaBitQ are stored and the raw data vectors are not accessed during querying. Thus, these methods consume less memory than the raw dataset. Using 4-bit, 5-bit and 7-bit quantization usually suffices to produce 90%, 95% and 99% recall respectively without reranking.

Using RaBitQ with QG targets the best query performance by using more memory. It creates multiple quantization codes for every vector to optimize the data access pattern. Thus, QG usually consumes 2x memory of the raw dataset.

RaBitQ in Industry

The RaBitQ algorithm has been implemented in many real-world systems in industry including

  • Milvus - IVF + RaBitQ (C++)
  • Faiss - IVF + RaBitQ (C++)
  • VSAG - HGraph + RaBitQ (C++)
  • VectorChord - IVF + RaBitQ (Rust)
  • Volcengine OpenSearch - DiskANN + RaBitQ
  • CockroachDB - CSPANN + RaBitQ (Golang)
  • ElasticSearch - HNSW + RaBitQ (Java - the algorithm is adopted with some minor modifications and renamed as "BBQ")
  • Lucene - HNSW + RaBitQ (Java - the algorithm is adopted with some minor modifications and renamed as "BBQ")
  • turbopuffer - SPFresh + RaBitQ

Acknowledgement

We acknowledge Alexandr Guzhva, Li Liu, Chao Gao, Silu Huang, Jiabao Jin, Xiaoyao Zhong and Jinjing Zhou for valuable feedbacks.

Reference

Please provide a reference of our paper if it helps in your systems or research projects.

Jianyang Gao, Yutong Gou, Yuexuan Xu, Yongyi Yang, Cheng Long, Raymond Chi-Wing Wong, 
"Practical and Asymptotically Optimal Quantization of High-Dimensional Vectors in Euclidean Space for Approximate Nearest Neighbor Search", 
SIGMOD 2025, available at https://arxiv.org/abs/2409.09913

Metadata

Release files for rabitq 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rabitq 0.0.1
File Size Uploaded Provenance
rabitq-0.0.1.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rabitq 0.0.1
File Interpreter ABI Platform
rabitq-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / rabitq-0.0.1.tar.gz

Download URL rabitq-0.0.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e4f2405d08389212e358eb1e65c1f2fb450c217e78ba52f4fa59cfbd7dac1516
BLAKE2b-256 checksum
How to use checksums
07e79f03c5f806cad597681da5706e02114bccc4c5bba87b8d1e589a90a8b2fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / rabitq-0.0.1-py3-none-any.whl

Download URL rabitq-0.0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bc61bc43c53349f38d9d8addf4f21c3be967060803fa68c32d4783a4a7a8fb6
BLAKE2b-256 checksum
How to use checksums
3f1c27ff99ef2098aa252d40d0a3aafc0d6e50f34ca608a2b1f167632804cf93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for rabitq 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page