---
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.26
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.56
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.64
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.78
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.26
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.19333333333333333
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.16
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.1
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.1383333333333333
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.24999999999999997
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.32166666666666666
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.39066666666666655
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.32039147745578483
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.42276984126984124
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.24935334206601034
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.78
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.9
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.9
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.94
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.78
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.6599999999999998
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.616
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.55
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.09075272085277744
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.16895043381209857
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.24051424266181912
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.36868865362502956
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.66624662933317
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.8415238095238096
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.5145725477836222
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.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.34666666666666657
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.21199999999999997
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.10799999999999997
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.8166666666666668
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.9433333333333332
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.9633333333333333
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.97
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.925157785716936
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.935
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.900428388746803
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.5
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.7
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.74
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.8
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.5
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.31999999999999995
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.24
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.142
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.3094126984126984
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.474515873015873
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.5476190476190476
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.6147857142857143
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.5449947187566443
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.6068888888888889
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.47848630223690586
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.92
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.92
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.5199999999999999
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.46
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.78
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.8390423470478856
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.9506666666666667
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.7749759887824803
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.56
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.72
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.76
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.88
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.56
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.24
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.15200000000000002
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.088
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.56
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.72
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.76
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.88
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.7161567165508727
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.6650476190476189
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.672465263965264
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.46
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.58
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.6
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.66
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.46
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.38
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.32
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.272
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.04317667470348151
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.07996223003774396
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.09447327378743205
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.12091153813606693
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.33473796463548466
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.5260238095238096
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.14684740975296695
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.48
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.72
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.8
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.9
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.48
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.24666666666666667
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.16799999999999998
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.09399999999999999
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.46
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.68
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.77
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.85
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.6686040003007178
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.6210714285714285
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.6099890727147909
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.92
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 1.0
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.92
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.40666666666666657
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.26
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.13599999999999998
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.8073333333333333
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.9586666666666668
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.9826666666666667
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.9933333333333334
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.9578930498899669
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.96
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.9378103896103898
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.46
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.66
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.46
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.34
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.256
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.19
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.09666666666666668
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.21066666666666664
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.26266666666666666
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.38766666666666666
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.3716553413359221
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.5760555555555554
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.27745676706388667
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.2
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.56
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.64
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.82
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.2
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.18666666666666668
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.128
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.08199999999999999
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.2
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.56
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.64
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.82
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.49503741719510885
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.3925793650793651
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.3970842977571503
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.7
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.78
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.8
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.88
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.7
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.27999999999999997
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.18
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.09799999999999999
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.675
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.765
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.8
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.87
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.7788958916951562
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.7513571428571428
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.7534500915750916
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.8163265306122449
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.9591836734693877
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.9591836734693877
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.9795918367346939
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.8163265306122449
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.7074829931972788
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.6204081632653061
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.5102040816326531
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.05518453156908425
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.1473987812718667
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.21441836348902682
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.33183454535355095
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.5945921894543182
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.8877551020408163
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.4401324508472191
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.6104866562009419
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.7768602825745682
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.815321821036107
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.8845839874411303
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.6104866562009419
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.37134484563055986
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.28095447409733126
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.19570800627943483
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.36250204811831094
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.5183456911387884
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.5728737123762044
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.6513759321590022
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.6318004253359976
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.7028260945403803
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.5502347933001986
name: Maxsim Map@100
---
# PyLate
This is a [PyLate](https://github.com/lightonai/pylate) model trained on the [train](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
### 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.26 | 0.78 | 0.88 | 0.5 | 0.92 | 0.56 | 0.46 | 0.48 | 0.92 | 0.46 | 0.2 | 0.7 | 0.8163 |
| MaxSim_accuracy@3 | 0.56 | 0.9 | 0.98 | 0.7 | 0.98 | 0.72 | 0.58 | 0.72 | 1.0 | 0.66 | 0.56 | 0.78 | 0.9592 |
| MaxSim_accuracy@5 | 0.64 | 0.9 | 1.0 | 0.74 | 1.0 | 0.76 | 0.6 | 0.8 | 1.0 | 0.76 | 0.64 | 0.8 | 0.9592 |
| MaxSim_accuracy@10 | 0.78 | 0.94 | 1.0 | 0.8 | 1.0 | 0.88 | 0.66 | 0.9 | 1.0 | 0.86 | 0.82 | 0.88 | 0.9796 |
| MaxSim_precision@1 | 0.26 | 0.78 | 0.88 | 0.5 | 0.92 | 0.56 | 0.46 | 0.48 | 0.92 | 0.46 | 0.2 | 0.7 | 0.8163 |
| MaxSim_precision@3 | 0.1933 | 0.66 | 0.3467 | 0.32 | 0.52 | 0.24 | 0.38 | 0.2467 | 0.4067 | 0.34 | 0.1867 | 0.28 | 0.7075 |
| MaxSim_precision@5 | 0.16 | 0.616 | 0.212 | 0.24 | 0.34 | 0.152 | 0.32 | 0.168 | 0.26 | 0.256 | 0.128 | 0.18 | 0.6204 |
| MaxSim_precision@10 | 0.1 | 0.55 | 0.108 | 0.142 | 0.174 | 0.088 | 0.272 | 0.094 | 0.136 | 0.19 | 0.082 | 0.098 | 0.5102 |
| MaxSim_recall@1 | 0.1383 | 0.0908 | 0.8167 | 0.3094 | 0.46 | 0.56 | 0.0432 | 0.46 | 0.8073 | 0.0967 | 0.2 | 0.675 | 0.0552 |
| MaxSim_recall@3 | 0.25 | 0.169 | 0.9433 | 0.4745 | 0.78 | 0.72 | 0.08 | 0.68 | 0.9587 | 0.2107 | 0.56 | 0.765 | 0.1474 |
| MaxSim_recall@5 | 0.3217 | 0.2405 | 0.9633 | 0.5476 | 0.85 | 0.76 | 0.0945 | 0.77 | 0.9827 | 0.2627 | 0.64 | 0.8 | 0.2144 |
| MaxSim_recall@10 | 0.3907 | 0.3687 | 0.97 | 0.6148 | 0.87 | 0.88 | 0.1209 | 0.85 | 0.9933 | 0.3877 | 0.82 | 0.87 | 0.3318 |
| **MaxSim_ndcg@10** | **0.3204** | **0.6662** | **0.9252** | **0.545** | **0.839** | **0.7162** | **0.3347** | **0.6686** | **0.9579** | **0.3717** | **0.495** | **0.7789** | **0.5946** |
| MaxSim_mrr@10 | 0.4228 | 0.8415 | 0.935 | 0.6069 | 0.9507 | 0.665 | 0.526 | 0.6211 | 0.96 | 0.5761 | 0.3926 | 0.7514 | 0.8878 |
| MaxSim_map@100 | 0.2494 | 0.5146 | 0.9004 | 0.4785 | 0.775 | 0.6725 | 0.1468 | 0.61 | 0.9378 | 0.2775 | 0.3971 | 0.7535 | 0.4401 |
#### Nano BEIR
* Dataset: `NanoBEIR_mean`
* Evaluated with pylate.evaluation.nano_beir_evaluator.NanoBEIREvaluator
| Metric | Value |
|:--------------------|:-----------|
| MaxSim_accuracy@1 | 0.6105 |
| MaxSim_accuracy@3 | 0.7769 |
| MaxSim_accuracy@5 | 0.8153 |
| MaxSim_accuracy@10 | 0.8846 |
| MaxSim_precision@1 | 0.6105 |
| MaxSim_precision@3 | 0.3713 |
| MaxSim_precision@5 | 0.281 |
| MaxSim_precision@10 | 0.1957 |
| MaxSim_recall@1 | 0.3625 |
| MaxSim_recall@3 | 0.5183 |
| MaxSim_recall@5 | 0.5729 |
| MaxSim_recall@10 | 0.6514 |
| **MaxSim_ndcg@10** | **0.6318** |
| MaxSim_mrr@10 | 0.7028 |
| MaxSim_map@100 | 0.5502 |
## 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 |
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