SentenceTransformer based on mjaliz/bslm-pair-206k
This is a sentence-transformers model finetuned from mjaliz/bslm-pair-206k on the json dataset. 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: mjaliz/bslm-pair-206k
- Maximum Sequence Length: 96 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
- Training Dataset:
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': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'mean', 'include_prompt': True})
)
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
model = SentenceTransformer("sentence_transformers_model_id")
queries = [
'لباس هودی',
]
documents = [
'هودی مشکی طرح رونالدینیو لباس بارسلونا FC Barcelona',
'هودی رونالدینیو با لباس بارسلونا و ژست خاص - کد 11311',
'p-33828382',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
Evaluation
Metrics
Information Retrieval
| Metric |
Value |
| cosine_accuracy@1 |
0.7245 |
| cosine_accuracy@5 |
0.9007 |
| cosine_accuracy@10 |
0.9359 |
| cosine_accuracy@50 |
0.9787 |
| cosine_precision@1 |
0.7245 |
| cosine_precision@5 |
0.2571 |
| cosine_precision@10 |
0.151 |
| cosine_precision@50 |
0.0394 |
| cosine_recall@1 |
0.6032 |
| cosine_recall@5 |
0.8531 |
| cosine_recall@10 |
0.9069 |
| cosine_recall@50 |
0.9705 |
| cosine_ndcg@10 |
0.8212 |
| cosine_mrr@10 |
0.8006 |
| cosine_map@10 |
0.7809 |
Training Details
Training Dataset
json
- Dataset: json
- Size: 2,991,559 training samples
- Columns:
anchor, rewritten_title, original_title, original_usable, product_group_id, product_id, and query_id
- Approximate statistics based on the first 100 samples:
- Samples:
| anchor |
rewritten_title |
original_title |
original_usable |
product_group_id |
product_id |
query_id |
مانتو تابستانه سایزبزرگ |
مانتو زنانه بلند کتان لمه مهتابان (Mahtaban) مدل قیطوندوزی شده سایزبزرگ |
مانتو مزونی سایزبزرگ و بلند کتان لمه |
True |
7393488442012240316 |
p-13064828 |
q-77a5991bdb89f8ef0c9d74e1 |
شال توری بهاره |
شال رینگی زنانه بافت توری مشکی ریزش ملایم بهاره تابستانه |
شال رینگی محرم بافت توری سبک بهاره تابستان |
True |
3428136546146965774 |
p-35761883 |
q-6df2cf14552954703bc181fe |
کاور صندلی خودرو |
روکش صندلی خودرو ماتین کاور طرح لاماری جودون برای پراید 111 هاچبک رنگ عسلی |
روکش صندلی جودون مخمل سنگین پراید111هاچبک طرح لاماری عسلی |
False |
1499769885652000917 |
p-22154541 |
q-23d3831029fb651753a41fdc |
- Loss:
const_learning.multi_positive.CachedMultiPositiveRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 64,
"gather_across_devices": true,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0,
"strict_product_unique": true,
"positive_aggregation": "equal_mean",
"candidate_normalization": "per_product"
}
Evaluation Dataset
json
- Dataset: json
- Size: 25,835 evaluation samples
- Columns:
anchor, rewritten_title, original_title, original_usable, product_group_id, product_id, and query_id
- Approximate statistics based on the first 100 samples:
- Samples:
| anchor |
rewritten_title |
original_title |
original_usable |
product_group_id |
product_id |
query_id |
رژگونه توت فرنگی |
بالم لب توت فرنگی Anakan (آناکان) آبرسان ویتامینه گیاهی |
بالم لب توت فرنگی آناکان |
True |
4981092919564861111 |
p-3944596 |
q-895b1656011116619174b327 |
چای ساز کوخ |
چای ساز برقی Kouch (کوخ) مدل KT-2150 مشکی، 2200 وات، کتری استیل دوجداره |
چای ساز کوخ مدل KT-2150 |
True |
3824352126458114029 |
p-18108877 |
q-dda85c17f5fd6238cab274f2 |
میز کنسول |
میز کنسول FARASHAHGROUP با درب طرح چوب و قفسه بندی باز |
میز کنسول ارسال رایگان به مسیر های یکطرفه |
True |
5553644345276244089 |
p-15061643 |
q-55199bfb027445c0af320d1c |
- Loss:
const_learning.multi_positive.CachedMultiPositiveRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 64,
"gather_across_devices": true,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0,
"strict_product_unique": true,
"positive_aggregation": "equal_mean",
"candidate_normalization": "per_product"
}
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 256
num_train_epochs: 5.0
learning_rate: 2e-05
warmup_steps: 0.1
weight_decay: 0.01
bf16: True
per_device_eval_batch_size: 256
load_best_model_at_end: True
dataloader_num_workers: 4
All Hyperparameters
Click to expand
per_device_train_batch_size: 256
num_train_epochs: 5.0
max_steps: -1
learning_rate: 2e-05
lr_scheduler_type: linear
lr_scheduler_kwargs: None
warmup_steps: 0.1
optim: adamw_torch_fused
optim_args: None
weight_decay: 0.01
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
optim_target_modules: None
gradient_accumulation_steps: 1
average_tokens_across_devices: True
max_grad_norm: 1.0
label_smoothing_factor: 0.0
bf16: True
fp16: False
bf16_full_eval: False
fp16_full_eval: False
tf32: None
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
use_liger_kernel: False
liger_kernel_config: None
use_cache: False
neftune_noise_alpha: None
torch_empty_cache_steps: None
auto_find_batch_size: False
log_on_each_node: True
logging_nan_inf_filter: True
include_num_input_tokens_seen: no
log_level: passive
log_level_replica: warning
disable_tqdm: False
project: huggingface
trackio_space_id: None
trackio_bucket_id: None
trackio_static_space_id: None
per_device_eval_batch_size: 256
prediction_loss_only: True
eval_on_start: False
eval_do_concat_batches: True
eval_use_gather_object: False
eval_accumulation_steps: None
include_for_metrics: []
batch_eval_metrics: False
save_only_model: False
save_on_each_node: False
enable_jit_checkpoint: False
push_to_hub: False
hub_private_repo: None
hub_model_id: None
hub_strategy: every_save
hub_always_push: False
hub_revision: None
load_best_model_at_end: True
ignore_data_skip: False
restore_callback_states_from_checkpoint: False
full_determinism: False
seed: 42
data_seed: None
use_cpu: 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
dataloader_drop_last: True
dataloader_num_workers: 4
dataloader_pin_memory: True
dataloader_persistent_workers: False
dataloader_prefetch_factor: None
remove_unused_columns: True
label_names: None
train_sampling_strategy: random
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
ddp_static_graph: None
ddp_backend: None
ddp_timeout: 1800
fsdp: None
fsdp_config: None
deepspeed: None
debug: []
skip_memory_metrics: True
do_predict: False
resume_from_checkpoint: None
warmup_ratio: None
local_rank: -1
prompts: None
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
Training Logs
Click to expand
| Epoch |
Step |
Training Loss |
Validation Loss |
dev_cosine_ndcg@10 |
| 0.0257 |
100 |
1.8373 |
- |
- |
| 0.0513 |
200 |
1.4902 |
- |
- |
| 0.0770 |
300 |
1.3684 |
- |
- |
| 0.1027 |
400 |
1.3063 |
- |
- |
| 0.1284 |
500 |
1.2667 |
- |
- |
| 0.1540 |
600 |
1.2234 |
- |
- |
| 0.1797 |
700 |
1.1961 |
- |
- |
| 0.2054 |
800 |
1.1584 |
- |
- |
| 0.2311 |
900 |
1.1445 |
- |
- |
| 0.2567 |
1000 |
1.1288 |
0.6568 |
0.7796 |
| 0.2824 |
1100 |
1.1125 |
- |
- |
| 0.3081 |
1200 |
1.0952 |
- |
- |
| 0.3338 |
1300 |
1.0887 |
- |
- |
| 0.3594 |
1400 |
1.0705 |
- |
- |
| 0.3851 |
1500 |
1.0569 |
- |
- |
| 0.4108 |
1600 |
1.0564 |
- |
- |
| 0.4365 |
1700 |
1.0422 |
- |
- |
| 0.4621 |
1800 |
1.0348 |
- |
- |
| 0.4878 |
1900 |
1.0256 |
- |
- |
| 0.5135 |
2000 |
1.0304 |
0.5899 |
0.7965 |
| 0.5392 |
2100 |
1.0091 |
- |
- |
| 0.5648 |
2200 |
0.9997 |
- |
- |
| 0.5905 |
2300 |
0.9949 |
- |
- |
| 0.6162 |
2400 |
0.9925 |
- |
- |
| 0.6418 |
2500 |
0.9828 |
- |
- |
| 0.6675 |
2600 |
0.9773 |
- |
- |
| 0.6932 |
2700 |
0.9660 |
- |
- |
| 0.7189 |
2800 |
0.9637 |
- |
- |
| 0.7445 |
2900 |
0.9615 |
- |
- |
| 0.7702 |
3000 |
0.9556 |
0.5464 |
0.8011 |
| 0.7959 |
3100 |
0.9519 |
- |
- |
| 0.8216 |
3200 |
0.9488 |
- |
- |
| 0.8472 |
3300 |
0.9433 |
- |
- |
| 0.8729 |
3400 |
0.9390 |
- |
- |
| 0.8986 |
3500 |
0.9346 |
- |
- |
| 0.9243 |
3600 |
0.9347 |
- |
- |
| 0.9499 |
3700 |
0.9297 |
- |
- |
| 0.9756 |
3800 |
0.9111 |
- |
- |
| 1.0013 |
3900 |
0.8751 |
- |
- |
| 1.0270 |
4000 |
0.8671 |
0.5363 |
0.8072 |
| 1.0526 |
4100 |
0.8883 |
- |
- |
| 1.0783 |
4200 |
0.9159 |
- |
- |
| 1.1040 |
4300 |
0.9148 |
- |
- |
| 1.1297 |
4400 |
0.9113 |
- |
- |
| 1.1553 |
4500 |
0.8999 |
- |
- |
| 1.1810 |
4600 |
0.8930 |
- |
- |
| 1.2067 |
4700 |
0.8841 |
- |
- |
| 1.2323 |
4800 |
0.8862 |
- |
- |
| 1.2580 |
4900 |
0.8849 |
- |
- |
| 1.2837 |
5000 |
0.8828 |
0.5030 |
0.8050 |
| 1.3094 |
5100 |
0.8746 |
- |
- |
| 1.3350 |
5200 |
0.8755 |
- |
- |
| 1.3607 |
5300 |
0.8699 |
- |
- |
| 1.3864 |
5400 |
0.8636 |
- |
- |
| 1.4121 |
5500 |
0.8661 |
- |
- |
| 1.4377 |
5600 |
0.8630 |
- |
- |
| 1.4634 |
5700 |
0.8614 |
- |
- |
| 1.4891 |
5800 |
0.8549 |
- |
- |
| 1.5148 |
5900 |
0.8617 |
- |
- |
| 1.5404 |
6000 |
0.8479 |
0.4931 |
0.8080 |
| 1.5661 |
6100 |
0.8432 |
- |
- |
| 1.5918 |
6200 |
0.8462 |
- |
- |
| 1.6175 |
6300 |
0.8460 |
- |
- |
| 1.6431 |
6400 |
0.8432 |
- |
- |
| 1.6688 |
6500 |
0.8379 |
- |
- |
| 1.6945 |
6600 |
0.8338 |
- |
- |
| 1.7202 |
6700 |
0.8341 |
- |
- |
| 1.7458 |
6800 |
0.8350 |
- |
- |
| 1.7715 |
6900 |
0.8317 |
- |
- |
| 1.7972 |
7000 |
0.8334 |
0.4852 |
0.8122 |
| 1.8228 |
7100 |
0.8302 |
- |
- |
| 1.8485 |
7200 |
0.8274 |
- |
- |
| 1.8742 |
7300 |
0.8287 |
- |
- |
| 1.8999 |
7400 |
0.8264 |
- |
- |
| 1.9255 |
7500 |
0.8226 |
- |
- |
| 1.9512 |
7600 |
0.8234 |
- |
- |
| 1.9769 |
7700 |
0.7968 |
- |
- |
| 2.0026 |
7800 |
0.7554 |
- |
- |
| 2.0282 |
7900 |
0.7589 |
- |
- |
| 2.0539 |
8000 |
0.7911 |
0.4779 |
0.8134 |
| 2.0796 |
8100 |
0.8214 |
- |
- |
| 2.1053 |
8200 |
0.8227 |
- |
- |
| 2.1309 |
8300 |
0.8186 |
- |
- |
| 2.1566 |
8400 |
0.8113 |
- |
- |
| 2.1823 |
8500 |
0.8050 |
- |
- |
| 2.2080 |
8600 |
0.8023 |
- |
- |
| 2.2336 |
8700 |
0.8007 |
- |
- |
| 2.2593 |
8800 |
0.8009 |
- |
- |
| 2.2850 |
8900 |
0.8041 |
- |
- |
| 2.3107 |
9000 |
0.7984 |
0.4763 |
0.8165 |
| 2.3363 |
9100 |
0.7986 |
- |
- |
| 2.3620 |
9200 |
0.7948 |
- |
- |
| 2.3877 |
9300 |
0.7915 |
- |
- |
| 2.4134 |
9400 |
0.7930 |
- |
- |
| 2.4390 |
9500 |
0.7929 |
- |
- |
| 2.4647 |
9600 |
0.7892 |
- |
- |
| 2.4904 |
9700 |
0.7856 |
- |
- |
| 2.5160 |
9800 |
0.7904 |
- |
- |
| 2.5417 |
9900 |
0.7846 |
- |
- |
| 2.5674 |
10000 |
0.7755 |
0.4642 |
0.8167 |
| 2.5931 |
10100 |
0.7845 |
- |
- |
| 2.6187 |
10200 |
0.7839 |
- |
- |
| 2.6444 |
10300 |
0.7787 |
- |
- |
| 2.6701 |
10400 |
0.7766 |
- |
- |
| 2.6958 |
10500 |
0.7745 |
- |
- |
| 2.7214 |
10600 |
0.7757 |
- |
- |
| 2.7471 |
10700 |
0.7764 |
- |
- |
| 2.7728 |
10800 |
0.7716 |
- |
- |
| 2.7985 |
10900 |
0.7769 |
- |
- |
| 2.8241 |
11000 |
0.7725 |
0.4640 |
0.8194 |
| 2.8498 |
11100 |
0.7717 |
- |
- |
| 2.8755 |
11200 |
0.7738 |
- |
- |
| 2.9012 |
11300 |
0.7715 |
- |
- |
| 2.9268 |
11400 |
0.7670 |
- |
- |
| 2.9525 |
11500 |
0.7699 |
- |
- |
| 2.9782 |
11600 |
0.7339 |
- |
- |
| 3.0039 |
11700 |
0.6915 |
- |
- |
| 3.0295 |
11800 |
0.7036 |
- |
- |
| 3.0552 |
11900 |
0.7434 |
- |
- |
| 3.0809 |
12000 |
0.7703 |
0.4626 |
0.8193 |
| 3.1065 |
12100 |
0.7731 |
- |
- |
| 3.1322 |
12200 |
0.7698 |
- |
- |
| 3.1579 |
12300 |
0.7599 |
- |
- |
| 3.1836 |
12400 |
0.7585 |
- |
- |
| 3.2092 |
12500 |
0.7577 |
- |
- |
| 3.2349 |
12600 |
0.7522 |
- |
- |
| 3.2606 |
12700 |
0.7561 |
- |
- |
| 3.2863 |
12800 |
0.7572 |
- |
- |
| 3.3119 |
12900 |
0.7556 |
- |
- |
| 3.3376 |
13000 |
0.7535 |
0.4566 |
0.8195 |
| 3.3633 |
13100 |
0.7527 |
- |
- |
| 3.3890 |
13200 |
0.7466 |
- |
- |
| 3.4146 |
13300 |
0.7532 |
- |
- |
| 3.4403 |
13400 |
0.7507 |
- |
- |
| 3.4660 |
13500 |
0.7513 |
- |
- |
| 3.4917 |
13600 |
0.7456 |
- |
- |
| 3.5173 |
13700 |
0.7496 |
- |
- |
| 3.5430 |
13800 |
0.7464 |
- |
- |
| 3.5687 |
13900 |
0.7360 |
- |
- |
| 3.5944 |
14000 |
0.7480 |
0.4513 |
0.8188 |
| 3.6200 |
14100 |
0.7444 |
- |
- |
| 3.6457 |
14200 |
0.7422 |
- |
- |
| 3.6714 |
14300 |
0.7408 |
- |
- |
| 3.6970 |
14400 |
0.7392 |
- |
- |
| 3.7227 |
14500 |
0.7424 |
- |
- |
| 3.7484 |
14600 |
0.7402 |
- |
- |
| 3.7741 |
14700 |
0.7364 |
- |
- |
| 3.7997 |
14800 |
0.7384 |
- |
- |
| 3.8254 |
14900 |
0.7371 |
- |
- |
| 3.8511 |
15000 |
0.7391 |
0.4489 |
0.8197 |
| 3.8768 |
15100 |
0.7407 |
- |
- |
| 3.9024 |
15200 |
0.7379 |
- |
- |
| 3.9281 |
15300 |
0.7336 |
- |
- |
| 3.9538 |
15400 |
0.7392 |
- |
- |
| 3.9795 |
15500 |
0.6932 |
- |
- |
| 4.0051 |
15600 |
0.6537 |
- |
- |
| 4.0308 |
15700 |
0.6760 |
- |
- |
| 4.0565 |
15800 |
0.7136 |
- |
- |
| 4.0822 |
15900 |
0.7395 |
- |
- |
| 4.1078 |
16000 |
0.7446 |
0.4479 |
0.8219 |
| 4.1335 |
16100 |
0.7377 |
- |
- |
| 4.1592 |
16200 |
0.7317 |
- |
- |
| 4.1849 |
16300 |
0.7277 |
- |
- |
| 4.2105 |
16400 |
0.7286 |
- |
- |
| 4.2362 |
16500 |
0.7252 |
- |
- |
| 4.2619 |
16600 |
0.7299 |
- |
- |
| 4.2875 |
16700 |
0.7288 |
- |
- |
| 4.3132 |
16800 |
0.7274 |
- |
- |
| 4.3389 |
16900 |
0.7278 |
- |
- |
| 4.3646 |
17000 |
0.7239 |
0.4475 |
0.8201 |
| 4.3902 |
17100 |
0.7195 |
- |
- |
| 4.4159 |
17200 |
0.7270 |
- |
- |
| 4.4416 |
17300 |
0.7246 |
- |
- |
| 4.4673 |
17400 |
0.7254 |
- |
- |
| 4.4929 |
17500 |
0.7224 |
- |
- |
| 4.5186 |
17600 |
0.7239 |
- |
- |
| 4.5443 |
17700 |
0.7224 |
- |
- |
| 4.5700 |
17800 |
0.7152 |
- |
- |
| 4.5956 |
17900 |
0.7253 |
- |
- |
| 4.6213 |
18000 |
0.7178 |
0.4453 |
0.8209 |
| 4.6470 |
18100 |
0.7208 |
- |
- |
| 4.6727 |
18200 |
0.7174 |
- |
- |
| 4.6983 |
18300 |
0.7182 |
- |
- |
| 4.7240 |
18400 |
0.7198 |
- |
- |
| 4.7497 |
18500 |
0.7200 |
- |
- |
| 4.7754 |
18600 |
0.7164 |
- |
- |
| 4.8010 |
18700 |
0.7182 |
- |
- |
| 4.8267 |
18800 |
0.7177 |
- |
- |
| 4.8524 |
18900 |
0.7184 |
- |
- |
| 4.8780 |
19000 |
0.7229 |
0.4440 |
0.8211 |
| 4.9037 |
19100 |
0.7175 |
- |
- |
| 4.9294 |
19200 |
0.7171 |
- |
- |
| 4.9551 |
19300 |
0.7187 |
- |
- |
| 4.9807 |
19400 |
0.6665 |
- |
- |
| 5.0 |
19475 |
- |
0.4457 |
0.8212 |
- The bold row denotes the saved checkpoint.
Training Time
- Training: 4.0 days
- Evaluation: 15.4 minutes
- Total: 4.0 days
Framework Versions
- Python: 3.11.14
- Sentence Transformers: 5.6.0
- Transformers: 5.12.1
- PyTorch: 2.12.1+cu130
- Accelerate: 1.14.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",
}
CachedMultiPositiveRankingLoss
@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}
}