CrossEncoder based on ibm-granite/granite-embedding-reranker-english-r2

This is a Cross Encoder model finetuned from ibm-granite/granite-embedding-reranker-english-r2 on the entity-resolution-ce-pairs-v2 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 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("jayshah5696/er2-ce-granite-reranker-ft")
# Get scores for pairs of texts
pairs = [
    ["{'entity_id': 'E2-013271', 'first_name': 'Ramswaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'}", "{'entity_id': 'E2-013271', 'first_name': 'Ramsaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'}"],
    ["{'entity_id': 'E2-036160', 'first_name': 'Lole', 'last_name': 'Camaney', 'company': 'Monroe Capital CFO I Ltd.', 'title': 'Computer Technology Trainer', 'email': 'lole@monroecapitalcfoi.com', 'country': 'KY', 'ethnicity_group': 'hispanic', 'name_script': 'latin'}", "{'entity_id': 'E2-045966', 'first_name': 'Lali', 'last_name': 'Roig', 'company': 'AQUA AEREM (DBH) PTY LTD', 'title': 'Clamp Operator', 'email': 'laliroig@aquaaeremdbh.com', 'country': 'AU', 'ethnicity_group': 'other', 'name_script': 'latin'}"],
    ["{'entity_id': 'E2-045272', 'first_name': 'Rim', 'last_name': 'Hue', 'company': 'Edizioni ZYX Music SRL', 'title': 'Radiologic Technology Teacher', 'email': 'rim_hue@edizionizyxmusic.com', 'country': 'IT', 'ethnicity_group': 'other', 'name_script': 'latin'}", "{'entity_id': 'E2-043277', 'first_name': 'Less', 'last_name': 'Hue', 'company': 'EXERGY S.P.A. - IN LIQUIDAZIONE', 'title': 'Personnel Quality Assurance Auditor', 'email': 'less_hue@exergyspainliquidazione.com', 'country': 'IT', 'ethnicity_group': 'other', 'name_script': 'latin'}"],
    ["{'entity_id': 'E2-010159', 'first_name': 'Brianna', 'last_name': 'Cruzmartinez', 'company': 'S PARIKH AND CO', 'title': 'General Manager (GM)', 'email': 'bcruzmartinez@sparikhand.com', 'country': 'IN', 'ethnicity_group': 'us_uk_english', 'name_script': 'latin'}", "{'entity_id': 'E2-010442', 'first_name': 'Brian', 'last_name': 'Alves', 'company': '中州國際證券有限公司', 'title': 'Soaking Pits Supervisor', 'email': 'brian.alves@example.com', 'country': 'HK', 'ethnicity_group': 'us_uk_english', 'name_script': 'latin'}"],
    ["{'entity_id': 'E2-015732', 'first_name': 'Ikka', 'last_name': 'Dhurve', 'company': 'Tiburon Unternehmensaufbau GmbH', 'title': 'Freight Elevator Operator', 'email': 'idhurve@tiburonunternehmensaufbau.com', 'country': 'DE', 'ethnicity_group': 'indian', 'name_script': 'latin'}", "{'entity_id': 'E2-015732', 'first_name': 'Ikka', 'last_name': 'Dhurve', 'company': 'Tiburon Unternehmensaufbau', 'title': 'Freight Elevator Operator', 'email': 'idhurve@tiburonunternehmensaufbau.com', 'country': 'DE', 'ethnicity_group': 'indian', 'name_script': 'latin'}"],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    "{'entity_id': 'E2-013271', 'first_name': 'Ramswaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'}",
    [
        "{'entity_id': 'E2-013271', 'first_name': 'Ramsaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'}",
        "{'entity_id': 'E2-045966', 'first_name': 'Lali', 'last_name': 'Roig', 'company': 'AQUA AEREM (DBH) PTY LTD', 'title': 'Clamp Operator', 'email': 'laliroig@aquaaeremdbh.com', 'country': 'AU', 'ethnicity_group': 'other', 'name_script': 'latin'}",
        "{'entity_id': 'E2-043277', 'first_name': 'Less', 'last_name': 'Hue', 'company': 'EXERGY S.P.A. - IN LIQUIDAZIONE', 'title': 'Personnel Quality Assurance Auditor', 'email': 'less_hue@exergyspainliquidazione.com', 'country': 'IT', 'ethnicity_group': 'other', 'name_script': 'latin'}",
        "{'entity_id': 'E2-010442', 'first_name': 'Brian', 'last_name': 'Alves', 'company': '中州國際證券有限公司', 'title': 'Soaking Pits Supervisor', 'email': 'brian.alves@example.com', 'country': 'HK', 'ethnicity_group': 'us_uk_english', 'name_script': 'latin'}",
        "{'entity_id': 'E2-015732', 'first_name': 'Ikka', 'last_name': 'Dhurve', 'company': 'Tiburon Unternehmensaufbau', 'title': 'Freight Elevator Operator', 'email': 'idhurve@tiburonunternehmensaufbau.com', 'country': 'DE', 'ethnicity_group': 'indian', 'name_script': 'latin'}",
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Evaluation

Metrics

Cross Encoder Binary Classification

Metric Value
accuracy 0.9992
accuracy_threshold 0.5001
f1 0.9992
f1_threshold 0.5001
precision 1.0
recall 0.9984
average_precision 0.9995

Training Details

Training Dataset

entity-resolution-ce-pairs-v2

  • Dataset: entity-resolution-ce-pairs-v2 at 8b9c268
  • Size: 33,290 training samples
  • Columns: label, text_a, and text_b
  • Approximate statistics based on the first 1000 samples:
    label text_a text_b
    type int string string
    details
    • 0: ~52.80%
    • 1: ~47.20%
    • min: 210 characters
    • mean: 269.24 characters
    • max: 481 characters
    • min: 200 characters
    • mean: 268.38 characters
    • max: 731 characters
  • Samples:
    label text_a text_b
    0 {'entity_id': 'E2-011894', 'first_name': 'Noel', 'last_name': 'Muldowney', 'company': 'HIPP UK LIMITED', 'title': 'Flight Teacher', 'email': 'nmuldowney@hipp.com', 'country': 'GB', 'ethnicity_group': 'us_uk_english', 'name_script': 'latin'} {'entity_id': 'E2-003538', 'first_name': 'Neal', 'last_name': 'Ellenberger', 'company': 'Hawthorns Park Ltd', 'title': 'Rip Sawyer', 'email': 'nealellenberger@hawthornspark.com', 'country': 'GB', 'ethnicity_group': 'us_uk_english', 'name_script': 'latin'}
    1 {'entity_id': 'E2-024730', 'first_name': '正平', 'last_name': 'Yan', 'company': 'TRUSTEE OF M I L WADLEY DECEASED WILL TRUST', 'title': 'Radial Drill Press Operator', 'email': '正平yan@trusteeofmilwadleydeceasedwilltrust.com', 'country': 'GB', 'ethnicity_group': 'chinese', 'name_script': 'cjk'} {'entity_id': 'E2-024730', 'first_name': '正平', 'last_name': 'Yan', 'company': 'TRUSTEE OF M I L WADLEY DECEASED WILL TRUST Inc', 'title': 'Radial Drill Press Operator', 'email': '正平yan@trusteeofmilwadleydeceasedwilltrust.com', 'country': 'GB', 'ethnicity_group': 'chinese', 'name_script': 'cjk'}
    0 {'entity_id': 'E2-044064', 'first_name': 'Gîte', 'last_name': 'Gi', 'company': 'VECMEDICAL SPAIN SL', 'title': 'Shellfish Bed Worker', 'email': 'gîte.gi@vecmedicalspain.com', 'country': 'ES', 'ethnicity_group': 'other', 'name_script': 'latin'} {'entity_id': 'E2-030776', 'first_name': 'Anyelo', 'last_name': 'Dela Cruz', 'company': 'AVURNAVE S.L', 'title': 'Nail Assembly Machine Operator', 'email': 'adela cruz@avurnave.com', 'country': 'ES', 'ethnicity_group': 'hispanic', 'name_script': 'latin'}
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

entity-resolution-ce-pairs-v2

  • Dataset: entity-resolution-ce-pairs-v2 at 8b9c268
  • Size: 3,802 evaluation samples
  • Columns: label, text_a, and text_b
  • Approximate statistics based on the first 1000 samples:
    label text_a text_b
    type int string string
    details
    • 0: ~49.10%
    • 1: ~50.90%
    • min: 209 characters
    • mean: 268.91 characters
    • max: 596 characters
    • min: 197 characters
    • mean: 267.52 characters
    • max: 596 characters
  • Samples:
    label text_a text_b
    1 {'entity_id': 'E2-013271', 'first_name': 'Ramswaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'} {'entity_id': 'E2-013271', 'first_name': 'Ramsaroop', 'last_name': 'Kakoti', 'company': 'KDS APPLIANCES RBS', 'title': 'Highway Painter Helper', 'email': 'ramswaroop_kakoti@kdsappliancesrbs.com', 'country': 'GB', 'ethnicity_group': 'indian', 'name_script': 'latin'}
    0 {'entity_id': 'E2-036160', 'first_name': 'Lole', 'last_name': 'Camaney', 'company': 'Monroe Capital CFO I Ltd.', 'title': 'Computer Technology Trainer', 'email': 'lole@monroecapitalcfoi.com', 'country': 'KY', 'ethnicity_group': 'hispanic', 'name_script': 'latin'} {'entity_id': 'E2-045966', 'first_name': 'Lali', 'last_name': 'Roig', 'company': 'AQUA AEREM (DBH) PTY LTD', 'title': 'Clamp Operator', 'email': 'laliroig@aquaaeremdbh.com', 'country': 'AU', 'ethnicity_group': 'other', 'name_script': 'latin'}
    0 {'entity_id': 'E2-045272', 'first_name': 'Rim', 'last_name': 'Hue', 'company': 'Edizioni ZYX Music SRL', 'title': 'Radiologic Technology Teacher', 'email': 'rim_hue@edizionizyxmusic.com', 'country': 'IT', 'ethnicity_group': 'other', 'name_script': 'latin'} {'entity_id': 'E2-043277', 'first_name': 'Less', 'last_name': 'Hue', 'company': 'EXERGY S.P.A. - IN LIQUIDAZIONE', 'title': 'Personnel Quality Assurance Auditor', 'email': 'less_hue@exergyspainliquidazione.com', 'country': 'IT', 'ethnicity_group': 'other', 'name_script': 'latin'}
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: epoch
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 64
  • learning_rate: 2e-05
  • num_train_epochs: 5
  • warmup_ratio: 0.1
  • fp16: True
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • 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: 5
  • 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: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • 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: 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}
  • 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
  • dispatch_batches: None
  • split_batches: 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 granite_reranker_average_precision
0.0961 100 0.6102 - -
0.1921 200 0.0099 - -
0.2882 300 0.0183 - -
0.3842 400 0.015 - -
0.4803 500 0.0099 - -
0.5764 600 0.0097 - -
0.6724 700 0.0095 - -
0.7685 800 0.005 - -
0.8646 900 0.009 - -
0.9606 1000 0.0132 - -
1.0 1041 - 0.005 0.9999
1.0567 1100 0.0068 - -
1.1527 1200 0.0159 - -
1.2488 1300 0.0061 - -
1.3449 1400 0.0123 - -
1.4409 1500 0.0093 - -
1.5370 1600 0.0044 - -
1.6330 1700 0.0041 - -
1.7291 1800 0.0132 - -
1.8252 1900 0.0074 - -
1.9212 2000 0.0104 - -
2.0 2082 - 0.0078 0.9998
2.0173 2100 0.0073 - -
2.1134 2200 0.0064 - -
2.2094 2300 0.0054 - -
2.3055 2400 0.0017 - -
2.4015 2500 0.0063 - -
2.4976 2600 0.0134 - -
2.5937 2700 0.0051 - -
2.6897 2800 0.009 - -
2.7858 2900 0.0037 - -
2.8818 3000 0.0014 - -
2.9779 3100 0.0084 - -
3.0 3123 - 0.0054 0.9999
3.0740 3200 0.0044 - -
3.1700 3300 0.0014 - -
3.2661 3400 0.0008 - -
3.3622 3500 0.0014 - -
3.4582 3600 0.0007 - -
3.5543 3700 0.0001 - -
3.6503 3800 0.0015 - -
3.7464 3900 0.0009 - -
3.8425 4000 0.0003 - -
3.9385 4100 0.0002 - -
4.0 4164 - 0.0103 0.9998
4.0346 4200 0.0009 - -
4.1306 4300 0.0002 - -
4.2267 4400 0.0002 - -
4.3228 4500 0.0003 - -
4.4188 4600 0.0001 - -
4.5149 4700 0.0005 - -
4.6110 4800 0.0001 - -
4.7070 4900 0.0002 - -
4.8031 5000 0.0002 - -
4.8991 5100 0.0 - -
4.9952 5200 0.0001 - -
5.0 5205 - 0.0111 0.9995
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.11.12
  • Sentence Transformers: 5.0.0
  • Transformers: 4.49.0
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.13.0
  • Datasets: 4.8.3
  • Tokenizers: 0.21.4

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
8
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jayshah5696/er2-ce-granite-reranker-ft

Dataset used to train jayshah5696/er2-ce-granite-reranker-ft

Paper for jayshah5696/er2-ce-granite-reranker-ft

Evaluation results