CrossEncoder based on jhu-clsp/ettin-encoder-17m
This is a Cross Encoder model finetuned from jhu-clsp/ettin-encoder-17m on the ms_marco dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: jhu-clsp/ettin-encoder-17m
- Maximum Sequence Length: 7999 tokens
- Number of Output Labels: 1 label
- Training Dataset:
- Language: en
Model Sources
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
model = CrossEncoder("bansalaman18/reranker-msmarco-v1.1-ettin-encoder-17m-bce")
pairs = [
['how to put word count on word', 'To insert a word count into a Word 2013 document, place the cursor where you would like the word count to appear (say in the Header or Footer) and then: 1 click the Insert tab. 2 click the Quick Parts icon (towards the right hand end of the toolbar). 3 on the drop down that appears, select Field...'],
['what is the difference between discipleship and evangelism', 'Discipleship, on the other hand, meant helping someone who was already a believer walk out the life of faith. The word “discipleship” brought to my mind a small group Bible study, a conversation across the table with another woman, or an accountability group. And I knew which one I preferred. As a result, the discipleship I offered others contained a lot of good information but lacked the transforming power that can only come from the gospel. (I was also, simply, a coward.). I am beginning to see that evangelism and discipleship are not all that different.'],
['what metal is a trophy made from', 'The trophy stands 36.5 centimetres (14.4 inches) tall and is made of 5 kg (11 lb) of 18 carat (75%) gold with a base (13 centimetres [5.1 inches] in diameter) containing t … wo layers of malachite. Making the world better, one answer at a time. Trophies can be made out of anything you want. however, aluminum is a very reliable and trustworthy metal and it.......... oh crap.......... i have to do a poo...'],
['how do you define what a cult is?', 'The term cult has been misused. The word cult comes from the French cult which is from the Latin word cultus (care/adoration) and Latin Colere (to cultivate.) So, we can plant seeds of good or bad. You can have political cults such as sit ins during the Vietnam War. A good cult could be a religious one, yet some Christians will consider Jehovah Witness a cult and have labeled them as preying on the weak. When someone labels such a thing it is usually because of the lack of understanding. Good cults are usually a small group of people that can have a cult in most anything.'],
['where is silchar', 'Silchar (/ˈsɪlˌʧə/ or /ˈʃɪlˌʧə/) (Bengali: শিলচর Shilchor) shilchôr is the headquarters Of cachar district in the state Of assam In. India it is 343 (kilometres 213) mi south east Of. Guwahati it is the-second largest city of the state in terms of population and municipal. area 1 The Bhubaneshwar temple is about 50 km from Silchar and is on the top the Bhuvan hill. 2 This is a place of pilgrimage and during the festival of Shivaratri, thousand of Shivayats march towards the hilltop to worship Lord Shiva.'],
]
scores = model.predict(pairs)
print(scores.shape)
ranks = model.rank(
'how to put word count on word',
[
'To insert a word count into a Word 2013 document, place the cursor where you would like the word count to appear (say in the Header or Footer) and then: 1 click the Insert tab. 2 click the Quick Parts icon (towards the right hand end of the toolbar). 3 on the drop down that appears, select Field...',
'Discipleship, on the other hand, meant helping someone who was already a believer walk out the life of faith. The word “discipleship” brought to my mind a small group Bible study, a conversation across the table with another woman, or an accountability group. And I knew which one I preferred. As a result, the discipleship I offered others contained a lot of good information but lacked the transforming power that can only come from the gospel. (I was also, simply, a coward.). I am beginning to see that evangelism and discipleship are not all that different.',
'The trophy stands 36.5 centimetres (14.4 inches) tall and is made of 5 kg (11 lb) of 18 carat (75%) gold with a base (13 centimetres [5.1 inches] in diameter) containing t … wo layers of malachite. Making the world better, one answer at a time. Trophies can be made out of anything you want. however, aluminum is a very reliable and trustworthy metal and it.......... oh crap.......... i have to do a poo...',
'The term cult has been misused. The word cult comes from the French cult which is from the Latin word cultus (care/adoration) and Latin Colere (to cultivate.) So, we can plant seeds of good or bad. You can have political cults such as sit ins during the Vietnam War. A good cult could be a religious one, yet some Christians will consider Jehovah Witness a cult and have labeled them as preying on the weak. When someone labels such a thing it is usually because of the lack of understanding. Good cults are usually a small group of people that can have a cult in most anything.',
'Silchar (/ˈsɪlˌʧə/ or /ˈʃɪlˌʧə/) (Bengali: শিলচর Shilchor) shilchôr is the headquarters Of cachar district in the state Of assam In. India it is 343 (kilometres 213) mi south east Of. Guwahati it is the-second largest city of the state in terms of population and municipal. area 1 The Bhubaneshwar temple is about 50 km from Silchar and is on the top the Bhuvan hill. 2 This is a place of pilgrimage and during the festival of Shivaratri, thousand of Shivayats march towards the hilltop to worship Lord Shiva.',
]
)
Evaluation
Metrics
Cross Encoder Reranking
| Metric |
NanoMSMARCO_R100 |
NanoNFCorpus_R100 |
NanoNQ_R100 |
| map |
0.2955 (-0.1941) |
0.2678 (+0.0068) |
0.2299 (-0.1897) |
| mrr@10 |
0.2815 (-0.1960) |
0.3701 (-0.1298) |
0.2171 (-0.2096) |
| ndcg@10 |
0.3609 (-0.1795) |
0.2211 (-0.1040) |
0.2574 (-0.2433) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_R100_mean
- Evaluated with
CrossEncoderNanoBEIREvaluator with these parameters:{
"dataset_names": [
"msmarco",
"nfcorpus",
"nq"
],
"rerank_k": 100,
"at_k": 10,
"always_rerank_positives": true
}
| Metric |
Value |
| map |
0.2644 (-0.1257) |
| mrr@10 |
0.2895 (-0.1785) |
| ndcg@10 |
0.2798 (-0.1756) |
Training Details
Training Dataset
ms_marco
Evaluation Dataset
ms_marco
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: steps
per_device_train_batch_size: 128
per_device_eval_batch_size: 128
learning_rate: 2e-05
num_train_epochs: 1
warmup_ratio: 0.1
seed: 12
bf16: True
remove_unused_columns: False
load_best_model_at_end: True
All Hyperparameters
Click to expand
overwrite_output_dir: False
do_predict: False
eval_strategy: steps
prediction_loss_only: True
per_device_train_batch_size: 128
per_device_eval_batch_size: 128
per_gpu_train_batch_size: None
per_gpu_eval_batch_size: None
gradient_accumulation_steps: 1
eval_accumulation_steps: None
torch_empty_cache_steps: None
learning_rate: 2e-05
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
max_grad_norm: 1.0
num_train_epochs: 1
max_steps: -1
lr_scheduler_type: linear
lr_scheduler_kwargs: {}
warmup_ratio: 0.1
warmup_steps: 0
log_level: passive
log_level_replica: warning
log_on_each_node: True
logging_nan_inf_filter: True
save_safetensors: True
save_on_each_node: False
save_only_model: False
restore_callback_states_from_checkpoint: False
no_cuda: False
use_cpu: False
use_mps_device: False
seed: 12
data_seed: None
jit_mode_eval: False
use_ipex: False
bf16: True
fp16: False
fp16_opt_level: O1
half_precision_backend: auto
bf16_full_eval: False
fp16_full_eval: False
tf32: None
local_rank: 0
ddp_backend: None
tpu_num_cores: None
tpu_metrics_debug: False
debug: []
dataloader_drop_last: False
dataloader_num_workers: 0
dataloader_prefetch_factor: None
past_index: -1
disable_tqdm: False
remove_unused_columns: False
label_names: None
load_best_model_at_end: True
ignore_data_skip: False
fsdp: []
fsdp_min_num_params: 0
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
tp_size: 0
fsdp_transformer_layer_cls_to_wrap: None
accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
deepspeed: None
label_smoothing_factor: 0.0
optim: adamw_torch
optim_args: None
adafactor: False
group_by_length: False
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
dataloader_pin_memory: True
dataloader_persistent_workers: False
skip_memory_metrics: True
use_legacy_prediction_loop: False
push_to_hub: False
resume_from_checkpoint: None
hub_model_id: None
hub_strategy: every_save
hub_private_repo: None
hub_always_push: False
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
include_inputs_for_metrics: False
include_for_metrics: []
eval_do_concat_batches: True
fp16_backend: auto
push_to_hub_model_id: None
push_to_hub_organization: None
mp_parameters:
auto_find_batch_size: False
full_determinism: False
torchdynamo: None
ray_scope: last
ddp_timeout: 1800
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
include_tokens_per_second: False
include_num_input_tokens_seen: False
neftune_noise_alpha: None
optim_target_modules: None
batch_eval_metrics: False
eval_on_start: False
use_liger_kernel: False
eval_use_gather_object: False
average_tokens_across_devices: False
prompts: None
batch_sampler: batch_sampler
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
Training Logs
| Epoch |
Step |
Training Loss |
Validation Loss |
NanoMSMARCO_R100_ndcg@10 |
NanoNFCorpus_R100_ndcg@10 |
NanoNQ_R100_ndcg@10 |
NanoBEIR_R100_mean_ndcg@10 |
| -1 |
-1 |
- |
- |
0.0063 (-0.5341) |
0.1897 (-0.1354) |
0.0179 (-0.4827) |
0.0713 (-0.3841) |
| 0.0002 |
1 |
0.696 |
- |
- |
- |
- |
- |
| 0.0196 |
100 |
0.5601 |
0.4193 |
0.0071 (-0.5333) |
0.2186 (-0.1064) |
0.0223 (-0.4784) |
0.0827 (-0.3727) |
| 0.0391 |
200 |
0.4183 |
0.3880 |
0.0336 (-0.5068) |
0.1907 (-0.1343) |
0.0380 (-0.4626) |
0.0875 (-0.3679) |
| 0.0587 |
300 |
0.4045 |
0.3863 |
0.0699 (-0.4706) |
0.2124 (-0.1126) |
0.0301 (-0.4705) |
0.1041 (-0.3512) |
| 0.0782 |
400 |
0.3951 |
0.3883 |
0.0730 (-0.4675) |
0.2320 (-0.0931) |
0.0667 (-0.4339) |
0.1239 (-0.3315) |
| 0.0978 |
500 |
0.3984 |
0.3794 |
0.0990 (-0.4414) |
0.2897 (-0.0353) |
0.0609 (-0.4397) |
0.1499 (-0.3055) |
| 0.1173 |
600 |
0.3914 |
0.3769 |
0.0888 (-0.4516) |
0.2375 (-0.0875) |
0.0817 (-0.4189) |
0.1360 (-0.3193) |
| 0.1369 |
700 |
0.3888 |
0.3819 |
0.1294 (-0.4110) |
0.2011 (-0.1239) |
0.1395 (-0.3612) |
0.1567 (-0.2987) |
| 0.1565 |
800 |
0.3833 |
0.3775 |
0.1334 (-0.4070) |
0.1981 (-0.1270) |
0.1062 (-0.3945) |
0.1459 (-0.3095) |
| 0.1760 |
900 |
0.3918 |
0.3763 |
0.1246 (-0.4158) |
0.2032 (-0.1218) |
0.1661 (-0.3346) |
0.1646 (-0.2907) |
| 0.1956 |
1000 |
0.3888 |
0.3792 |
0.1182 (-0.4223) |
0.2007 (-0.1243) |
0.1191 (-0.3815) |
0.1460 (-0.3094) |
| 0.2151 |
1100 |
0.3788 |
0.3774 |
0.1256 (-0.4149) |
0.1914 (-0.1336) |
0.1524 (-0.3482) |
0.1565 (-0.2989) |
| 0.2347 |
1200 |
0.3897 |
0.3756 |
0.0871 (-0.4533) |
0.2270 (-0.0981) |
0.1160 (-0.3847) |
0.1434 (-0.3120) |
| 0.2543 |
1300 |
0.387 |
0.3822 |
0.1046 (-0.4358) |
0.2082 (-0.1168) |
0.1690 (-0.3317) |
0.1606 (-0.2947) |
| 0.2738 |
1400 |
0.3924 |
0.3709 |
0.1094 (-0.4310) |
0.2081 (-0.1169) |
0.1367 (-0.3640) |
0.1514 (-0.3040) |
| 0.2934 |
1500 |
0.3833 |
0.3719 |
0.1125 (-0.4279) |
0.2014 (-0.1237) |
0.1346 (-0.3660) |
0.1495 (-0.3059) |
| 0.3129 |
1600 |
0.3814 |
0.3718 |
0.1270 (-0.4135) |
0.2036 (-0.1214) |
0.1642 (-0.3364) |
0.1649 (-0.2904) |
| 0.3325 |
1700 |
0.3783 |
0.3733 |
0.1419 (-0.3985) |
0.1884 (-0.1366) |
0.1854 (-0.3153) |
0.1719 (-0.2835) |
| 0.3520 |
1800 |
0.3785 |
0.3666 |
0.1412 (-0.3992) |
0.2100 (-0.1150) |
0.1958 (-0.3048) |
0.1824 (-0.2730) |
| 0.3716 |
1900 |
0.3777 |
0.3629 |
0.1684 (-0.3720) |
0.2068 (-0.1183) |
0.1715 (-0.3291) |
0.1822 (-0.2731) |
| 0.3912 |
2000 |
0.3727 |
0.3637 |
0.1852 (-0.3552) |
0.1978 (-0.1273) |
0.1774 (-0.3232) |
0.1868 (-0.2686) |
| 0.4107 |
2100 |
0.3827 |
0.3658 |
0.1798 (-0.3606) |
0.2062 (-0.1188) |
0.1785 (-0.3222) |
0.1882 (-0.2672) |
| 0.4303 |
2200 |
0.3805 |
0.3609 |
0.2161 (-0.3243) |
0.2042 (-0.1208) |
0.1741 (-0.3265) |
0.1981 (-0.2572) |
| 0.4498 |
2300 |
0.3619 |
0.3581 |
0.2595 (-0.2810) |
0.1944 (-0.1306) |
0.2391 (-0.2616) |
0.2310 (-0.2244) |
| 0.4694 |
2400 |
0.3845 |
0.3625 |
0.3125 (-0.2280) |
0.2121 (-0.1130) |
0.2260 (-0.2747) |
0.2502 (-0.2052) |
| 0.4889 |
2500 |
0.3746 |
0.3604 |
0.2620 (-0.2785) |
0.2056 (-0.1194) |
0.2004 (-0.3002) |
0.2227 (-0.2327) |
| 0.5085 |
2600 |
0.3732 |
0.3612 |
0.3290 (-0.2114) |
0.2002 (-0.1249) |
0.2757 (-0.2249) |
0.2683 (-0.1871) |
| 0.5281 |
2700 |
0.3567 |
0.3599 |
0.2685 (-0.2720) |
0.2115 (-0.1135) |
0.2376 (-0.2631) |
0.2392 (-0.2162) |
| 0.5476 |
2800 |
0.3694 |
0.3694 |
0.2939 (-0.2465) |
0.2033 (-0.1217) |
0.2154 (-0.2852) |
0.2376 (-0.2178) |
| 0.5672 |
2900 |
0.3717 |
0.3607 |
0.3313 (-0.2091) |
0.2133 (-0.1118) |
0.2697 (-0.2310) |
0.2714 (-0.1840) |
| 0.5867 |
3000 |
0.3611 |
0.3630 |
0.2619 (-0.2786) |
0.1996 (-0.1254) |
0.2361 (-0.2645) |
0.2325 (-0.2228) |
| 0.6063 |
3100 |
0.3732 |
0.3607 |
0.2701 (-0.2703) |
0.2010 (-0.1240) |
0.2478 (-0.2529) |
0.2396 (-0.2157) |
| 0.6259 |
3200 |
0.3752 |
0.3609 |
0.3097 (-0.2307) |
0.2103 (-0.1148) |
0.2462 (-0.2544) |
0.2554 (-0.2000) |
| 0.6454 |
3300 |
0.3721 |
0.3589 |
0.3288 (-0.2116) |
0.2102 (-0.1148) |
0.2304 (-0.2702) |
0.2565 (-0.1989) |
| 0.6650 |
3400 |
0.3624 |
0.3555 |
0.3132 (-0.2272) |
0.2203 (-0.1047) |
0.2294 (-0.2713) |
0.2543 (-0.2011) |
| 0.6845 |
3500 |
0.3727 |
0.3549 |
0.3146 (-0.2259) |
0.2153 (-0.1098) |
0.2222 (-0.2785) |
0.2507 (-0.2047) |
| 0.7041 |
3600 |
0.3708 |
0.3566 |
0.3221 (-0.2183) |
0.2147 (-0.1104) |
0.2420 (-0.2587) |
0.2596 (-0.1958) |
| 0.7236 |
3700 |
0.3605 |
0.3534 |
0.3461 (-0.1944) |
0.2159 (-0.1092) |
0.2333 (-0.2673) |
0.2651 (-0.1903) |
| 0.7432 |
3800 |
0.3589 |
0.3570 |
0.3414 (-0.1990) |
0.2163 (-0.1087) |
0.2462 (-0.2545) |
0.2680 (-0.1874) |
| 0.7628 |
3900 |
0.3746 |
0.3548 |
0.3486 (-0.1918) |
0.2261 (-0.0990) |
0.2286 (-0.2721) |
0.2678 (-0.1876) |
| 0.7823 |
4000 |
0.3734 |
0.3568 |
0.3574 (-0.1831) |
0.2202 (-0.1048) |
0.2487 (-0.2520) |
0.2754 (-0.1800) |
| 0.8019 |
4100 |
0.3677 |
0.3541 |
0.3443 (-0.1961) |
0.2189 (-0.1061) |
0.2483 (-0.2524) |
0.2705 (-0.1849) |
| 0.8214 |
4200 |
0.3691 |
0.3541 |
0.3425 (-0.1979) |
0.2225 (-0.1025) |
0.2381 (-0.2625) |
0.2677 (-0.1877) |
| 0.8410 |
4300 |
0.3632 |
0.3558 |
0.3110 (-0.2295) |
0.2173 (-0.1077) |
0.2566 (-0.2441) |
0.2616 (-0.1938) |
| 0.8606 |
4400 |
0.3509 |
0.3545 |
0.3191 (-0.2213) |
0.2180 (-0.1070) |
0.2699 (-0.2307) |
0.2690 (-0.1864) |
| 0.8801 |
4500 |
0.3732 |
0.3544 |
0.3429 (-0.1975) |
0.2240 (-0.1010) |
0.2419 (-0.2588) |
0.2696 (-0.1857) |
| 0.8997 |
4600 |
0.3598 |
0.3535 |
0.3609 (-0.1795) |
0.2211 (-0.1040) |
0.2574 (-0.2433) |
0.2798 (-0.1756) |
| 0.9192 |
4700 |
0.3664 |
0.3532 |
0.3661 (-0.1743) |
0.2214 (-0.1037) |
0.2256 (-0.2750) |
0.2710 (-0.1843) |
| 0.9388 |
4800 |
0.3552 |
0.3536 |
0.3568 (-0.1837) |
0.2285 (-0.0966) |
0.2320 (-0.2686) |
0.2724 (-0.1830) |
| 0.9583 |
4900 |
0.3585 |
0.3541 |
0.3362 (-0.2042) |
0.2174 (-0.1076) |
0.2551 (-0.2456) |
0.2696 (-0.1858) |
| 0.9779 |
5000 |
0.3657 |
0.3538 |
0.3532 (-0.1872) |
0.2241 (-0.1010) |
0.2461 (-0.2545) |
0.2745 (-0.1809) |
| 0.9975 |
5100 |
0.3656 |
0.3539 |
0.3532 (-0.1872) |
0.2246 (-0.1004) |
0.2449 (-0.2557) |
0.2743 (-0.1811) |
| -1 |
-1 |
- |
- |
0.3609 (-0.1795) |
0.2211 (-0.1040) |
0.2574 (-0.2433) |
0.2798 (-0.1756) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.13
- Sentence Transformers: 5.0.0
- Transformers: 4.51.0
- PyTorch: 2.9.1+cu126
- Accelerate: 1.8.1
- Datasets: 3.6.0
- Tokenizers: 0.21.4-dev.0
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}