CrossEncoder based on jhu-clsp/ettin-encoder-1b

This is a Cross Encoder model finetuned from jhu-clsp/ettin-encoder-1b on the msmarco 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-1b
  • 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

# Download from the 🤗 Hub
model = CrossEncoder("kdhole/reranker-ettin-encoder-1b-msmarco-bce-10m")
# Get scores for pairs of texts
pairs = [
    ['what is the zip code for hamilton nj', 'Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable.'],
    ['which cooking oil is healthy', "Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease."],
    ['what canadian cities have the highest crime rates?', 'Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average.'],
    ['how to delete bcc', 'How to delete the CC/BCC rule. 1  Open Auto BCC dialog box. 2  Select the rule you need in the list and click the Delete button on the top toolbar or the Delete key on your keyboard. 3  Confirm deletion and click Ok to save changes.'],
    ['what county is waukegan illinois in?', 'Downtown Waukegan is the urban center of Lake County. Many restaurants, bars, shops, the Waukegan Public Library, the College of Lake County, the Lake County Courthouse (including the William D. Block Memorial Law Library), and much more call Downtown Waukegan their home.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'what is the zip code for hamilton nj',
    [
        'Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable.',
        "Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.",
        'Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average.',
        'How to delete the CC/BCC rule. 1  Open Auto BCC dialog box. 2  Select the rule you need in the list and click the Delete button on the top toolbar or the Delete key on your keyboard. 3  Confirm deletion and click Ok to save changes.',
        'Downtown Waukegan is the urban center of Lake County. Many restaurants, bars, shops, the Waukegan Public Library, the College of Lake County, the Lake County Courthouse (including the William D. Block Memorial Law Library), and much more call Downtown Waukegan their home.',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Evaluation

Metrics

Cross Encoder Reranking

  • Datasets: NanoMSMARCO_R100, NanoNFCorpus_R100 and NanoNQ_R100
  • Evaluated with CrossEncoderRerankingEvaluator with these parameters:
    {
        "at_k": 10,
        "always_rerank_positives": true
    }
    
Metric NanoMSMARCO_R100 NanoNFCorpus_R100 NanoNQ_R100
map 0.6418 (+0.1522) 0.3816 (+0.1206) 0.7240 (+0.3044)
mrr@10 0.6372 (+0.1597) 0.5641 (+0.0642) 0.7315 (+0.3048)
ndcg@10 0.7051 (+0.1647) 0.4148 (+0.0898) 0.7717 (+0.2710)

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.5824 (+0.1924)
mrr@10 0.6443 (+0.1763)
ndcg@10 0.6305 (+0.1752)

Training Details

Training Dataset

msmarco

  • Dataset: msmarco at 9e329ed
  • Size: 9,960,000 training samples
  • Columns: query, passage, and score
  • Approximate statistics based on the first 1000 samples:
    query passage score
    type string string float
    details
    • min: 10 characters
    • mean: 33.92 characters
    • max: 156 characters
    • min: 80 characters
    • mean: 344.88 characters
    • max: 1061 characters
    • min: 0.0
    • mean: 0.48
    • max: 1.0
  • Samples:
    query passage score
    what is liquid resources Renewable Resources. Renewable resources are resources that are replenished by the environment over relatively short periods of time. This type of resource is much more desirable to use because often a resource renews so fast that it will have regenerated by the time you've used it up.n contrast to renewable resources, non-renewable resources are resources that are not easily replenished by the environment. Let's think about this in terms of that ice cube maker again. 0.0
    halo laser treatment Laser surgery (photocoagulation) With laser surgery, your ophthalmologist uses a laser to make small burns around the retinal tear. The scarring that results seals the retina to the underlying tissue, helping to prevent a retinal detachment. Freezing treatment (cryopexy) 0.0
    three motorcycle car Can-Am Spyder roadster: three wheeled motorcycle. February 20, 2007 BRP has unveiled its first on-road vehicle, the 2008 Can-Am Spyder roadster. This three-wheel vehicle, with two wheels in the front and one in the rear, offers a completely new and stunning look. Powered by a proven 990cc V Twin engine designed and manufactured by BRP-Rotax, Spyder roadster, with its unique Y-architecture, can be described as part motorcycle and part convertible sports car. 1.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

msmarco

  • Dataset: msmarco at 9e329ed
  • Size: 40,000 evaluation samples
  • Columns: query, passage, and score
  • Approximate statistics based on the first 1000 samples:
    query passage score
    type string string float
    details
    • min: 12 characters
    • mean: 34.65 characters
    • max: 132 characters
    • min: 65 characters
    • mean: 345.56 characters
    • max: 874 characters
    • min: 0.0
    • mean: 0.49
    • max: 1.0
  • Samples:
    query passage score
    what is the zip code for hamilton nj Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable. 0.0
    which cooking oil is healthy Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease. 0.0
    what canadian cities have the highest crime rates? Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average. 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • learning_rate: 2e-05
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • seed: 12
  • bf16: True
  • dataloader_num_workers: 4
  • 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: 64
  • per_device_eval_batch_size: 64
  • 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: 4
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • 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}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • 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
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: 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
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

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.0000 (-0.5404) 0.2648 (-0.0602) 0.0388 (-0.4618) 0.1012 (-0.3541)
0.0000 1 0.8074 - - - - -
0.0643 10000 0.1734 0.1322 0.6852 (+0.1448) 0.3939 (+0.0689) 0.7987 (+0.2980) 0.6259 (+0.1706)
0.1285 20000 0.1273 0.1189 0.7051 (+0.1647) 0.4148 (+0.0898) 0.7717 (+0.2710) 0.6305 (+0.1752)
0.1928 30000 0.1104 0.1027 0.7116 (+0.1712) 0.4199 (+0.0948) 0.7473 (+0.2467) 0.6263 (+0.1709)
0.2570 40000 0.0958 0.0929 0.6721 (+0.1317) 0.4184 (+0.0933) 0.7930 (+0.2923) 0.6278 (+0.1724)
0.3213 50000 0.0847 0.0773 0.6695 (+0.1291) 0.3852 (+0.0602) 0.7673 (+0.2666) 0.6074 (+0.1520)
0.3855 60000 0.0746 0.0696 0.7101 (+0.1697) 0.4118 (+0.0868) 0.7599 (+0.2592) 0.6273 (+0.1719)
0.4498 70000 0.0672 0.0618 0.6663 (+0.1259) 0.3761 (+0.0511) 0.7701 (+0.2694) 0.6042 (+0.1488)
0.5141 80000 0.0603 0.0552 0.6773 (+0.1369) 0.3854 (+0.0603) 0.7780 (+0.2774) 0.6136 (+0.1582)
0.5783 90000 0.0544 0.0527 0.7135 (+0.1731) 0.3787 (+0.0537) 0.7756 (+0.2749) 0.6226 (+0.1672)
0.6426 100000 0.0487 0.0459 0.6979 (+0.1575) 0.3926 (+0.0676) 0.7583 (+0.2576) 0.6163 (+0.1609)
0.7068 110000 0.045 0.0405 0.7091 (+0.1687) 0.3653 (+0.0403) 0.7517 (+0.2511) 0.6087 (+0.1533)
0.7711 120000 0.0403 0.0386 0.6964 (+0.1560) 0.3840 (+0.0590) 0.7767 (+0.2760) 0.6191 (+0.1637)
0.8353 130000 0.036 0.0322 0.7017 (+0.1613) 0.3732 (+0.0482) 0.7575 (+0.2568) 0.6108 (+0.1554)
0.8996 140000 0.0325 0.0283 0.7006 (+0.1602) 0.3814 (+0.0563) 0.7595 (+0.2588) 0.6138 (+0.1585)
0.9639 150000 0.0298 0.0255 0.6920 (+0.1516) 0.3719 (+0.0469) 0.7797 (+0.2791) 0.6146 (+0.1592)
-1 -1 - - 0.7051 (+0.1647) 0.4148 (+0.0898) 0.7717 (+0.2710) 0.6305 (+0.1752)
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.9.18
  • Sentence Transformers: 5.1.1
  • Transformers: 4.56.2
  • PyTorch: 2.8.0+cu128
  • Accelerate: 1.10.1
  • Datasets: 4.1.1
  • Tokenizers: 0.22.1

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",
}
Downloads last month
45
Safetensors
Model size
1.03B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kdhole/reranker-ettin-encoder-1b-msmarco-bce-10m

Finetuned
(7)
this model

Dataset used to train kdhole/reranker-ettin-encoder-1b-msmarco-bce-10m

Collection including kdhole/reranker-ettin-encoder-1b-msmarco-bce-10m

Evaluation results