---
tags:
- ColBERT
- PyLate
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:533177
- loss:Distillation
base_model: jhu-clsp/ettin-encoder-17m
datasets:
- Speedsy/cleaned-ms-marco-bge-gemma-from-ligton
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 model based on jhu-clsp/ettin-encoder-17m
results:
- task:
type: py-late-information-retrieval
name: Py Late Information Retrieval
dataset:
name: NanoClimateFEVER
type: NanoClimateFEVER
metrics:
- type: MaxSim_accuracy@1
value: 0.24
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.38
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.5
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.7
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.24
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.15333333333333332
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.11599999999999999
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.092
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.12833333333333333
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.21
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.2533333333333333
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.36666666666666664
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.28763494301317366
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.3579841269841269
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.22941676804604197
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.7
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.86
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.7
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.6133333333333334
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.556
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.48
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.07180505985706782
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.16504755248565225
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.2194302820279554
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.32972451635318606
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.5813676616013099
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.7881666666666667
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.4671775883716682
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.94
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.96
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.98
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.88
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.10799999999999997
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.8166666666666668
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.8933333333333333
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.93
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.96
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.9050308205730978
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.9106666666666665
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.8792272727272727
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.42
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.74
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.42
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.26666666666666666
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.212
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.132
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.2286904761904762
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.36584920634920637
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.4511190476190476
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.5564523809523809
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.4611987813833444
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.5268571428571428
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.38520628807075186
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.88
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.88
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.5533333333333332
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.344
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.17999999999999997
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.44
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.83
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.86
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.9
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.858075938741974
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.9333333333333332
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.800559405305322
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.66
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.7
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.8
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.52
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.22
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.14
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.08
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.52
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.66
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.7
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.8
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.6531074122045695
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.6071031746031745
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.6169218803486538
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.54
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.64
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.66
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.44
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.3466666666666666
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.332
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.26
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.04328552205779273
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.07677540422223056
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.1178452517343604
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.14031592190988035
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.32964183008765374
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.5071904761904762
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.14909457042487737
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.52
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.78
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.82
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.26
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.16799999999999998
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.09
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.49
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.72
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.77
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.81
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.6661035501816893
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.6417460317460317
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.6127876420077506
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.84
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.84
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.38666666666666655
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.244
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.12399999999999999
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.7440000000000001
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.9286666666666668
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.9593333333333334
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.9626666666666668
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.9075252606458076
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.9106666666666667
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.8834929814655215
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.4
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.66
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.68
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.78
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.4
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.31333333333333335
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.244
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.162
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.08366666666666667
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.19366666666666668
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.24966666666666662
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.3306666666666666
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.3310802884457278
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.5407222222222222
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.25548127218322214
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.14
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.76
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.14
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.07600000000000001
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.14
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.76
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.457648969568352
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.3595714285714285
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.36839121630206756
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.62
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.8
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.86
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.88
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.62
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.27999999999999997
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.595
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.77
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.845
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.87
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.7463564404006293
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.7106666666666667
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.7060596028154851
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.7551020408163265
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.9795918367346939
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.7551020408163265
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.6666666666666666
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.6285714285714286
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.5102040816326531
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.0512448639546046
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.13492382759077773
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.21028780790933668
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.3208107900431349
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.5860354215626813
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.8656462585034013
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.42050847387780316
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.5657770800627943
name: Maxsim Accuracy@1
- type: MaxSim_accuracy@3
value: 0.749199372056515
name: Maxsim Accuracy@3
- type: MaxSim_accuracy@5
value: 0.7969230769230768
name: Maxsim Accuracy@5
- type: MaxSim_accuracy@10
value: 0.8538461538461538
name: Maxsim Accuracy@10
- type: MaxSim_precision@1
value: 0.5657770800627943
name: Maxsim Precision@1
- type: MaxSim_precision@3
value: 0.3517948717948718
name: Maxsim Precision@3
- type: MaxSim_precision@5
value: 0.2698901098901099
name: Maxsim Precision@5
- type: MaxSim_precision@10
value: 0.18401569858712713
name: Maxsim Precision@10
- type: MaxSim_recall@1
value: 0.3348225068251237
name: Maxsim Recall@1
- type: MaxSim_recall@3
value: 0.5006355890241948
name: Maxsim Recall@3
- type: MaxSim_recall@5
value: 0.5543089017403102
name: Maxsim Recall@5
- type: MaxSim_recall@10
value: 0.6236387391737371
name: Maxsim Recall@10
- type: MaxSim_ndcg@10
value: 0.5977544091084623
name: Maxsim Ndcg@10
- type: MaxSim_mrr@10
value: 0.666178527821385
name: Maxsim Mrr@10
- type: MaxSim_map@100
value: 0.5211019201497261
name: Maxsim Map@100
---
# PyLate model based on jhu-clsp/ettin-encoder-17m
This is a [PyLate](https://github.com/lightonai/pylate) model finetuned from [jhu-clsp/ettin-encoder-17m](https://huggingface.co/jhu-clsp/ettin-encoder-17m) on the [train](https://huggingface.co/datasets/Speedsy/cleaned-ms-marco-bge-gemma-from-ligton) 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
- **Base model:** [jhu-clsp/ettin-encoder-17m](https://huggingface.co/jhu-clsp/ettin-encoder-17m)
- **Document Length:** 300 tokens
- **Query Length:** 32 tokens
- **Output Dimensionality:** 128 tokens
- **Similarity Function:** MaxSim
- **Training Dataset:**
- [train](https://huggingface.co/datasets/Speedsy/cleaned-ms-marco-bge-gemma-from-ligton)
### 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': 299, 'do_lower_case': False}) with Transformer model: ModernBertModel
(1): Dense({'in_features': 256, 'out_features': 128, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
)
```
## Usage
First install the PyLate library:
```bash
pip install -U pylate
```
### Retrieval
PyLate provides a streamlined interface to index and retrieve documents using ColBERT models. The index leverages the Voyager HNSW index to efficiently handle document embeddings and enable fast retrieval.
#### Indexing documents
First, load the ColBERT model and initialize the Voyager 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 Voyager index
index = indexes.Voyager(
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.Voyager(
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.24 | 0.7 | 0.88 | 0.42 | 0.88 | 0.52 | 0.44 | 0.52 | 0.84 | 0.4 | 0.14 | 0.62 | 0.7551 |
| MaxSim_accuracy@3 | 0.38 | 0.86 | 0.94 | 0.6 | 1.0 | 0.66 | 0.54 | 0.78 | 0.98 | 0.66 | 0.56 | 0.8 | 0.9796 |
| MaxSim_accuracy@5 | 0.5 | 0.9 | 0.96 | 0.66 | 1.0 | 0.7 | 0.64 | 0.82 | 1.0 | 0.68 | 0.64 | 0.86 | 1.0 |
| MaxSim_accuracy@10 | 0.7 | 0.94 | 0.98 | 0.74 | 1.0 | 0.8 | 0.66 | 0.86 | 1.0 | 0.78 | 0.76 | 0.88 | 1.0 |
| MaxSim_precision@1 | 0.24 | 0.7 | 0.88 | 0.42 | 0.88 | 0.52 | 0.44 | 0.52 | 0.84 | 0.4 | 0.14 | 0.62 | 0.7551 |
| MaxSim_precision@3 | 0.1533 | 0.6133 | 0.3267 | 0.2667 | 0.5533 | 0.22 | 0.3467 | 0.26 | 0.3867 | 0.3133 | 0.1867 | 0.28 | 0.6667 |
| MaxSim_precision@5 | 0.116 | 0.556 | 0.208 | 0.212 | 0.344 | 0.14 | 0.332 | 0.168 | 0.244 | 0.244 | 0.128 | 0.188 | 0.6286 |
| MaxSim_precision@10 | 0.092 | 0.48 | 0.108 | 0.132 | 0.18 | 0.08 | 0.26 | 0.09 | 0.124 | 0.162 | 0.076 | 0.098 | 0.5102 |
| MaxSim_recall@1 | 0.1283 | 0.0718 | 0.8167 | 0.2287 | 0.44 | 0.52 | 0.0433 | 0.49 | 0.744 | 0.0837 | 0.14 | 0.595 | 0.0512 |
| MaxSim_recall@3 | 0.21 | 0.165 | 0.8933 | 0.3658 | 0.83 | 0.66 | 0.0768 | 0.72 | 0.9287 | 0.1937 | 0.56 | 0.77 | 0.1349 |
| MaxSim_recall@5 | 0.2533 | 0.2194 | 0.93 | 0.4511 | 0.86 | 0.7 | 0.1178 | 0.77 | 0.9593 | 0.2497 | 0.64 | 0.845 | 0.2103 |
| MaxSim_recall@10 | 0.3667 | 0.3297 | 0.96 | 0.5565 | 0.9 | 0.8 | 0.1403 | 0.81 | 0.9627 | 0.3307 | 0.76 | 0.87 | 0.3208 |
| **MaxSim_ndcg@10** | **0.2876** | **0.5814** | **0.905** | **0.4612** | **0.8581** | **0.6531** | **0.3296** | **0.6661** | **0.9075** | **0.3311** | **0.4576** | **0.7464** | **0.586** |
| MaxSim_mrr@10 | 0.358 | 0.7882 | 0.9107 | 0.5269 | 0.9333 | 0.6071 | 0.5072 | 0.6417 | 0.9107 | 0.5407 | 0.3596 | 0.7107 | 0.8656 |
| MaxSim_map@100 | 0.2294 | 0.4672 | 0.8792 | 0.3852 | 0.8006 | 0.6169 | 0.1491 | 0.6128 | 0.8835 | 0.2555 | 0.3684 | 0.7061 | 0.4205 |
#### Nano BEIR
* Dataset: `NanoBEIR_mean`
* Evaluated with pylate.evaluation.nano_beir_evaluator.NanoBEIREvaluator
| Metric | Value |
|:--------------------|:-----------|
| MaxSim_accuracy@1 | 0.5658 |
| MaxSim_accuracy@3 | 0.7492 |
| MaxSim_accuracy@5 | 0.7969 |
| MaxSim_accuracy@10 | 0.8538 |
| MaxSim_precision@1 | 0.5658 |
| MaxSim_precision@3 | 0.3518 |
| MaxSim_precision@5 | 0.2699 |
| MaxSim_precision@10 | 0.184 |
| MaxSim_recall@1 | 0.3348 |
| MaxSim_recall@3 | 0.5006 |
| MaxSim_recall@5 | 0.5543 |
| MaxSim_recall@10 | 0.6236 |
| **MaxSim_ndcg@10** | **0.5978** |
| MaxSim_mrr@10 | 0.6662 |
| MaxSim_map@100 | 0.5211 |
## Training Details
### Training Dataset
#### train
* Dataset: [train](https://huggingface.co/datasets/Speedsy/cleaned-ms-marco-bge-gemma-from-ligton) at [63f51a3](https://huggingface.co/datasets/Speedsy/cleaned-ms-marco-bge-gemma-from-ligton/tree/63f51a32e72d981b44be6cace953edbb7dd2c4b0)
* Size: 533,177 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 |
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, ...] |
| 412214 | [1006306, 4454048, 1949661, 4895656, 675880, ...] | [0.9999999994734676, 0.38790621123137803, 0.3747429039573546, 0.2990538871317199, 0.38420403106055895, ...] |
* Loss: pylate.losses.distillation.Distillation
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `learning_rate`: 3e-05
- `num_train_epochs`: 1
- `bf16`: True
#### All Hyperparameters