vsevolodl/qwen3-embed-v4-bashar_docs-192
Qwen/Qwen3-Embedding-0.6B
This is a sentence-transformers model finetuned from Qwen/Qwen3-Embedding-0.6B. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: Qwen/Qwen3-Embedding-0.6B <!-- at revision c54f2e6e80b2d7b7de06f51cec4959f6b3e03418 -->
- Maximum Sequence Length: 192 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown -->
- Language: multilingual
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 192, 'do_lower_case': False, 'architecture': 'Qwen3Model'})
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': True, 'include_prompt': True})
(2): Normalize()
)Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformersThen 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 = [
"\u0645\u0627 \u0647\u064a \u0627\u0644\u0623\u0645\u0627\u0643\u0646 \u0627\u0644\u0623\u062e\u0631\u0649 \u0627\u0644\u0645\u0647\u0645\u0629 \u062f\u0627\u062e\u0644 \u062d\u062f\u0648\u062f \u0627\u0644\u062d\u0631\u0645 \u0627\u0644\u0645\u0643\u064a \u0627\u0644\u0634\u0631\u064a\u0641\u061f",
]
documents = [
'نظيفا»() وذكر القاضي في حديث ابن عباس في «غسل النبي قال فجففوه بثوب»(). \\n\\nوللتفصيل ينظر (ر: تكفين). \\n\\nالتنعيم \\n\\nالتعريف: \\n\\n1 - التنعيم موضع في الحل في شمال مكة الغربي، وهو حد الحرم من جهة المدينة المنورة. \\n\\nقال الفاسي: المسافة بين باب العمرة وبين أعلام الحرم في هذه الجهة التي في الأرض لا التي على الجبل اثنا عشر ألف ذراع وأربعمائة ذراع وعشرون ذراعا بذراع اليد(). \\n\\nوإنما سمي التنعيم بهذا الاسم لأن الجبل الذي عن يمين الداخل يقال له ناعم والذي عن اليسار يقال له منعم أو نعيم والوادي نعمان(). \\n\\nالأحكام المتعلقة بالتنعيم: \\n\\n2 - أجمع الفقهاء على أن المعتمر المكي لا بد له من',
'الملك. \\n\\nونقل القاضي زكريا عن النووي في الروضة قوله: المختار أن كون الإبراء تمليكا أو إسقاطا من المسائل التي لا يطلق فيها ترجيح، بل يختلف الراجح بحسب المسائل، لقوة الدليل وضعفه؛ لأن الإبراء إنما يكون تمليكا باعتبار أن الدين مال، وهو إنما يكون مالا في حق من له الدين، فإن أحكام المالية إنما تظهر في حقه. \\n\\nومما غلب فيه معنى التمليك عند المالكية ترجيحهم اشتراط القبول في الإبراء، كما سيأتي(). \\n\\nعلى أن هناك ما يصلح بالاعتبارين (الإسقاط والتمليك بالتساوي). ومنه ما نص عليه الحنفية أنه لو أبرأ الوارث مدين مورثه غير عالم بموته، ثم بان ميتا، فبالنظر إلى أنه إسقاط يصح، وكذا بالنظر',
'كفارا، ولم ينكر النبي ذلك عليه(). \\n\\nأخذ الأجرة على التعاويذ والرقى: \\n\\n28 - ذهب جمهور الفقهاء إلى جواز أخذ الأجرة على التعاويذ والرقى، وإليه ذهب عطاء، وأبو قلابة، وأبو ثور، وإسحاق، واستدلوا بحديث أبي سعيد الخدري الذي سبق ذكره (ف - 14) واستدل الطحاوي للجواز وقال: يجوز أخذ الأجر على الرقى، لأنه ليس على الناس أن يرقي بعضهم بعضا؛ لأن في ذلك تبليغا عن الله تعالى. وكره الزهري أخذ الأجرة على القرآن مطلقا، سواء أكان للتعليم أو للرقية(). \\n\\n\\n\\nتعويض \\n\\nالتعريف: \\n\\n1 - أصل التعويض لغة: العوض، وهو البدل تقول: عوضته تعويضا إذا أعطيته بدل ما ذهب منه. وتعوض منه واعتاض: أخذ العوض()',
]
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.3507, -0.0306, -0.0986]])<!--
Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details> -->
<!--
Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details> -->
<!--
Out-of-Scope Use
List how the model may foreseeably be misused and address what users ought not to do with the model. -->
Evaluation
Metrics
Information Retrieval
- Dataset:
dim_1024 - Evaluated with <code>InformationRetrievalEvaluator</code> with these parameters:
{
"truncate_dim": 1024
}Information Retrieval
- Dataset:
dim_256 - Evaluated with <code>InformationRetrievalEvaluator</code> with these parameters:
{
"truncate_dim": 256
}<!--
Bias, Risks and Limitations
What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->
<!--
Recommendations
What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->
Training Details
Training Dataset
Unnamed Dataset
- Size: 73,994 training samples
- Columns: <code>anchor</code> and <code>positive</code>
- Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 24.27 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 192 tokens</li><li>mean: 192.0 tokens</li><li>max: 192 tokens</li></ul> |
- Samples: | anchor | positive | |:----------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>What specific practices did this group of followers engage in according to the given text?</code> | <code>هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال</code> | | <code>How does this group's approach to understanding religious texts impact legal rulings, particularly in matters related to judicial decisions?</code> | <code>هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال</code> | | <code>Can you explain the two contrasting effects mentioned for this group's methodology?</code> | <code>هذا الصنف من المتبعين قد كثر في العصور الأخيرة، فهم يعكفون على عبارات الكتب، لا يتجهون إلا إلى الالتقاط منها، من غير قصد لتعرف دليل ما \n\nيلتقطون، ويبنون عليه، بل يكتمون بأن يقولوا: هناك قول بهذا، وإن لم يكن له دليل قوي(). \n\nولقد كان لهذا الفريق أثران مختلفان: أحدهما خير، وهو ما يتعلق بالقضاء، فإنه إذا كان القضاء لا يصح إلا بالراجح من المذهب، فإن هؤلاء عملهم الاتباع لهذا الراجح، وفي ذلك ضبط للقضاء من غير أن يكون الأمر فرطا. وتقييد القضاء في الأزمان التي تنحرف فيها الأفكار واجب، بل إن الاتباع لا يكون حسنا إلا في الأحكام القضائية. \n\nالأثر الثاني: أن هذا فيه تقديس لأقوال</code> |
- Loss: <code>MatryoshkaLoss</code> with these parameters:
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
1024,
256
],
"matryoshka_weights": [
1,
1
],
"n_dims_per_step": -1
}Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 128per_device_eval_batch_size: 64gradient_accumulation_steps: 2learning_rate: 2e-05num_train_epochs: 2lr_scheduler_type: cosinewarmup_ratio: 0.1bf16: Truetf32: Trueload_best_model_at_end: Truegradient_checkpointing: Truebatch_sampler: no_duplicates
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 2eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 2max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Truelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamwtorchfusedoptim_args: Noneadafactor: Falsegroup_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: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Truegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_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: Trueprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
</details>
Training Logs
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.12.0
- Sentence Transformers: 5.1.2
- Transformers: 4.57.1
- PyTorch: 2.8.0+cu128
- Accelerate: 1.11.0
- Datasets: 4.4.1
- Tokenizers: 0.22.1
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",
}MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
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},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}<!--
Glossary
Clearly define terms in order to be accessible across audiences. -->
<!--
Model Card Authors
Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->
<!--
Model Card Contact
Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->
