CrossEncoder based on BAAI/bge-reranker-v2-m3
This is a Cross Encoder model finetuned from BAAI/bge-reranker-v2-m3 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 Type: Cross Encoder
- Base model: BAAI/bge-reranker-v2-m3
- Maximum Sequence Length: 8192 tokens
- Number of Output Labels: 1 label
- Training Dataset:
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("jayshah5696/er2-ce-bge-reranker-m3-ft")
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)
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'}",
]
)
Evaluation
Metrics
Cross Encoder Binary Classification
| Metric |
Value |
| accuracy |
0.9992 |
| accuracy_threshold |
0.9999 |
| f1 |
0.9992 |
| f1_threshold |
0.9999 |
| precision |
1.0 |
| recall |
0.9984 |
| average_precision |
0.9994 |
Training Details
Training Dataset
entity-resolution-ce-pairs-v2
Evaluation Dataset
entity-resolution-ce-pairs-v2
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 |
bge_reranker_m3_average_precision |
| 0.0961 |
100 |
0.0224 |
- |
- |
| 0.1921 |
200 |
0.0057 |
- |
- |
| 0.2882 |
300 |
0.0182 |
- |
- |
| 0.3842 |
400 |
0.0167 |
- |
- |
| 0.4803 |
500 |
0.0097 |
- |
- |
| 0.5764 |
600 |
0.0095 |
- |
- |
| 0.6724 |
700 |
0.0093 |
- |
- |
| 0.7685 |
800 |
0.0049 |
- |
- |
| 0.8646 |
900 |
0.0091 |
- |
- |
| 0.9606 |
1000 |
0.0144 |
- |
- |
| 1.0 |
1041 |
- |
0.0059 |
0.9999 |
| 1.0567 |
1100 |
0.007 |
- |
- |
| 1.1527 |
1200 |
0.0188 |
- |
- |
| 1.2488 |
1300 |
0.0071 |
- |
- |
| 1.3449 |
1400 |
0.0144 |
- |
- |
| 1.4409 |
1500 |
0.01 |
- |
- |
| 1.5370 |
1600 |
0.0064 |
- |
- |
| 1.6330 |
1700 |
0.0094 |
- |
- |
| 1.7291 |
1800 |
0.0183 |
- |
- |
| 1.8252 |
1900 |
0.0069 |
- |
- |
| 1.9212 |
2000 |
0.0136 |
- |
- |
| 2.0 |
2082 |
- |
0.0054 |
0.9999 |
| 2.0173 |
2100 |
0.0087 |
- |
- |
| 2.1134 |
2200 |
0.0074 |
- |
- |
| 2.2094 |
2300 |
0.0094 |
- |
- |
| 2.3055 |
2400 |
0.0028 |
- |
- |
| 2.4015 |
2500 |
0.0142 |
- |
- |
| 2.4976 |
2600 |
0.0178 |
- |
- |
| 2.5937 |
2700 |
0.0129 |
- |
- |
| 2.6897 |
2800 |
0.0135 |
- |
- |
| 2.7858 |
2900 |
0.007 |
- |
- |
| 2.8818 |
3000 |
0.0048 |
- |
- |
| 2.9779 |
3100 |
0.0115 |
- |
- |
| 3.0 |
3123 |
- |
0.0060 |
0.9998 |
| 3.0740 |
3200 |
0.0122 |
- |
- |
| 3.1700 |
3300 |
0.0063 |
- |
- |
| 3.2661 |
3400 |
0.0105 |
- |
- |
| 3.3622 |
3500 |
0.0088 |
- |
- |
| 3.4582 |
3600 |
0.0165 |
- |
- |
| 3.5543 |
3700 |
0.0028 |
- |
- |
| 3.6503 |
3800 |
0.0129 |
- |
- |
| 3.7464 |
3900 |
0.0017 |
- |
- |
| 3.8425 |
4000 |
0.0047 |
- |
- |
| 3.9385 |
4100 |
0.0053 |
- |
- |
| 4.0 |
4164 |
- |
0.0093 |
0.9995 |
| 4.0346 |
4200 |
0.0033 |
- |
- |
| 4.1306 |
4300 |
0.0034 |
- |
- |
| 4.2267 |
4400 |
0.0002 |
- |
- |
| 4.3228 |
4500 |
0.0025 |
- |
- |
| 4.4188 |
4600 |
0.0045 |
- |
- |
| 4.5149 |
4700 |
0.0132 |
- |
- |
| 4.6110 |
4800 |
0.0004 |
- |
- |
| 4.7070 |
4900 |
0.0043 |
- |
- |
| 4.8031 |
5000 |
0.0031 |
- |
- |
| 4.8991 |
5100 |
0.0001 |
- |
- |
| 4.9952 |
5200 |
0.001 |
- |
- |
| 5.0 |
5205 |
- |
0.0108 |
0.9994 |
- 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",
}