Skip to main content

Reserved package name

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rabitqlib-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rabitqlib-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file rabitqlib-0.0.1.tar.gz.

File metadata

  • Download URL: rabitqlib-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for rabitqlib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5fc4854ed4bd1f47cee89eab563a542ce17e7dbe374ccb50d2bbe08bdd45aec9
MD5 b9cbd23c621772d63707830b2368b498
BLAKE2b-256 fd54a39fa5f11a2faec3d3de5a24a9542128badf81e3162f3e82274ebed6a56a

See more details on using hashes here.

File details

Details for the file rabitqlib-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rabitqlib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for rabitqlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc1730420b07da73929eebf01284a3f4d3116f29d5e9c6d808aa18ef9f71af75
MD5 646b8d1b66743242df31fb10e005e2d0
BLAKE2b-256 b8f696ef3023ecb4fb5de1670b82d1d4e983c967e8c89c71409c600440f8f94d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page