CrossEncoder based on jhu-clsp/ettin-encoder-32m
This is a Cross Encoder model finetuned from jhu-clsp/ettin-encoder-32m 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-32m
- 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-32m-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.3895 (-0.1001) |
0.2999 (+0.0389) |
0.4044 (-0.0152) |
| mrr@10 |
0.3770 (-0.1005) |
0.4257 (-0.0741) |
0.3933 (-0.0334) |
| ndcg@10 |
0.4594 (-0.0810) |
0.2999 (-0.0252) |
0.4430 (-0.0576) |
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.3646 (-0.0255) |
| mrr@10 |
0.3987 (-0.0693) |
| ndcg@10 |
0.4008 (-0.0546) |
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.0376 (-0.5028) |
0.2279 (-0.0971) |
0.0582 (-0.4425) |
0.1079 (-0.3475) |
| 0.0002 |
1 |
2.0786 |
- |
- |
- |
- |
- |
| 0.0196 |
100 |
0.9109 |
0.4400 |
0.0414 (-0.4990) |
0.2515 (-0.0736) |
0.0612 (-0.4395) |
0.1180 (-0.3373) |
| 0.0391 |
200 |
0.4099 |
0.4033 |
0.0616 (-0.4788) |
0.2275 (-0.0976) |
0.1007 (-0.3999) |
0.1299 (-0.3254) |
| 0.0587 |
300 |
0.401 |
0.3893 |
0.0835 (-0.4569) |
0.2305 (-0.0945) |
0.1284 (-0.3723) |
0.1475 (-0.3079) |
| 0.0782 |
400 |
0.3944 |
0.3951 |
0.1113 (-0.4291) |
0.2364 (-0.0887) |
0.1594 (-0.3413) |
0.1690 (-0.2863) |
| 0.0978 |
500 |
0.3952 |
0.3825 |
0.1163 (-0.4241) |
0.2572 (-0.0678) |
0.1533 (-0.3473) |
0.1756 (-0.2797) |
| 0.1173 |
600 |
0.3877 |
0.3761 |
0.1090 (-0.4314) |
0.2594 (-0.0656) |
0.2286 (-0.2720) |
0.1990 (-0.2564) |
| 0.1369 |
700 |
0.385 |
0.4133 |
0.1204 (-0.4200) |
0.2183 (-0.1068) |
0.2298 (-0.2708) |
0.1895 (-0.2659) |
| 0.1565 |
800 |
0.381 |
0.3720 |
0.1904 (-0.3500) |
0.2066 (-0.1184) |
0.2520 (-0.2487) |
0.2163 (-0.2391) |
| 0.1760 |
900 |
0.3794 |
0.3663 |
0.2242 (-0.3162) |
0.2355 (-0.0895) |
0.3338 (-0.1669) |
0.2645 (-0.1909) |
| 0.1956 |
1000 |
0.3802 |
0.3656 |
0.2861 (-0.2544) |
0.2419 (-0.0832) |
0.4119 (-0.0888) |
0.3133 (-0.1421) |
| 0.2151 |
1100 |
0.3658 |
0.3621 |
0.2980 (-0.2424) |
0.2580 (-0.0670) |
0.4014 (-0.0993) |
0.3191 (-0.1362) |
| 0.2347 |
1200 |
0.3762 |
0.3644 |
0.3401 (-0.2003) |
0.2948 (-0.0303) |
0.4294 (-0.0712) |
0.3548 (-0.1006) |
| 0.2543 |
1300 |
0.3773 |
0.3642 |
0.3903 (-0.1501) |
0.2885 (-0.0365) |
0.4761 (-0.0246) |
0.3850 (-0.0704) |
| 0.2738 |
1400 |
0.3759 |
0.3552 |
0.3505 (-0.1899) |
0.2775 (-0.0476) |
0.4214 (-0.0792) |
0.3498 (-0.1056) |
| 0.2934 |
1500 |
0.3696 |
0.3538 |
0.4180 (-0.1224) |
0.3036 (-0.0214) |
0.4652 (-0.0354) |
0.3956 (-0.0597) |
| 0.3129 |
1600 |
0.3692 |
0.3589 |
0.3825 (-0.1580) |
0.3151 (-0.0100) |
0.4158 (-0.0848) |
0.3711 (-0.0843) |
| 0.3325 |
1700 |
0.3648 |
0.3539 |
0.3913 (-0.1491) |
0.2757 (-0.0493) |
0.4396 (-0.0610) |
0.3689 (-0.0865) |
| 0.3520 |
1800 |
0.3635 |
0.3497 |
0.3801 (-0.1603) |
0.2883 (-0.0368) |
0.4180 (-0.0827) |
0.3621 (-0.0932) |
| 0.3716 |
1900 |
0.3618 |
0.3483 |
0.3938 (-0.1466) |
0.2946 (-0.0304) |
0.4409 (-0.0597) |
0.3765 (-0.0789) |
| 0.3912 |
2000 |
0.3606 |
0.3495 |
0.3979 (-0.1425) |
0.2942 (-0.0308) |
0.4336 (-0.0670) |
0.3752 (-0.0801) |
| 0.4107 |
2100 |
0.3701 |
0.3507 |
0.3998 (-0.1406) |
0.2827 (-0.0424) |
0.4383 (-0.0623) |
0.3736 (-0.0818) |
| 0.4303 |
2200 |
0.3673 |
0.3508 |
0.3828 (-0.1576) |
0.2972 (-0.0279) |
0.4097 (-0.0910) |
0.3632 (-0.0922) |
| 0.4498 |
2300 |
0.3501 |
0.3457 |
0.4125 (-0.1279) |
0.2751 (-0.0500) |
0.4192 (-0.0814) |
0.3689 (-0.0865) |
| 0.4694 |
2400 |
0.374 |
0.3498 |
0.4302 (-0.1102) |
0.2935 (-0.0315) |
0.4565 (-0.0441) |
0.3934 (-0.0619) |
| 0.4889 |
2500 |
0.3607 |
0.3486 |
0.4262 (-0.1142) |
0.2957 (-0.0294) |
0.4538 (-0.0469) |
0.3919 (-0.0635) |
| 0.5085 |
2600 |
0.3646 |
0.3490 |
0.4469 (-0.0935) |
0.2743 (-0.0508) |
0.4732 (-0.0274) |
0.3981 (-0.0573) |
| 0.5281 |
2700 |
0.3437 |
0.3484 |
0.4086 (-0.1318) |
0.2852 (-0.0399) |
0.4160 (-0.0846) |
0.3699 (-0.0854) |
| 0.5476 |
2800 |
0.3569 |
0.3547 |
0.4335 (-0.1069) |
0.2874 (-0.0376) |
0.4353 (-0.0654) |
0.3854 (-0.0700) |
| 0.5672 |
2900 |
0.3594 |
0.3479 |
0.4433 (-0.0971) |
0.2870 (-0.0381) |
0.4355 (-0.0652) |
0.3886 (-0.0668) |
| 0.5867 |
3000 |
0.3506 |
0.3503 |
0.4001 (-0.1404) |
0.2883 (-0.0367) |
0.3973 (-0.1033) |
0.3619 (-0.0935) |
| 0.6063 |
3100 |
0.3604 |
0.3476 |
0.4148 (-0.1256) |
0.2894 (-0.0357) |
0.3985 (-0.1021) |
0.3676 (-0.0878) |
| 0.6259 |
3200 |
0.3618 |
0.3462 |
0.4595 (-0.0810) |
0.2943 (-0.0307) |
0.4176 (-0.0831) |
0.3904 (-0.0649) |
| 0.6454 |
3300 |
0.3605 |
0.3451 |
0.4513 (-0.0892) |
0.2910 (-0.0340) |
0.4234 (-0.0773) |
0.3886 (-0.0668) |
| 0.6650 |
3400 |
0.3514 |
0.3414 |
0.4399 (-0.1005) |
0.2886 (-0.0364) |
0.4118 (-0.0889) |
0.3801 (-0.0753) |
| 0.6845 |
3500 |
0.36 |
0.3427 |
0.4385 (-0.1019) |
0.3079 (-0.0171) |
0.4069 (-0.0938) |
0.3844 (-0.0709) |
| 0.7041 |
3600 |
0.3589 |
0.3454 |
0.4573 (-0.0831) |
0.2914 (-0.0337) |
0.4142 (-0.0864) |
0.3876 (-0.0677) |
| 0.7236 |
3700 |
0.3488 |
0.3446 |
0.4594 (-0.0810) |
0.2999 (-0.0252) |
0.4430 (-0.0576) |
0.4008 (-0.0546) |
| 0.7432 |
3800 |
0.3476 |
0.3448 |
0.4587 (-0.0817) |
0.2954 (-0.0296) |
0.4074 (-0.0933) |
0.3872 (-0.0682) |
| 0.7628 |
3900 |
0.3609 |
0.3427 |
0.4591 (-0.0813) |
0.2945 (-0.0306) |
0.4139 (-0.0868) |
0.3892 (-0.0662) |
| 0.7823 |
4000 |
0.3607 |
0.3446 |
0.4765 (-0.0639) |
0.3010 (-0.0241) |
0.4080 (-0.0926) |
0.3952 (-0.0602) |
| 0.8019 |
4100 |
0.3544 |
0.3419 |
0.4653 (-0.0752) |
0.3103 (-0.0148) |
0.4237 (-0.0770) |
0.3997 (-0.0556) |
| 0.8214 |
4200 |
0.357 |
0.3425 |
0.4471 (-0.0933) |
0.3110 (-0.0141) |
0.4161 (-0.0846) |
0.3914 (-0.0640) |
| 0.8410 |
4300 |
0.3512 |
0.3442 |
0.4631 (-0.0774) |
0.2881 (-0.0370) |
0.3933 (-0.1073) |
0.3815 (-0.0739) |
| 0.8606 |
4400 |
0.3405 |
0.3432 |
0.4545 (-0.0859) |
0.2939 (-0.0311) |
0.4123 (-0.0884) |
0.3869 (-0.0685) |
| 0.8801 |
4500 |
0.3617 |
0.3440 |
0.4558 (-0.0846) |
0.2965 (-0.0285) |
0.4011 (-0.0995) |
0.3845 (-0.0709) |
| 0.8997 |
4600 |
0.3496 |
0.3435 |
0.4577 (-0.0827) |
0.3062 (-0.0188) |
0.4181 (-0.0826) |
0.3940 (-0.0614) |
| 0.9192 |
4700 |
0.3539 |
0.3431 |
0.4452 (-0.0952) |
0.2977 (-0.0274) |
0.4073 (-0.0933) |
0.3834 (-0.0719) |
| 0.9388 |
4800 |
0.3448 |
0.3428 |
0.4437 (-0.0967) |
0.2985 (-0.0266) |
0.4044 (-0.0963) |
0.3822 (-0.0732) |
| 0.9583 |
4900 |
0.3472 |
0.3437 |
0.4366 (-0.1038) |
0.2957 (-0.0293) |
0.4057 (-0.0949) |
0.3793 (-0.0760) |
| 0.9779 |
5000 |
0.3531 |
0.3436 |
0.4382 (-0.1022) |
0.2986 (-0.0265) |
0.4084 (-0.0923) |
0.3817 (-0.0736) |
| 0.9975 |
5100 |
0.3538 |
0.3435 |
0.4362 (-0.1043) |
0.2968 (-0.0283) |
0.4085 (-0.0922) |
0.3805 (-0.0749) |
| -1 |
-1 |
- |
- |
0.4594 (-0.0810) |
0.2999 (-0.0252) |
0.4430 (-0.0576) |
0.4008 (-0.0546) |
- 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",
}