--- language: - en tags: - ColBERT - PyLate - sentence-transformers - sentence-similarity - feature-extraction - generated_from_trainer - dataset_size:640000 - loss:Distillation datasets: - lightonai/ms-marco-en-bge-gemma pipeline_tag: sentence-similarity library_name: PyLate metrics: - MaxSim_accuracy@1 - MaxSim_accuracy@3 - MaxSim_accuracy@5 - MaxSim_accuracy@10 - MaxSim_precision@1 - MaxSim_precision@3 - MaxSim_precision@5 - MaxSim_precision@10 - MaxSim_recall@1 - MaxSim_recall@3 - MaxSim_recall@5 - MaxSim_recall@10 - MaxSim_ndcg@10 - MaxSim_mrr@10 - MaxSim_map@100 model-index: - name: PyLate results: - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoClimateFEVER type: NanoClimateFEVER metrics: - type: MaxSim_accuracy@1 value: 0.28 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.6 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.66 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.8 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.28 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.21333333333333332 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.15600000000000003 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.11399999999999999 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.14166666666666664 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.28 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.3233333333333333 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.4433333333333333 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.3514515373411296 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.4419126984126984 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.26787129909036694 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoDBPedia type: NanoDBPedia metrics: - type: MaxSim_accuracy@1 value: 0.8 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.9 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.92 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.94 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.8 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.68 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.64 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.556 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.10146114576120233 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.1811253111210503 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.25584250683060056 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.38805909088160134 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.6860171601389934 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.8573333333333334 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.5296825033597241 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoFEVER type: NanoFEVER metrics: - type: MaxSim_accuracy@1 value: 0.86 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.96 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 1.0 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 1.0 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.86 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.32666666666666666 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.20799999999999996 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.10399999999999998 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.8166666666666668 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.9066666666666667 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.9566666666666667 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.9566666666666667 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.908144200292094 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.92 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.8814609006793713 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoFiQA2018 type: NanoFiQA2018 metrics: - type: MaxSim_accuracy@1 value: 0.52 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.64 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.7 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.82 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.52 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.3 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.23199999999999996 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.144 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.3260793650793651 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.4550714285714285 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.5179523809523809 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.638452380952381 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.5521515882834523 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.6033809523809524 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.485613722262918 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoHotpotQA type: NanoHotpotQA metrics: - type: MaxSim_accuracy@1 value: 0.9 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.98 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 1.0 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 1.0 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.9 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.5333333333333333 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.3399999999999999 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.17399999999999996 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.45 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.8 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.85 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.87 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.8419623803570458 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.9440000000000001 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.7820805143551045 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoMSMARCO type: NanoMSMARCO metrics: - type: MaxSim_accuracy@1 value: 0.52 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.68 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.76 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.86 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.52 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.22666666666666666 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.15200000000000002 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.08599999999999998 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.52 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.68 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.76 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.86 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.6811314480568632 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.6250238095238094 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.6333976362474815 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoNFCorpus type: NanoNFCorpus metrics: - type: MaxSim_accuracy@1 value: 0.44 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.6 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.62 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.72 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.44 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.3933333333333333 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.35200000000000004 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.264 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.04230874849281337 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.08146626368119848 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.09815206535035287 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.12479201912898642 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.33242903156565573 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.5284126984126984 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.15006576918781514 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoNQ type: NanoNQ metrics: - type: MaxSim_accuracy@1 value: 0.5 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.74 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.86 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.9 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.5 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.24666666666666667 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.17599999999999993 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.09599999999999997 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.49 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.7 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.82 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.86 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.6841974176648971 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.6358888888888888 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.6241807081807081 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoQuoraRetrieval type: NanoQuoraRetrieval metrics: - type: MaxSim_accuracy@1 value: 0.88 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.98 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 1.0 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 1.0 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.88 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.3999999999999999 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.25999999999999995 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.13799999999999998 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.7673333333333333 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.9386666666666668 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.9793333333333334 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.9966666666666666 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.9419539850914371 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.934 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.9163896103896104 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoSCIDOCS type: NanoSCIDOCS metrics: - type: MaxSim_accuracy@1 value: 0.5 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.72 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.82 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.84 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.5 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.36666666666666664 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.284 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.182 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.10566666666666666 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.22666666666666666 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.29166666666666663 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.37166666666666665 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.3831880691359888 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.6239999999999999 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.29330717965633857 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoArguAna type: NanoArguAna metrics: - type: MaxSim_accuracy@1 value: 0.16 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.56 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.66 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.76 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.16 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.18666666666666668 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.13200000000000003 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.07600000000000001 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.16 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.56 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.66 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.76 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.461790847680295 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.365547619047619 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.3743204230050349 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoSciFact type: NanoSciFact metrics: - type: MaxSim_accuracy@1 value: 0.74 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.82 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.84 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.88 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.74 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.29333333333333333 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.18799999999999997 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.09799999999999999 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.705 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.795 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.83 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.87 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.8015954255022331 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.786388888888889 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.780149020175336 name: Maxsim Map@100 - task: type: py-late-information-retrieval name: Py Late Information Retrieval dataset: name: NanoTouche2020 type: NanoTouche2020 metrics: - type: MaxSim_accuracy@1 value: 0.7959183673469388 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.9795918367346939 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.9795918367346939 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 1.0 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.7959183673469388 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.7142857142857143 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.6653061224489795 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.5244897959183673 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.054514709716006485 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.14494235624957325 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.2233145114601526 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.3397163035501697 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.6049106751999275 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.8770651117589893 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.4446934096215408 name: Maxsim Map@100 - task: type: nano-beir name: Nano BEIR dataset: name: NanoBEIR mean type: NanoBEIR_mean metrics: - type: MaxSim_accuracy@1 value: 0.6073783359497645 name: Maxsim Accuracy@1 - type: MaxSim_accuracy@3 value: 0.7815070643642071 name: Maxsim Accuracy@3 - type: MaxSim_accuracy@5 value: 0.8322762951334379 name: Maxsim Accuracy@5 - type: MaxSim_accuracy@10 value: 0.8861538461538461 name: Maxsim Accuracy@10 - type: MaxSim_precision@1 value: 0.6073783359497645 name: Maxsim Precision@1 - type: MaxSim_precision@3 value: 0.3754578754578754 name: Maxsim Precision@3 - type: MaxSim_precision@5 value: 0.2911773940345369 name: Maxsim Precision@5 - type: MaxSim_precision@10 value: 0.19665306122448975 name: Maxsim Precision@10 - type: MaxSim_recall@1 value: 0.36005363864482465 name: Maxsim Recall@1 - type: MaxSim_recall@3 value: 0.5192004122787115 name: Maxsim Recall@3 - type: MaxSim_recall@5 value: 0.5820201126610375 name: Maxsim Recall@5 - type: MaxSim_recall@10 value: 0.652257932911267 name: Maxsim Recall@10 - type: MaxSim_ndcg@10 value: 0.6331479820238474 name: Maxsim Ndcg@10 - type: MaxSim_mrr@10 value: 0.7033041538959905 name: Maxsim Mrr@10 - type: MaxSim_map@100 value: 0.5510163612470269 name: Maxsim Map@100 --- # PyLate This is a [PyLate](https://github.com/lightonai/pylate) model trained on the [`lightonai/ms-marco-en-bge-gemma`](https://huggingface.co/datasets/lightonai/ms-marco-en-bge-gemma) dataset. It maps sentences & paragraphs to sequences of 128-dimensional dense vectors and can be used for semantic textual similarity using the MaxSim operator. ## Model Details This model is an alias of [`robro612/modernbert_xtr_kd_256`](https://huggingface.co/robro612/modernbert_xtr_kd_k256). It was KD-trained on [`lightonai/ms-marco-en-bge-gemma`](https://huggingface.co/datasets/lightonai/ms-marco-en-bge-gemma) and contrastively trained on [`bclavie/msmarco-10m-triplets`](https://huggingface.co/datasets/bclavie/msmarco-10m-triplets) with XTR's `k_train` set to 256. ### Model Description - **Model Type:** PyLate model - **Document Length:** 512 tokens - **Query Length:** 32 tokens - **Output Dimensionality:** 128 tokens - **Similarity Function:** MaxSim - **Training Dataset:** - [train](https://huggingface.co/datasets/lightonai/ms-marco-en-bge-gemma) - **Language:** en ### Model Sources - **Documentation:** [PyLate Documentation](https://lightonai.github.io/pylate/) - **Repository:** [PyLate on GitHub](https://github.com/lightonai/pylate) - **Hugging Face:** [PyLate models on Hugging Face](https://huggingface.co/models?library=PyLate) ### Full Model Architecture ``` ColBERT( (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'ModernBertModel'}) (1): Dense({'in_features': 768, 'out_features': 128, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'use_residual': False}) ) ``` ## Usage First install the PyLate library: ```bash pip install -U pylate ``` ### Retrieval Use this model with PyLate to index and retrieve documents. The index uses [FastPLAID](https://github.com/lightonai/fast-plaid) for efficient similarity search. #### Indexing documents Load the ColBERT model and initialize the PLAID index, then encode and index your documents: ```python from pylate import indexes, models, retrieve # Step 1: Load the ColBERT model model = models.ColBERT( model_name_or_path="pylate_model_id", ) # Step 2: Initialize the PLAID index index = indexes.PLAID( index_folder="pylate-index", index_name="index", override=True, # This overwrites the existing index if any ) # Step 3: Encode the documents documents_ids = ["1", "2", "3"] documents = ["document 1 text", "document 2 text", "document 3 text"] documents_embeddings = model.encode( documents, batch_size=32, is_query=False, # Ensure that it is set to False to indicate that these are documents, not queries show_progress_bar=True, ) # Step 4: Add document embeddings to the index by providing embeddings and corresponding ids index.add_documents( documents_ids=documents_ids, documents_embeddings=documents_embeddings, ) ``` Note that you do not have to recreate the index and encode the documents every time. Once you have created an index and added the documents, you can re-use the index later by loading it: ```python # To load an index, simply instantiate it with the correct folder/name and without overriding it index = indexes.PLAID( index_folder="pylate-index", index_name="index", ) ``` #### Retrieving top-k documents for queries Once the documents are indexed, you can retrieve the top-k most relevant documents for a given set of queries. To do so, initialize the ColBERT retriever with the index you want to search in, encode the queries and then retrieve the top-k documents to get the top matches ids and relevance scores: ```python # Step 1: Initialize the ColBERT retriever retriever = retrieve.ColBERT(index=index) # Step 2: Encode the queries queries_embeddings = model.encode( ["query for document 3", "query for document 1"], batch_size=32, is_query=True, # # Ensure that it is set to False to indicate that these are queries show_progress_bar=True, ) # Step 3: Retrieve top-k documents scores = retriever.retrieve( queries_embeddings=queries_embeddings, k=10, # Retrieve the top 10 matches for each query ) ``` ### Reranking If you only want to use the ColBERT model to perform reranking on top of your first-stage retrieval pipeline without building an index, you can simply use rank function and pass the queries and documents to rerank: ```python from pylate import rank, models queries = [ "query A", "query B", ] documents = [ ["document A", "document B"], ["document 1", "document C", "document B"], ] documents_ids = [ [1, 2], [1, 3, 2], ] model = models.ColBERT( model_name_or_path="pylate_model_id", ) queries_embeddings = model.encode( queries, is_query=True, ) documents_embeddings = model.encode( documents, is_query=False, ) reranked_documents = rank.rerank( documents_ids=documents_ids, queries_embeddings=queries_embeddings, documents_embeddings=documents_embeddings, ) ``` ## Evaluation ### Metrics #### Py Late Information Retrieval * Dataset: `['NanoClimateFEVER', 'NanoDBPedia', 'NanoFEVER', 'NanoFiQA2018', 'NanoHotpotQA', 'NanoMSMARCO', 'NanoNFCorpus', 'NanoNQ', 'NanoQuoraRetrieval', 'NanoSCIDOCS', 'NanoArguAna', 'NanoSciFact', 'NanoTouche2020']` * Evaluated with pylate.evaluation.pylate_information_retrieval_evaluator.PyLateInformationRetrievalEvaluator | Metric | NanoClimateFEVER | NanoDBPedia | NanoFEVER | NanoFiQA2018 | NanoHotpotQA | NanoMSMARCO | NanoNFCorpus | NanoNQ | NanoQuoraRetrieval | NanoSCIDOCS | NanoArguAna | NanoSciFact | NanoTouche2020 | |:--------------------|:-----------------|:------------|:-----------|:-------------|:-------------|:------------|:-------------|:-----------|:-------------------|:------------|:------------|:------------|:---------------| | MaxSim_accuracy@1 | 0.28 | 0.8 | 0.86 | 0.52 | 0.9 | 0.52 | 0.44 | 0.5 | 0.88 | 0.5 | 0.16 | 0.74 | 0.7959 | | MaxSim_accuracy@3 | 0.6 | 0.9 | 0.96 | 0.64 | 0.98 | 0.68 | 0.6 | 0.74 | 0.98 | 0.72 | 0.56 | 0.82 | 0.9796 | | MaxSim_accuracy@5 | 0.66 | 0.92 | 1.0 | 0.7 | 1.0 | 0.76 | 0.62 | 0.86 | 1.0 | 0.82 | 0.66 | 0.84 | 0.9796 | | MaxSim_accuracy@10 | 0.8 | 0.94 | 1.0 | 0.82 | 1.0 | 0.86 | 0.72 | 0.9 | 1.0 | 0.84 | 0.76 | 0.88 | 1.0 | | MaxSim_precision@1 | 0.28 | 0.8 | 0.86 | 0.52 | 0.9 | 0.52 | 0.44 | 0.5 | 0.88 | 0.5 | 0.16 | 0.74 | 0.7959 | | MaxSim_precision@3 | 0.2133 | 0.68 | 0.3267 | 0.3 | 0.5333 | 0.2267 | 0.3933 | 0.2467 | 0.4 | 0.3667 | 0.1867 | 0.2933 | 0.7143 | | MaxSim_precision@5 | 0.156 | 0.64 | 0.208 | 0.232 | 0.34 | 0.152 | 0.352 | 0.176 | 0.26 | 0.284 | 0.132 | 0.188 | 0.6653 | | MaxSim_precision@10 | 0.114 | 0.556 | 0.104 | 0.144 | 0.174 | 0.086 | 0.264 | 0.096 | 0.138 | 0.182 | 0.076 | 0.098 | 0.5245 | | MaxSim_recall@1 | 0.1417 | 0.1015 | 0.8167 | 0.3261 | 0.45 | 0.52 | 0.0423 | 0.49 | 0.7673 | 0.1057 | 0.16 | 0.705 | 0.0545 | | MaxSim_recall@3 | 0.28 | 0.1811 | 0.9067 | 0.4551 | 0.8 | 0.68 | 0.0815 | 0.7 | 0.9387 | 0.2267 | 0.56 | 0.795 | 0.1449 | | MaxSim_recall@5 | 0.3233 | 0.2558 | 0.9567 | 0.518 | 0.85 | 0.76 | 0.0982 | 0.82 | 0.9793 | 0.2917 | 0.66 | 0.83 | 0.2233 | | MaxSim_recall@10 | 0.4433 | 0.3881 | 0.9567 | 0.6385 | 0.87 | 0.86 | 0.1248 | 0.86 | 0.9967 | 0.3717 | 0.76 | 0.87 | 0.3397 | | **MaxSim_ndcg@10** | **0.3515** | **0.686** | **0.9081** | **0.5522** | **0.842** | **0.6811** | **0.3324** | **0.6842** | **0.942** | **0.3832** | **0.4618** | **0.8016** | **0.6049** | | MaxSim_mrr@10 | 0.4419 | 0.8573 | 0.92 | 0.6034 | 0.944 | 0.625 | 0.5284 | 0.6359 | 0.934 | 0.624 | 0.3655 | 0.7864 | 0.8771 | | MaxSim_map@100 | 0.2679 | 0.5297 | 0.8815 | 0.4856 | 0.7821 | 0.6334 | 0.1501 | 0.6242 | 0.9164 | 0.2933 | 0.3743 | 0.7801 | 0.4447 | #### Nano BEIR * Dataset: `NanoBEIR_mean` * Evaluated with pylate.evaluation.nano_beir_evaluator.NanoBEIREvaluator | Metric | Value | |:--------------------|:-----------| | MaxSim_accuracy@1 | 0.6074 | | MaxSim_accuracy@3 | 0.7815 | | MaxSim_accuracy@5 | 0.8323 | | MaxSim_accuracy@10 | 0.8862 | | MaxSim_precision@1 | 0.6074 | | MaxSim_precision@3 | 0.3755 | | MaxSim_precision@5 | 0.2912 | | MaxSim_precision@10 | 0.1967 | | MaxSim_recall@1 | 0.3601 | | MaxSim_recall@3 | 0.5192 | | MaxSim_recall@5 | 0.582 | | MaxSim_recall@10 | 0.6523 | | **MaxSim_ndcg@10** | **0.6331** | | MaxSim_mrr@10 | 0.7033 | | MaxSim_map@100 | 0.551 | ## Training Details ### Training Dataset #### train * Dataset: [train](https://huggingface.co/datasets/lightonai/ms-marco-en-bge-gemma) at [1a1ffe7](https://huggingface.co/datasets/lightonai/ms-marco-en-bge-gemma/tree/1a1ffe7cde403016be12ae532b249965b2293114) * Size: 640,000 training samples * Columns: query_id, document_ids, and scores * Approximate statistics based on the first 1000 samples: | | query_id | document_ids | scores | |:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:------------------------------------| | type | int | list | list | | details | | | | * Samples: | query_id | document_ids | scores | |:--------------------|:----------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------| | 685613 | [7546874, 1176459, 197677, 2306318, 8541504, ...] | [0.9999999992804947, 0.24845418756716053, 0.7594154013647826, 0.26644182105618575, 0.390668914839766, ...] | | 237784 | [6366584, 4034101, 2325374, 6914618, 6042146, ...] | [0.9999999991784339, 0.42233632827946693, 0.5956354295491569, 0.12644415907455164, 0.6636713730105909, ...] | | 904294 | [448408, 8743975, 49600, 7339401, 2714261, ...] | [0.9999999991841937, 0.877629062381539, 0.8330146583389045, 0.3116634796692611, 0.4633524534142185, ...] | * Loss: pylate.losses.distillation.Distillation ### Training Hyperparameters #### Non-Default Hyperparameters - `eval_strategy`: steps - `per_device_train_batch_size`: 16 - `learning_rate`: 4e-06 - `max_steps`: 20000 - `fp16`: True - `dataloader_drop_last`: True - `dataloader_num_workers`: 8 - `ddp_find_unused_parameters`: False - `torch_compile`: True - `torch_compile_backend`: inductor - `eval_on_start`: True #### All Hyperparameters
Click to expand - `overwrite_output_dir`: False - `do_predict`: False - `eval_strategy`: steps - `prediction_loss_only`: True - `per_device_train_batch_size`: 16 - `per_device_eval_batch_size`: 8 - `per_gpu_train_batch_size`: None - `per_gpu_eval_batch_size`: None - `gradient_accumulation_steps`: 1 - `eval_accumulation_steps`: None - `torch_empty_cache_steps`: None - `learning_rate`: 4e-06 - `weight_decay`: 0.0 - `adam_beta1`: 0.9 - `adam_beta2`: 0.999 - `adam_epsilon`: 1e-08 - `max_grad_norm`: 1.0 - `num_train_epochs`: 3.0 - `max_steps`: 20000 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: {} - `warmup_ratio`: 0.0 - `warmup_steps`: 0 - `log_level`: passive - `log_level_replica`: warning - `log_on_each_node`: True - `logging_nan_inf_filter`: True - `save_safetensors`: True - `save_on_each_node`: False - `save_only_model`: False - `restore_callback_states_from_checkpoint`: False - `no_cuda`: False - `use_cpu`: False - `use_mps_device`: False - `seed`: 42 - `data_seed`: None - `jit_mode_eval`: False - `use_ipex`: False - `bf16`: False - `fp16`: True - `fp16_opt_level`: O1 - `half_precision_backend`: auto - `bf16_full_eval`: False - `fp16_full_eval`: False - `tf32`: None - `local_rank`: 0 - `ddp_backend`: None - `tpu_num_cores`: None - `tpu_metrics_debug`: False - `debug`: [] - `dataloader_drop_last`: True - `dataloader_num_workers`: 8 - `dataloader_prefetch_factor`: None - `past_index`: -1 - `disable_tqdm`: False - `remove_unused_columns`: True - `label_names`: None - `load_best_model_at_end`: False - `ignore_data_skip`: False - `fsdp`: [] - `fsdp_min_num_params`: 0 - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} - `fsdp_transformer_layer_cls_to_wrap`: None - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} - `parallelism_config`: None - `deepspeed`: None - `label_smoothing_factor`: 0.0 - `optim`: adamw_torch - `optim_args`: None - `adafactor`: False - `group_by_length`: False - `length_column_name`: length - `ddp_find_unused_parameters`: False - `ddp_bucket_cap_mb`: None - `ddp_broadcast_buffers`: False - `dataloader_pin_memory`: True - `dataloader_persistent_workers`: False - `skip_memory_metrics`: True - `use_legacy_prediction_loop`: False - `push_to_hub`: False - `resume_from_checkpoint`: None - `hub_model_id`: None - `hub_strategy`: every_save - `hub_private_repo`: None - `hub_always_push`: False - `hub_revision`: None - `gradient_checkpointing`: False - `gradient_checkpointing_kwargs`: None - `include_inputs_for_metrics`: False - `include_for_metrics`: [] - `eval_do_concat_batches`: True - `fp16_backend`: auto - `push_to_hub_model_id`: None - `push_to_hub_organization`: None - `mp_parameters`: - `auto_find_batch_size`: False - `full_determinism`: False - `torchdynamo`: None - `ray_scope`: last - `ddp_timeout`: 1800 - `torch_compile`: True - `torch_compile_backend`: inductor - `torch_compile_mode`: None - `include_tokens_per_second`: False - `include_num_input_tokens_seen`: False - `neftune_noise_alpha`: None - `optim_target_modules`: None - `batch_eval_metrics`: False - `eval_on_start`: True - `use_liger_kernel`: False - `liger_kernel_config`: None - `eval_use_gather_object`: False - `average_tokens_across_devices`: False - `prompts`: None - `batch_sampler`: batch_sampler - `multi_dataset_batch_sampler`: proportional - `router_mapping`: {} - `learning_rate_mapping`: {}