CrossEncoder based on cross-encoder/mmarco-mMiniLMv2-L12-H384-v1

This is a Cross Encoder model finetuned from cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 on the arabic-ecom-data 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: cross-encoder/mmarco-mMiniLMv2-L12-H384-v1
  • Maximum Sequence Length: 128 tokens
  • Number of Output Labels: 1 label
  • Supported Modality: Text
  • Training Dataset:
    • arabic-ecom-data

Model Sources

Full Model Architecture

CrossEncoder(
  (0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'XLMRobertaForSequenceClassification'})
)

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("leafxyz/arabic-ecom-cross-encoder-v3")
# Get scores for pairs of inputs
pairs = [
    ['مناديل مطبخ', 'صابون اواني جودي - 960 مل (الليمون الاخضر)'],
    ['جبنة هابي كاو', 'هابي كاو جبنة كريمى - 150 غ'],
    ['كريم تايغر للشعر', 'كريم ازالة شعر - Page Vine'],
    ['لانشون حلواني', 'لانشون حلواني دجاج - 250 غ'],
    ['صابون جودي 2.32', 'صابون اواني جودي برائحة الليمون الاخضر - 2.32 ل'],
]
scores = model.predict(pairs)
print(scores)
# [-5.0312  0.2981 -1.2588  0.6904  0.7002]

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'مناديل مطبخ',
    [
        'صابون اواني جودي - 960 مل (الليمون الاخضر)',
        'هابي كاو جبنة كريمى - 150 غ',
        'كريم ازالة شعر - Page Vine',
        'لانشون حلواني دجاج - 250 غ',
        'صابون اواني جودي برائحة الليمون الاخضر - 2.32 ل',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Training Details

Training Dataset

arabic-ecom-data

  • Dataset: arabic-ecom-data
  • Size: 246,013 training samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 label
    type string string float
    details
    • min: 3 tokens
    • mean: 7.77 tokens
    • max: 20 tokens
    • min: 4 tokens
    • mean: 13.06 tokens
    • max: 27 tokens
    • min: 0.0
    • mean: 0.49
    • max: 1.0
  • Samples:
    sentence1 sentence2 label
    فلوتس أصبع كيت كات شوكلاتة 4 اصابع 36.5 جم 0.0
    بخور عود ند شيخ العرب بخور العود- اصل العود 0.0
    احمر شفاه Rhode احمر شفاه - Water Lip Matte 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

arabic-ecom-data

  • Dataset: arabic-ecom-data
  • Size: 5,021 evaluation samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 label
    type string string float
    details
    • min: 3 tokens
    • mean: 7.86 tokens
    • max: 16 tokens
    • min: 4 tokens
    • mean: 13.19 tokens
    • max: 33 tokens
    • min: 0.0
    • mean: 0.48
    • max: 1.0
  • Samples:
    sentence1 sentence2 label
    مناديل مطبخ صابون اواني جودي - 960 مل (الليمون الاخضر) 0.0
    جبنة هابي كاو هابي كاو جبنة كريمى - 150 غ 1.0
    كريم تايغر للشعر كريم ازالة شعر - Page Vine 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • learning_rate: 2e-05
  • num_train_epochs: 2
  • warmup_steps: 0.1
  • fp16: True

All Hyperparameters

Click to expand
  • do_predict: False
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • 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: 2
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_ratio: None
  • warmup_steps: 0.1
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • enable_jit_checkpoint: False
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • use_cpu: False
  • seed: 42
  • data_seed: None
  • bf16: False
  • fp16: True
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: -1
  • ddp_backend: None
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • 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
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • 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
  • 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_for_metrics: []
  • eval_do_concat_batches: True
  • auto_find_batch_size: False
  • full_determinism: False
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_num_input_tokens_seen: no
  • 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: True
  • use_cache: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Click to expand
Epoch Step Training Loss Validation Loss
0.0130 100 0.8919 -
0.0260 200 0.6599 -
0.0390 300 0.5613 -
0.0520 400 0.5168 -
0.0650 500 0.5278 0.4916
0.0780 600 0.5182 -
0.0911 700 0.4833 -
0.1041 800 0.4863 -
0.1171 900 0.5011 -
0.1301 1000 0.4740 0.4477
0.1431 1100 0.4480 -
0.1561 1200 0.4536 -
0.1691 1300 0.4604 -
0.1821 1400 0.4704 -
0.1951 1500 0.4514 0.4282
0.2081 1600 0.4358 -
0.2211 1700 0.4472 -
0.2341 1800 0.4382 -
0.2471 1900 0.4524 -
0.2601 2000 0.4368 0.4112
0.2732 2100 0.4272 -
0.2862 2200 0.4280 -
0.2992 2300 0.4276 -
0.3122 2400 0.4067 -
0.3252 2500 0.4260 0.4026
0.3382 2600 0.4321 -
0.3512 2700 0.4333 -
0.3642 2800 0.4246 -
0.3772 2900 0.4304 -
0.3902 3000 0.4237 0.3938
0.4032 3100 0.4181 -
0.4162 3200 0.4224 -
0.4292 3300 0.4096 -
0.4422 3400 0.4069 -
0.4553 3500 0.4045 0.3963
0.4683 3600 0.4164 -
0.4813 3700 0.3996 -
0.4943 3800 0.4053 -
0.5073 3900 0.3853 -
0.5203 4000 0.4035 0.3818
0.5333 4100 0.4043 -
0.5463 4200 0.3914 -
0.5593 4300 0.4022 -
0.5723 4400 0.3949 -
0.5853 4500 0.4094 0.3821
0.5983 4600 0.3782 -
0.6113 4700 0.3908 -
0.6243 4800 0.3944 -
0.6374 4900 0.4112 -
0.6504 5000 0.4077 0.3676
0.6634 5100 0.4034 -
0.6764 5200 0.3958 -
0.6894 5300 0.3988 -
0.7024 5400 0.3835 -
0.7154 5500 0.4065 0.3680
0.7284 5600 0.3910 -
0.7414 5700 0.3959 -
0.7544 5800 0.4005 -
0.7674 5900 0.3967 -
0.7804 6000 0.3947 0.3734
0.7934 6100 0.3916 -
0.8065 6200 0.4023 -
0.8195 6300 0.3869 -
0.8325 6400 0.3821 -
0.8455 6500 0.3845 0.3716
0.8585 6600 0.3637 -
0.8715 6700 0.3828 -
0.8845 6800 0.3703 -
0.8975 6900 0.3962 -
0.9105 7000 0.3880 0.3592
0.9235 7100 0.3846 -
0.9365 7200 0.3722 -
0.9495 7300 0.3946 -
0.9625 7400 0.3779 -
0.9755 7500 0.3957 0.3550
0.9886 7600 0.3763 -
1.0016 7700 0.3732 -
1.0146 7800 0.3763 -
1.0276 7900 0.3713 -
1.0406 8000 0.3594 0.3597
1.0536 8100 0.3510 -
1.0666 8200 0.3738 -
1.0796 8300 0.3554 -
1.0926 8400 0.3524 -
1.1056 8500 0.3507 0.3577
1.1186 8600 0.3483 -
1.1316 8700 0.3692 -
1.1446 8800 0.3676 -
1.1576 8900 0.3484 -
1.1707 9000 0.3859 0.3502
1.1837 9100 0.3590 -
1.1967 9200 0.3746 -
1.2097 9300 0.3559 -
1.2227 9400 0.3631 -
1.2357 9500 0.3500 0.3685
1.2487 9600 0.3496 -
1.2617 9700 0.3803 -
1.2747 9800 0.3442 -
1.2877 9900 0.3503 -
1.3007 10000 0.3636 0.3504
1.3137 10100 0.3479 -
1.3267 10200 0.3768 -
1.3398 10300 0.3501 -
1.3528 10400 0.3563 -
1.3658 10500 0.3551 0.3515
1.3788 10600 0.3645 -
1.3918 10700 0.3466 -
1.4048 10800 0.3622 -
1.4178 10900 0.3535 -
1.4308 11000 0.3708 0.3452
1.4438 11100 0.3484 -
1.4568 11200 0.3593 -
1.4698 11300 0.3554 -
1.4828 11400 0.3362 -
1.4958 11500 0.3707 0.3458
1.5088 11600 0.3559 -
1.5219 11700 0.3501 -
1.5349 11800 0.3771 -
1.5479 11900 0.3586 -
1.5609 12000 0.3462 0.3478
1.5739 12100 0.3448 -
1.5869 12200 0.3516 -
1.5999 12300 0.3582 -
1.6129 12400 0.3621 -
1.6259 12500 0.3724 0.3436
1.6389 12600 0.3598 -
1.6519 12700 0.3616 -
1.6649 12800 0.3537 -
1.6779 12900 0.3462 -
1.6909 13000 0.3675 0.3443
1.7040 13100 0.3506 -
1.7170 13200 0.3389 -
1.7300 13300 0.3454 -
1.7430 13400 0.3588 -
1.7560 13500 0.3521 0.3427
1.7690 13600 0.3462 -
1.7820 13700 0.3513 -
1.7950 13800 0.3484 -
1.8080 13900 0.3522 -
1.8210 14000 0.3426 0.3447
1.8340 14100 0.3497 -
1.8470 14200 0.3464 -
1.8600 14300 0.3427 -
1.8730 14400 0.3422 -
1.8861 14500 0.3398 0.3447
1.8991 14600 0.3487 -
1.9121 14700 0.3608 -
1.9251 14800 0.3515 -
1.9381 14900 0.3456 -
1.9511 15000 0.3499 0.3445
1.9641 15100 0.3404 -
1.9771 15200 0.3482 -
1.9901 15300 0.3464 -

Training Time

  • Training: 21.4 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.4.1
  • Transformers: 5.0.0
  • PyTorch: 2.10.0+cu128
  • Accelerate: 1.13.0
  • Datasets: 5.0.0
  • Tokenizers: 0.22.2

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
48
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 leafxyz/arabic-ecom-cross-encoder-v3

Paper for leafxyz/arabic-ecom-cross-encoder-v3