Home

Awesome

LibVQ

A Library For Dense Retrieval Oriented Vector Quantization

Introduction

Vector quantization (VQ) is widely applied to many ANN libraries, like FAISS, ScaNN, SPTAG, DiskANN to facilitate real-time and memory-efficient dense retrieval. However, conventional vector quantization methods, like IVF, PQ, OPQ, are not optimized for the retrieval quality. In this place, We present LibVQ, the first library developed for dense retrieval oriented vector quantization. LibVQ is highlighted for the following features:

Install

git clone https://github.com/staoxiao/LibVQ.git
cd LibVQ
pip install .

Workflow

In LibVQ, users can construct a index and train it by a simple way. Please refer to our docs for more details. Besides, we provide some examples below to illustrate the usage of LibVQ.

Examples

MSMARCO

MethodsMRR@10Recall@10Recall@100
Faiss-IVFPQ0.13800.28200.5617
Faiss-IVFOPQ0.31020.55930.8148
Scann0.17910.34990.6345
LibVQ(contrastive_index)0.31790.57240.8214
LibVQ(distill_index)0.32530.57650.8256
LibVQ(distill_index_nolabel)0.32340.58130.8269
LibVQ(contrastive_index-and-query-encoder)0.31920.57990.8427
LibVQ(distill_index-and-query-encoder)0.33110.59070.8429
LibVQ(distill_index-and-query-encoder_nolabel)0.32850.58750.8401
MethodsMRR@10Recall@10Recall@100
Faiss-PQ0.11450.23690.5046
Faiss-OPQ0.32680.59390.8651
Scann0.17950.35160.6409
LibVQ(distill_index)0.34350.62030.8825
LibVQ(distill_index_nolabel)0.34670.61800.8849
LibVQ(distill_index-and-query-encoder)0.34460.62010.8837
LibVQ(distill_index-and-two-encoders)0.34750.62230.8901

NQ

MethodsRecall@5Recall@10Recall@20Recall@100
Faiss-IVFPQ0.15040.20520.27220.4523
Faiss-IVFOPQ0.33320.42790.51100.6817
Scann0.25260.33510.41440.6016
LibVQ(contrastive_index)0.33980.44150.52320.6911
LibVQ(distill_index)0.39520.49000.56670.7232
LibVQ(distill_index_nolabel)0.40660.49360.57590.7301
LibVQ(contrastive_index-and-query-encoder)0.35480.44700.53900.7120
LibVQ(distill_index-and-query-encoder)0.47250.56810.64290.7739
LibVQ(distill_index-and-query-encoder_nolabel)0.49770.58220.64840.7764
MethodsRecall@5Recall@10Recall@20Recall@100
Faiss-PQ0.13010.18610.24950.4188
Faiss-OPQ0.31660.41050.49610.6836
Scann0.25260.33510.41440.6013
LibVQ(distill_index)0.38170.48060.56810.7357
LibVQ(distill_index_nolabel)0.38800.48580.58190.7423
LibVQ(distill_index-and-query-encoder)0.47090.56890.64810.7930
LibVQ(distill_index-and-query-encoder_nolabel)0.48830.59030.66780.7914
LibVQ(distill_index-and-two-encoders)0.56370.65150.71710.8257
LibVQ(distill_index-and-two-encoders_nolabel)0.52850.61440.72960.8096

Related Work