Omartificial-Intelligence-Space commited on
Commit
e1ef041
·
verified ·
1 Parent(s): 5aa8003

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +128 -358
README.md CHANGED
@@ -4,399 +4,169 @@ tags:
4
  - sentence-similarity
5
  - feature-extraction
6
  - dense
 
 
7
  - generated_from_trainer
8
  - dataset_size:4038
9
  - loss:TripletLoss
10
  - loss:MultipleNegativesRankingLoss
11
  base_model: Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B
12
- widget:
13
- - source_sentence: صعوبة وملل البداية
14
- sentences:
15
- - على طول رحت لمكتبه، وشرحت له وضعي ووقّع لي بدون ما يعقدها. رجعت للعمادة وسلّمت
16
- الطلب وكل شيء مشى تمام.
17
- - هالعادة تضمن لك المروءة وتقضي لزوم المحتاج بدون إحراج.
18
- - أول يوم كنت ألقى نفسي كل شوي ماسكة الجوال أدور على تويتر وسناب شات، كنت أحس بملل
19
- عظيم وكنت فعلًا شبه مكتئبة.
20
- - source_sentence: تقديم وعد بتجربة شتوية مميزة.
21
- sentences:
22
- - نصنع لك رفاهية شتوية.
23
- - نكّد علي لأن فلوسي على قدّي وما أقدر أكل من برا كل يوم. رحت للغرفة ورتبت أغراضي
24
- كلها.
25
- - شاورمر بدت قصتهم في التسعينات يوم قرروا يغيرون نظرة الناس للشاورما من أكلة شوارع
26
- لأكلة مرتبة.
27
- - source_sentence: إعداد الشاي وتقييم الطلعة.
28
- sentences:
29
- - 'هالجو المشحون خلى المجتمع مشدود، وصار صعب تتقبل أي واحد يختلف عنك. الزبدة: السوشيال
30
- ميديا ما هي اللي فرقتنا، هي بس كشفت الخلافات اللي كنا خاشينها تحت البساط من سنين.'
31
- - وصلنا البر وجلسنا فوق طعس رملي وفرشنا، وحطينا غدانا وسمينا بالله وضربنا بالخمس.
32
- - يزرع البن الصالبي في منطقة الإصدار الواقعة بين الشفا وتهامة.
33
- - source_sentence: توجيه للإعلام والجمهور.
34
- sentences:
35
- - اللي يدخل أي سهم لازم يكون في باله انه السهم ممكن ينزل مو لازم يصعد ,الأمر الأخر
36
- لازم يكون الشراء على دفعات وليس بكامل السيولة بسعر واحد,
37
- - حجزت موعد مع مديري وأخبرته بالعرض الجديد وشكرته على الفترة اللي اشتغلت فيها معهم.
38
- - 3. أما الكلام المرسل والتشكيك في الذمم والحكام بدون إثباتات هذا يضر رياضتنا وما
39
- يطورها، الحكم السعودي بشر ويغلط مثل غيره ولازم ندعمه ونطوره، والإعلام لازم يكون
40
- مسؤول ويبتعد عن الشحن والتعصب.
41
- - source_sentence: اعتبار التراجعات السعرية البسيطة خلال جلسة أو جلستين جزءاً طبيعياً
42
- من حركة السهم اليومية.
43
- sentences:
44
- - حتى لاحظت إن الشاشات قاعدة تعطي تنبيه عن الازدحام في الشارع ، وهذا ساعدني أختصر
45
- الطريق.
46
- - 'درس تعليمي: من الطبيعي أن يشهد السهم تصحيحًا بسيطًا خلال جلسة أو جلستين.'
47
- - لكن عند النظر إلى أدائه على الفاصل الأسبوعي، قد تكتشف أن الصورة مختلفة تمامًا.
48
  pipeline_tag: sentence-similarity
49
  library_name: sentence-transformers
 
 
 
 
 
50
  ---
51
 
52
- # SentenceTransformer based on Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B
 
53
 
54
- This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B](https://huggingface.co/Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
55
 
56
- ## Model Details
57
 
58
- ### Model Description
59
- - **Model Type:** Sentence Transformer
60
- - **Base model:** [Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B](https://huggingface.co/Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B) <!-- at revision 2fd04570d54124daa8fab1d0a616a18c17d33b8c -->
61
- - **Maximum Sequence Length:** 512 tokens
62
- - **Output Dimensionality:** 768 dimensions
63
- - **Similarity Function:** Cosine Similarity
64
- <!-- - **Training Dataset:** Unknown -->
65
- <!-- - **Language:** Unknown -->
66
- <!-- - **License:** Unknown -->
67
 
68
- ### Model Sources
 
 
 
 
69
 
70
- - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
71
- - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
72
- - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
73
 
74
- ### Full Model Architecture
75
 
76
- ```
77
- SentenceTransformer(
78
- (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
79
- (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
80
- )
81
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- ## Usage
84
 
85
- ### Direct Usage (Sentence Transformers)
86
 
87
- First install the Sentence Transformers library:
 
 
 
 
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ```bash
90
  pip install -U sentence-transformers
91
  ```
92
-
93
- Then you can load this model and run inference.
94
  ```python
95
  from sentence_transformers import SentenceTransformer
96
 
97
- # Download from the 🤗 Hub
98
- model = SentenceTransformer("sentence_transformers_model_id")
99
- # Run inference
 
100
  sentences = [
101
- 'اعتبار التراجعات السعرية البسيطة خلال جلسة أو جلستين جزءاً طبيعياً من حركة السهم اليومية.',
102
- 'درس تعليمي: من الطبيعي أن يشهد السهم تصحيحًا بسيطًا خلال جلسة أو جلستين.',
103
- 'لكن عند النظر إلى أدائه على الفاصل الأسبوعي، قد تكتشف أن الصورة مختلفة تمامًا.',
104
  ]
105
- embeddings = model.encode(sentences)
106
- print(embeddings.shape)
107
- # [3, 768]
108
-
109
- # Get the similarity scores for the embeddings
110
- similarities = model.similarity(embeddings, embeddings)
111
- print(similarities)
112
- # tensor([[1.0000, 0.6997, 0.2252],
113
- # [0.6997, 1.0000, 0.2973],
114
- # [0.2252, 0.2973, 1.0000]])
115
- ```
116
 
117
- <!--
118
- ### Direct Usage (Transformers)
119
-
120
- <details><summary>Click to see the direct usage in Transformers</summary>
121
-
122
- </details>
123
- -->
124
-
125
- <!--
126
- ### Downstream Usage (Sentence Transformers)
127
-
128
- You can finetune this model on your own dataset.
129
-
130
- <details><summary>Click to expand</summary>
131
-
132
- </details>
133
- -->
134
-
135
- <!--
136
- ### Out-of-Scope Use
137
-
138
- *List how the model may foreseeably be misused and address what users ought not to do with the model.*
139
- -->
140
-
141
- <!--
142
- ## Bias, Risks and Limitations
143
-
144
- *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
145
- -->
146
-
147
- <!--
148
- ### Recommendations
149
-
150
- *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
151
- -->
152
-
153
- ## Training Details
154
-
155
- ### Training Datasets
156
-
157
- #### Unnamed Dataset
158
-
159
- * Size: 2,523 training samples
160
- * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>sentence_2</code>
161
- * Approximate statistics based on the first 1000 samples:
162
- | | sentence_0 | sentence_1 | sentence_2 |
163
- |:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
164
- | type | string | string | string |
165
- | details | <ul><li>min: 3 tokens</li><li>mean: 12.3 tokens</li><li>max: 162 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 29.72 tokens</li><li>max: 455 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 28.64 tokens</li><li>max: 357 tokens</li></ul> |
166
- * Samples:
167
- | sentence_0 | sentence_1 | sentence_2 |
168
- |:------------------------------------------------|:-------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------|
169
- | <code>انقطاع مفاجئ للإنترنت وتعطل العمل.</code> | <code>أمس النت فصل علي فجأة وأنا بوسط اجتماع زووم مهم، وتوهقت ما عرفت وش أسوي.</code> | <code>حاولت أطفي المودم وأشغله زي العادة بس ما نفع، قمت دقيت على 900 وأنا مستعجل.</code> |
170
- | <code>بداية الإصابة والأعراض.</code> | <code>قبل أسبوع تعثرت وأنا أمشي على الدرج، ومن بعدها ركبتي اليسار صارت توجعني إذا حاولت أثنيها.</code> | <code>اضطريت أدفع بالفيزا كامل المبلغ ومشيت الطلب.</code> |
171
- | <code>3. تفاعل مجتمعي إيجابي.</code> | <code>3. والناس صاروا يشجعون المبادرة في السوشيال ميديا.</code> | <code>الجدران سميكة والمباني متلاصقة عشان الظل والأمن وتحس بعظمة الأجداد اللي بنوا هالمجد من الطين والتبن.</code> |
172
- * Loss: [<code>TripletLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#tripletloss) with these parameters:
173
- ```json
174
- {
175
- "distance_metric": "TripletDistanceMetric.COSINE",
176
- "triplet_margin": 0.25
177
- }
178
- ```
179
-
180
- #### Unnamed Dataset
181
-
182
- * Size: 1,515 training samples
183
- * Columns: <code>sentence_0</code> and <code>sentence_1</code>
184
- * Approximate statistics based on the first 1000 samples:
185
- | | sentence_0 | sentence_1 |
186
- |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
187
- | type | string | string |
188
- | details | <ul><li>min: 4 tokens</li><li>mean: 12.92 tokens</li><li>max: 162 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 32.14 tokens</li><li>max: 512 tokens</li></ul> |
189
- * Samples:
190
- | sentence_0 | sentence_1 |
191
- |:--------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------|
192
- | <code>شراء التمور والمغادرة.</code> | <code>بعدها رحت لمحل التمور وأخذت كرتون سكري وكرتون خلاص للبيت.</code> |
193
- | <code>المعالجة والتعويض.</code> | <code>رفعت شكوى في التطبيق وعوضوني برصيد في المحفظة.</code> |
194
- | <code>شرح استخدام BLE في الأجهزة الصحية الذكية داخل المملكة.</code> | <code>السعودية صارت تستخدم تقنية البلوتوث منخفض الطاقة BLE في الأجهزة الصحية الذكية مثل أجهزة قياس السكر والضغط والأساور اللي تتابع حالة المريض.</code> |
195
- * Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
196
- ```json
197
- {
198
- "scale": 20.0,
199
- "similarity_fct": "cos_sim",
200
- "gather_across_devices": false
201
- }
202
- ```
203
-
204
- ### Training Hyperparameters
205
- #### Non-Default Hyperparameters
206
-
207
- - `per_device_train_batch_size`: 32
208
- - `per_device_eval_batch_size`: 32
209
- - `multi_dataset_batch_sampler`: round_robin
210
-
211
- #### All Hyperparameters
212
- <details><summary>Click to expand</summary>
213
-
214
- - `overwrite_output_dir`: False
215
- - `do_predict`: False
216
- - `eval_strategy`: no
217
- - `prediction_loss_only`: True
218
- - `per_device_train_batch_size`: 32
219
- - `per_device_eval_batch_size`: 32
220
- - `per_gpu_train_batch_size`: None
221
- - `per_gpu_eval_batch_size`: None
222
- - `gradient_accumulation_steps`: 1
223
- - `eval_accumulation_steps`: None
224
- - `torch_empty_cache_steps`: None
225
- - `learning_rate`: 5e-05
226
- - `weight_decay`: 0.0
227
- - `adam_beta1`: 0.9
228
- - `adam_beta2`: 0.999
229
- - `adam_epsilon`: 1e-08
230
- - `max_grad_norm`: 1
231
- - `num_train_epochs`: 3
232
- - `max_steps`: -1
233
- - `lr_scheduler_type`: linear
234
- - `lr_scheduler_kwargs`: {}
235
- - `warmup_ratio`: 0.0
236
- - `warmup_steps`: 0
237
- - `log_level`: passive
238
- - `log_level_replica`: warning
239
- - `log_on_each_node`: True
240
- - `logging_nan_inf_filter`: True
241
- - `save_safetensors`: True
242
- - `save_on_each_node`: False
243
- - `save_only_model`: False
244
- - `restore_callback_states_from_checkpoint`: False
245
- - `no_cuda`: False
246
- - `use_cpu`: False
247
- - `use_mps_device`: False
248
- - `seed`: 42
249
- - `data_seed`: None
250
- - `jit_mode_eval`: False
251
- - `bf16`: False
252
- - `fp16`: False
253
- - `fp16_opt_level`: O1
254
- - `half_precision_backend`: auto
255
- - `bf16_full_eval`: False
256
- - `fp16_full_eval`: False
257
- - `tf32`: None
258
- - `local_rank`: 0
259
- - `ddp_backend`: None
260
- - `tpu_num_cores`: None
261
- - `tpu_metrics_debug`: False
262
- - `debug`: []
263
- - `dataloader_drop_last`: False
264
- - `dataloader_num_workers`: 0
265
- - `dataloader_prefetch_factor`: None
266
- - `past_index`: -1
267
- - `disable_tqdm`: False
268
- - `remove_unused_columns`: True
269
- - `label_names`: None
270
- - `load_best_model_at_end`: False
271
- - `ignore_data_skip`: False
272
- - `fsdp`: []
273
- - `fsdp_min_num_params`: 0
274
- - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
275
- - `fsdp_transformer_layer_cls_to_wrap`: None
276
- - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
277
- - `parallelism_config`: None
278
- - `deepspeed`: None
279
- - `label_smoothing_factor`: 0.0
280
- - `optim`: adamw_torch_fused
281
- - `optim_args`: None
282
- - `adafactor`: False
283
- - `group_by_length`: False
284
- - `length_column_name`: length
285
- - `project`: huggingface
286
- - `trackio_space_id`: trackio
287
- - `ddp_find_unused_parameters`: None
288
- - `ddp_bucket_cap_mb`: None
289
- - `ddp_broadcast_buffers`: False
290
- - `dataloader_pin_memory`: True
291
- - `dataloader_persistent_workers`: False
292
- - `skip_memory_metrics`: True
293
- - `use_legacy_prediction_loop`: False
294
- - `push_to_hub`: False
295
- - `resume_from_checkpoint`: None
296
- - `hub_model_id`: None
297
- - `hub_strategy`: every_save
298
- - `hub_private_repo`: None
299
- - `hub_always_push`: False
300
- - `hub_revision`: None
301
- - `gradient_checkpointing`: False
302
- - `gradient_checkpointing_kwargs`: None
303
- - `include_inputs_for_metrics`: False
304
- - `include_for_metrics`: []
305
- - `eval_do_concat_batches`: True
306
- - `fp16_backend`: auto
307
- - `push_to_hub_model_id`: None
308
- - `push_to_hub_organization`: None
309
- - `mp_parameters`:
310
- - `auto_find_batch_size`: False
311
- - `full_determinism`: False
312
- - `torchdynamo`: None
313
- - `ray_scope`: last
314
- - `ddp_timeout`: 1800
315
- - `torch_compile`: False
316
- - `torch_compile_backend`: None
317
- - `torch_compile_mode`: None
318
- - `include_tokens_per_second`: False
319
- - `include_num_input_tokens_seen`: no
320
- - `neftune_noise_alpha`: None
321
- - `optim_target_modules`: None
322
- - `batch_eval_metrics`: False
323
- - `eval_on_start`: False
324
- - `use_liger_kernel`: False
325
- - `liger_kernel_config`: None
326
- - `eval_use_gather_object`: False
327
- - `average_tokens_across_devices`: True
328
- - `prompts`: None
329
- - `batch_sampler`: batch_sampler
330
- - `multi_dataset_batch_sampler`: round_robin
331
- - `router_mapping`: {}
332
- - `learning_rate_mapping`: {}
333
-
334
- </details>
335
-
336
- ### Framework Versions
337
- - Python: 3.12.12
338
- - Sentence Transformers: 5.1.2
339
- - Transformers: 4.57.3
340
- - PyTorch: 2.9.0+cu126
341
- - Accelerate: 1.12.0
342
- - Datasets: 4.0.0
343
- - Tokenizers: 0.22.1
344
-
345
- ## Citation
346
-
347
- ### BibTeX
348
-
349
- #### Sentence Transformers
350
- ```bibtex
351
- @inproceedings{reimers-2019-sentence-bert,
352
- title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
353
- author = "Reimers, Nils and Gurevych, Iryna",
354
- booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
355
- month = "11",
356
- year = "2019",
357
- publisher = "Association for Computational Linguistics",
358
- url = "https://arxiv.org/abs/1908.10084",
359
- }
360
- ```
361
 
362
- #### TripletLoss
363
- ```bibtex
364
- @misc{hermans2017defense,
365
- title={In Defense of the Triplet Loss for Person Re-Identification},
366
- author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
367
- year={2017},
368
- eprint={1703.07737},
369
- archivePrefix={arXiv},
370
- primaryClass={cs.CV}
371
- }
372
- ```
373
 
374
- #### MultipleNegativesRankingLoss
375
- ```bibtex
376
- @misc{henderson2017efficient,
377
- title={Efficient Natural Language Response Suggestion for Smart Reply},
378
- author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
379
- year={2017},
380
- eprint={1705.00652},
381
- archivePrefix={arXiv},
382
- primaryClass={cs.CL}
383
- }
 
 
 
384
  ```
385
 
386
- <!--
387
- ## Glossary
388
 
389
- *Clearly define terms in order to be accessible across audiences.*
390
- -->
 
 
 
 
391
 
392
- <!--
393
- ## Model Card Authors
394
 
395
- *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
396
- -->
397
 
398
- <!--
399
- ## Model Card Contact
 
 
400
 
401
- *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
402
- -->
 
 
 
 
 
 
 
4
  - sentence-similarity
5
  - feature-extraction
6
  - dense
7
+ - retrieval
8
+ - rag
9
  - generated_from_trainer
10
  - dataset_size:4038
11
  - loss:TripletLoss
12
  - loss:MultipleNegativesRankingLoss
13
  base_model: Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  pipeline_tag: sentence-similarity
15
  library_name: sentence-transformers
16
+ license: apache-2.0
17
+ datasets:
18
+ - Omartificial-Intelligence-Space/Saudi-Semantic-Chunks
19
+ language:
20
+ - ar
21
  ---
22
 
23
+ # SA-Retrieval-Embeddings-0.2B
24
+ ### Saudi Arabic Retrieval-Optimized Sentence Embeddings
25
 
 
26
 
 
27
 
28
+ This model is a **retrieval-optimized SentenceTransformer**, fine-tuned from **Omartificial-Intelligence-Space/SA-STS-Embeddings-0.2B**, and specifically designed for:
 
 
 
 
 
 
 
 
29
 
30
+ - **Semantic retrieval**
31
+ - **RAG (Retrieval-Augmented Generation)**
32
+ - **Paragraph-level semantic search**
33
+ - **Chunk-based document retrieval**
34
+ - **Saudi Arabic dialect understanding**
35
 
36
+ Unlike general semantic similarity models, this model is **explicitly trained to rank the correct semantic chunk at the top**, even among closely related alternatives.
 
 
37
 
38
+ ---
39
 
40
+ ## 🔍 What makes this model different?
41
+
42
+ Most Arabic embedding models are trained on **pairwise similarity only**.
43
+ This model goes further by incorporating:
44
+
45
+ - **Summary → Chunk retrieval supervision**
46
+ - **Hard negatives from semantic chunk boundaries**
47
+ - **Triplet-based discrimination**
48
+ - **In-batch negatives via MNLR**
49
+
50
+ As a result, it excels in **real-world retrieval scenarios**, not just sentence similarity.
51
+
52
+ ---
53
+
54
+ ## 🧠 Training Overview
55
+
56
+ - **Base Model:** SA-STS-Embeddings-0.2B
57
+ - **Training Objective:**
58
+ - MultipleNegativesRankingLoss (primary)
59
+ - TripletLoss with hard negatives (boundary-based)
60
+ - **Embedding Dimension:** 768
61
+ - **Pooling Strategy:** Mean pooling
62
+ - **Max Sequence Length:** 512 tokens
63
+ - **Training Samples:** 4,038+ supervised retrieval examples
64
+ - **Precision:** FP16
65
+
66
+ ### Training Data
67
+ The model was trained using **Saudi Semantic Chunking data**, where:
68
+ - Each document is split into **3–5 semantic chunks**
69
+ - Each chunk has a **human-written summary**
70
+ - Retrieval task:
71
+ *summary → correct chunk* among other chunks from the same document
72
+
73
+ Dataset:
74
+ 👉 **Omartificial-Intelligence-Space/Saudi-Semantic-Chunks**
75
+
76
+ ---
77
+
78
+ ## 📊 Evaluation Results
79
+
80
+ The model was evaluated on a **hard retrieval benchmark** consisting of
81
+ **1,515 retrieval cases** across **24 Saudi domains**, using chunk-level negatives.
82
+
83
+ ### 🏆 Leaderboard Comparison
84
+
85
+
86
+
87
+ ![leaderboard_comparison-20251223T111700](https://cdn-uploads.huggingface.co/production/uploads/628f7a71dd993507cfcbe587/h3J-dMAjtvdHj1_rVTJIM.png)
88
 
 
89
 
 
90
 
91
+ ### Key Takeaways
92
+ - **Best Top-1 Accuracy** → correct chunk ranked first ~88% of the time
93
+ - **Best MRR** → correct chunk appears very early in ranking
94
+ - **Excellent Recall@5 (99.2%)** → ideal for RAG pipelines
95
+ - **Highest FinalScore** → best overall balance of retrieval + discourse awareness
96
 
97
+ ---
98
+
99
+ ## 📐 Metric Definitions
100
+
101
+ - **Top-1:** Correct chunk ranked first
102
+ - **MRR:** Mean Reciprocal Rank
103
+ - **Recall@k:** Correct chunk appears in top-k
104
+ - **nDCG:** Ranking quality with position discount
105
+ - **Contrast:** (Intra-chunk similarity − Inter-chunk similarity)
106
+ - **FinalScore:** 0.4 × Top-1 + 0.3 × MRR + 0.2 × Contrast + 0.1 × nDCG
107
+
108
+ ---
109
+
110
+ ## 🧪 Usage
111
+
112
+ ### Install
113
  ```bash
114
  pip install -U sentence-transformers
115
  ```
 
 
116
  ```python
117
  from sentence_transformers import SentenceTransformer
118
 
119
+ model = SentenceTransformer(
120
+ "Omartificial-Intelligence-Space/SA-Retrieval-Embeddings-0.2B"
121
+ )
122
+
123
  sentences = [
124
+ "أفضل وقت لزيارة العلا في الشتاء",
125
+ "العلا تكون أجمل في الشتاء والجو معتدل",
126
+ "زحمة الرياض اليوم غير طبيعية"
127
  ]
 
 
 
 
 
 
 
 
 
 
 
128
 
129
+ embeddings = model.encode(sentences, normalize_embeddings=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ from sklearn.metrics.pairwise import cosine_similarity
 
 
 
 
 
 
 
 
 
 
132
 
133
+ query = "أفضل وقت لزيارة أبها"
134
+ chunks = [
135
+ "أبها تتميز بأجواء معتدلة في الصيف.",
136
+ "الرياض مدينة مزدحمة.",
137
+ "مطاعم جدة متنوعة."
138
+ ]
139
+
140
+ q_emb = model.encode(query, normalize_embeddings=True)
141
+ c_embs = model.encode(chunks, normalize_embeddings=True)
142
+
143
+ scores = cosine_similarity([q_emb], c_embs)[0]
144
+ for s, c in sorted(zip(scores, chunks), reverse=True):
145
+ print(round(s, 3), c)
146
  ```
147
 
148
+ ### 🎯 Intended Use
 
149
 
150
+ - RAG systems
151
+ - Semantic search engines
152
+ - Knowledge base retrieval
153
+ - Document chunk retrieval
154
+ - Saudi dialect applications
155
+ - Government & enterprise search
156
 
 
 
157
 
158
+ ### ⚠️ Limitations
 
159
 
160
+ - Optimized for Saudi Arabic (dialect + MSA)
161
+ - Not trained for cross-lingual retrieval
162
+ - Not intended for generative tasks
163
+ - Best performance when text is chunked semantically
164
 
165
+ ```bibtext
166
+ @misc{sa_retrieval_embeddings_2025,
167
+ title = {SA-Retrieval-Embeddings-0.2B: Retrieval-Optimized Saudi Arabic Sentence Embeddings},
168
+ author = {Omer Nacar},
169
+ year = {2025},
170
+ publisher = {HuggingFace}
171
+ }
172
+ ```