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
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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, andnegative - 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 PosayAnthelios Invisible Mist (Dry Touch) - La Roche PosayInstruct: 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:
CachedMultipleNegativesRankingLosswith 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:
anchorandpositive - 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.4Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
Query: dry ideaDry idea (powder fresh) - Loss:
CachedMultipleNegativesRankingLosswith 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, andnegative - 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 - DiorInstruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
Query: شاحن مايكرو 2.4Aشحن مايكرو Smila - 2.4Aشحن تايب سي Smila - 2.4AInstruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
Query: تمر صعيديتمر صعيدي مشفوطتمر قصيم مشفوط - Loss:
CachedMultipleNegativesRankingLosswith 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:
anchorandpositive - 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: حاملة أدوات القططحاملة أدوات القطة - AA04Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
Query: كريم شمس أطفالواقي شمس كريمي - ChiccoInstruct: Given an Arabic e-commerce search query, retrieve the product that best matches it
Query: كانديسارتان هيدروكلوروثيازيدCandesartan and Hydrochlorothiazide 16mg/12.5mg - Loss:
CachedMultipleNegativesRankingLosswith 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: 32learning_rate: 0.0001num_train_epochs: 1warmup_steps: 0.05fp16: True
All Hyperparameters
Click to expand
do_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 8gradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 0.0001weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0.05log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []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: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_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}
}