leafxyz's picture
Upload folder using huggingface_hub
19c8304 verified
|
Raw
History Blame Contribute Delete
28 kB
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:342061
  - loss:CachedMultipleNegativesRankingLoss
base_model: prestoai/qwen3-embedding-0.6b-arabic-ecom
widget:
  - source_sentence: >-
      Instruct: Given an Arabic e-commerce search query, retrieve the product
      that best matches it

      Query: نسونكس Spray
    sentences:
      - Nasonex - Nasal Spray
      - كابل شحن مايكرو XKIN - 2.4A
      - حلوى الشوكولاتة - Choco Lapki
  - source_sentence: >-
      Instruct: Given an Arabic e-commerce search query, retrieve the product
      that best matches it

      Query: مكرونة رقم 42
    sentences:
      - بنطلون رجالي - 0112
      - حقيبة حزام خصر - 4862
      - مكرونة الجيد معكوفة رقم 42 - 500 غ
  - source_sentence: >-
      Instruct: Given an Arabic e-commerce search query, retrieve the product
      that best matches it

      Query: سباغيتي
    sentences:
      - ملعب كرة قدم - DD18
      - مكرونة معكوفة - Favelli
      - مكرونة سباغيتي - Favelli
  - source_sentence: >-
      Instruct: Given an Arabic e-commerce search query, retrieve the product
      that best matches it

      Query: جبنة هواء
    sentences:
      - جبنة - ابو الولد
      - جبنة - Hawaa
      - كاني طعام كلاب البالغين دجاج - 3 ك
  - source_sentence: >-
      Instruct: Given an Arabic e-commerce search query, retrieve the product
      that best matches it

      Query: شاحن تايب سي للسيارة
    sentences:
      - شاحن سيارة قرين ليون مدخلين 36 وات مع كابل تايب سي - CBK
      - صوص المكرونة هاينز - 365 غ
      - بسكويت جولون بدون سكر شكلاتة ساندوتش
pipeline_tag: sentence-similarity
library_name: sentence-transformers

SentenceTransformer based on prestoai/qwen3-embedding-0.6b-arabic-ecom

This is a sentence-transformers model finetuned from prestoai/qwen3-embedding-0.6b-arabic-ecom on the pairs_with_negatives and positives datasets. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: prestoai/qwen3-embedding-0.6b-arabic-ecom
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 1024 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text
  • Training Datasets:
    • pairs_with_negatives
    • positives

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'Qwen3Model'})
  (1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'lasttoken', 'include_prompt': True})
  (2): Normalize({})
)

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 SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
queries = [
    'Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it\nQuery: شاحن تايب سي للسيارة',
]
documents = [
    'شاحن سيارة قرين ليون مدخلين 36 وات مع كابل تايب سي - CBK',
    'بسكويت جولون بدون سكر شكلاتة ساندوتش',
    'صوص المكرونة هاينز - 365 غ',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.6773, -0.0849, -0.0875]])

Training Details

Training Datasets

pairs_with_negatives

  • Dataset: pairs_with_negatives
  • Size: 124,261 training samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 23 tokens
    • mean: 29.44 tokens
    • max: 42 tokens
    • min: 3 tokens
    • mean: 15.95 tokens
    • max: 49 tokens
    • min: 2 tokens
    • mean: 14.87 tokens
    • max: 40 tokens
  • Samples:
    anchor positive negative
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: واقي للوجه دهني
    Anthelios Oil Control (Dry Touch) - La Roche Posay Anthelios Invisible Mist (Dry Touch) - La Roche Posay
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: تن منارة زليتن
    تن منارة زليتن بزيت دوار الشمس - 160 غ تن فاني بزيت دوار الشمس - 160 غ
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: فانتا زجاجة صغيرة
    مشروب فانتا برتقال زجاجة - 330 مل مشروب فانتا - 1 ل (برتقال)
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "mini_batch_size": 8,
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

positives

  • Dataset: positives
  • Size: 217,800 training samples
  • Columns: anchor and positive
  • Approximate statistics based on the first 1000 samples:
    anchor positive
    type string string
    details
    • min: 23 tokens
    • mean: 29.61 tokens
    • max: 52 tokens
    • min: 2 tokens
    • mean: 13.81 tokens
    • max: 41 tokens
  • Samples:
    anchor positive
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: نحب جبنة القرية
    ميرسين جبنة القرية 200 جم
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: كابل شحن مايكرو Moxom A2.4
    كابل شحن مايكرو Moxom - A2.4
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: dry idea
    Dry idea (powder fresh)
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "mini_batch_size": 8,
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

Evaluation Datasets

pairs_with_negatives

  • Dataset: pairs_with_negatives
  • Size: 1,256 evaluation samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 23 tokens
    • mean: 29.56 tokens
    • max: 40 tokens
    • min: 3 tokens
    • mean: 16.04 tokens
    • max: 43 tokens
    • min: 3 tokens
    • mean: 15.05 tokens
    • max: 33 tokens
  • Samples:
    anchor positive negative
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: هيبوتك بوزن
    عطر Hypnotic Poison - PERFECTO COLLECTION عطر Poison Girl - Dior
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: شاحن مايكرو 2.4A
    شحن مايكرو Smila - 2.4A شحن تايب سي Smila - 2.4A
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: تمر صعيدي
    تمر صعيدي مشفوط تمر قصيم مشفوط
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "mini_batch_size": 8,
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

positives

  • Dataset: positives
  • Size: 2,200 evaluation samples
  • Columns: anchor and positive
  • Approximate statistics based on the first 1000 samples:
    anchor positive
    type string string
    details
    • min: 24 tokens
    • mean: 29.27 tokens
    • max: 42 tokens
    • min: 3 tokens
    • mean: 13.61 tokens
    • max: 44 tokens
  • Samples:
    anchor positive
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: حاملة أدوات القطط
    حاملة أدوات القطة - AA04
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: كريم شمس أطفال
    واقي شمس كريمي - Chicco
    Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
    Query: كانديسارتان هيدروكلوروثيازيد
    Candesartan and Hydrochlorothiazide 16mg/12.5mg
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "mini_batch_size": 8,
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • learning_rate: 0.0001
  • num_train_epochs: 1
  • warmup_steps: 0.05
  • 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: 8
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 0.0001
  • 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: None
  • warmup_ratio: None
  • warmup_steps: 0.05
  • 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

Epoch Step Training Loss pairs with negatives loss positives loss
0.0023 25 0.4772 - -
0.0047 50 0.4593 - -
0.0070 75 0.3945 - -
0.0094 100 0.3752 - -
0.0117 125 0.4048 - -
0.0140 150 0.4563 - -
0.0164 175 0.3492 - -
0.0187 200 0.4171 0.3915 0.1481
0.0210 225 0.4297 - -
0.0234 250 0.4365 - -
0.0257 275 0.4344 - -
0.0281 300 0.4184 - -
0.0304 325 0.4198 - -
0.0327 350 0.4293 - -
0.0351 375 0.4759 - -
0.0374 400 0.3312 0.3695 0.1180
0.0398 425 0.3887 - -
0.0421 450 0.4402 - -
0.0444 475 0.4105 - -
0.0468 500 0.3923 - -
0.0491 525 0.3163 - -
0.0514 550 0.3565 - -
0.0538 575 0.3707 - -
0.0561 600 0.3008 0.3388 0.1086
0.0585 625 0.3594 - -
0.0608 650 0.3936 - -
0.0631 675 0.3207 - -
0.0655 700 0.3371 - -
0.0678 725 0.3385 - -
0.0702 750 0.2718 - -
0.0725 775 0.4429 - -
0.0748 800 0.2684 0.3453 0.1043
0.0772 825 0.2539 - -
0.0795 850 0.3239 - -
0.0818 875 0.2944 - -
0.0842 900 0.3067 - -
0.0865 925 0.3113 - -
0.0889 950 0.3387 - -
0.0912 975 0.2735 - -
0.0935 1000 0.2985 0.3211 0.0891
0.0959 1025 0.3553 - -
0.0982 1050 0.2568 - -
0.1006 1075 0.3447 - -
0.1029 1100 0.3239 - -
0.1052 1125 0.3015 - -
0.1076 1150 0.3865 - -
0.1099 1175 0.2982 - -
0.1122 1200 0.3105 0.3232 0.0829
0.1146 1225 0.2964 - -
0.1169 1250 0.2417 - -
0.1193 1275 0.2686 - -
0.1216 1300 0.2932 - -
0.1239 1325 0.2383 - -
0.1263 1350 0.3108 - -
0.1286 1375 0.3216 - -
0.1310 1400 0.2083 0.3091 0.0894
0.1333 1425 0.2933 - -
0.1356 1450 0.2038 - -
0.1380 1475 0.2515 - -
0.1403 1500 0.2643 - -
0.1426 1525 0.2484 - -
0.1450 1550 0.3216 - -
0.1473 1575 0.3265 - -
0.1497 1600 0.2626 0.3166 0.0775
0.1520 1625 0.2811 - -
0.1543 1650 0.2792 - -
0.1567 1675 0.2888 - -
0.1590 1700 0.3243 - -
0.1614 1725 0.2318 - -
0.1637 1750 0.2943 - -
0.1660 1775 0.2494 - -
0.1684 1800 0.3478 0.3113 0.0751
0.1707 1825 0.3265 - -
0.1730 1850 0.2933 - -
0.1754 1875 0.2671 - -
0.1777 1900 0.2927 - -
0.1801 1925 0.2939 - -
0.1824 1950 0.2356 - -
0.1847 1975 0.2413 - -
0.1871 2000 0.2026 0.2921 0.0650

Training Time

  • Training: 2.2 hours

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",
}

CachedMultipleNegativesRankingLoss

@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}