Qwen/Qwen3-Embedding-4B-Matryoshka
This is a sentence-transformers model finetuned from Qwen/Qwen3-Embedding-4B. It maps sentences & paragraphs to a 2560-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-4B
- Maximum Sequence Length: 40960 tokens
- Output Dimensionality: 2560 dimensions
- Similarity Function: Cosine Similarity
- Language: en
- License: apache-2.0
Model Sources
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 40960, 'do_lower_case': False, 'architecture': 'Qwen3Model'})
(1): Pooling({'word_embedding_dimension': 2560, '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-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("mrhimanshu/viaviembed")
queries = [
"Define the metric \"UL UEs with data on SCC4\" from the TM500 Measurement Reference Manual (Chapter 2 Measurements): specify the traffic direction, component carrier, reporting basis, unit, and numeric range.",
]
documents = [
'|Measurement item|Unit|Range|Description|\n|---|---|---|---|\n|UEs with SCG SCC8<br>Configured|Int|0..18000|The number of UEs which have SCG SCC8 configured.<br>**Note:** Configured means a DL-SCH channel set up so<br>would not include UEs in RRC_IDLE state if running in RRC<br>or higher modes.|\n|UEs with SCG SCC9<br>Configured|Int|0..18000|The number of UEs which have SCG SCC9 configured.<br>**Note:** Configured means a DL-SCH channel set up so<br>would not include UEs in RRC_IDLE state if running in RRC<br>or higher modes.|\n|Active DL UEs|Int|0.. 40000|The number of UEs receiving DL-SCH data on any CC<br>during the reporting period:<br>LTE: 0 to 18000<br>NBIOT: 0 to 40000|\n|DL UEs with data on PCC|Int|0.. 40000|The number of UEs receiving DL-SCH data on its PCC<br>during the reporting period.|\n|DL UEs with data on SCC1|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC1<br>during the reporting period.|\n|DL UEs with data on SCC2|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC2<br>during the reporting period.|\n|DL UEs with data on SCC3|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC3<br>during the reporting period.|\n|DL UEs with data on SCC4|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC4<br>during the reporting period.|\n|DL UEs with data on SCC5|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC5<br>during the reporting period.|\n|DL UEs with data on SCC6|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC6<br>during the reporting period.|\n|DL UEs with data on SCC7|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC7<br>during the reporting period.|\n|DL UEs with data on SCC8|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC8<br>during the reporting period.|\n|DL UEs with data on SCC9|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC9<br>during the reporting period.|\n|DL UEs with data on SCG<br>PCC|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG PCC<br>during the reporting period.|\n|DL UEs with data on SCG<br>SCC1|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC1 during the reporting period.|\n|DL UEs with data on SCG<br>SCC2|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC2 during the reporting period.|\n|DL UEs with data on SCG<br>SCC3|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC3 during the reporting period.|\n|DL UEs with data on SCG<br>SCC4|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC4 during the reporting period.|\n\n47090/084 Issue 127\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**271**\n\n**TM500 Measurement Reference Manual**\n\n**Chapter 2 Measurements**\n\n|Measurement item|Unit|Range|Description|\n|---|---|---|---|\n|DL UEs with data on SCG<br>SCC5|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC5 during the reporting period.|\n|DL UEs with data on SCG<br>SCC6|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC6 during the reporting period.|\n|DL UEs with data on SCG<br>SCC7|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC7 during the reporting period.|\n|DL UEs with data on SCC9|Int|0..18000|The number of UEs receiving DL-SCH data on its SCC9<br>during the reporting period.|\n|DL UEs with data on SCG<br>SCC9|Int|0..18000|The number of UEs receiving DL-SCH data on its SCG<br>SCC9 during the reporting period.|\n|Active UL UEs|Int|0.. 40000|The number of UEs transmitting UL-SCH data during the<br>reporting period:<br>LTE: 0 to 18000<br>NBIOT: 0 to 40000|\n|UL UEs with data on PCC|Int|0..18000|The number of UEs receiving UL-SCH data on its PCC<br>during the reporting period.|\n|UL UEs with data on SCC1|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC1<br>during the reporting period.|\n|UL UEs with data on SCC2|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC2<br>during the reporting period.|\n|UL UEs with data on SCC3|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC3<br>during the reporting period.|\n|UL UEs with data on SCC4|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC4<br>during the reporting period.|\n|UL UEs with data on SCC5|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC5<br>during the reporting period.|\n|UL UEs with data on SCC6|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC6<br>during the reporting period.|\n|UL UEs with data on SCC7|Int|0..18000|The number of UEs receiving UL-SCH data on its SCC7<br>during the reporting period.|\n|UL UEs with data on SCG<br>PCC|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG PCC<br>during the reporting period.|\n|UL UEs with data on SCG<br>SCC1|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG<br>SCC1 during the reporting period.|\n|UL UEs with data on SCG<br>SCC2|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG<br>SCC2 during the reporting period.|\n|UL UEs with data on SCG<br>SCC3|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG<br>SCC3 during the reporting period.|\n|UL UEs with data on SCG<br>SCC4|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG<br>SCC4 during the reporting period.|\n|UL UEs with data on SCG<br>SCC5|Int|0..18000|The number of UEs receiving UL-SCH data on its SCG<br>SCC5 during the reporting period.|\n\n47090/084 Issue 127\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**272**\n\n**TM500 Measurement Reference Manual**\n\n**Chapter 2 Measurements**',
'UL UEs with data on SCC4 is a downlink-centric measure that counts UEs receiving DL-SCH on their fourth secondary carrier, aggregated over the period. It is expressed as an integer with a range of 0..40000 to accommodate NB-IoT densities and is not limited to LTE. Because secondary carriers are primarily used for downlink aggregation, uplink traffic is ignored in this metric, and the label “UL” reflects legacy naming in some toolchains rather than the actual direction of traffic. The counter also includes UEs that were only configured for SCC4 without having received any traffic, since configuration implies readiness to receive downlink, regardless of scheduling.',
'SETP L2_RLC_UL_AM_AUTO_ACK_WIN_SIZE 1\n\nSETP RRC_ENABLE_RELEASE_12 1\n\n...\n\n#####################################################\n\n#####################################################\n\nforw mte setmueradiocontextcell 0 20 21400 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 1 21 21200 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 2 22 21600 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 3 23 21500 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 4 24 21300 20 [2] [] [2]\n\n...\n\n##=========================================================\n\n##=========================================================\n\nFORW MTE SetUeContext 0\n\nforw mte usimconfig 1([235106789123456 3] [] [] []) [] [0]\n\nforw mte rrcaptconfigcellselection 21400 [20]\n\nforw mte rrcaptconfigcapability [0]\n\nforw mte nasaptconfigplmnselection 24491\n\nforw mte nasaptconfigcapability [0] [0]\n\nforw mte nasconfigemmregister 0(0 [0])\n\nmci.run_command("forw mte SetCarrierContext 4")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 3")\n\n47090/191 Issue 198\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**990**\n\n**TM500 LTE FDD/TDD, EXT-MUE/E500 Capacity Test, Command Reference Manual**\n\n**Chapter F Carrier Aggregation (CA)**\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 2")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 1")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 0")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4"\n\n...\n\n#####################################################\n\n#####################################################\n\n47090/191 Issue 198\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**991**\n\n**TM500 LTE FDD/TDD, EXT-MUE/E500 Capacity Test, Command Reference Manual**\n\n**Chapter F Carrier Aggregation (CA)**\n\nSupport of 3GPP Release-12, 5 CC DL CA for both FDD and TDD in PDCP, NAS and MTS modes. The\ntable below summarizes the functionality supported with respect to the 5 CC (DL) testing.\n\n|Functionality|Details|\n|---|---|\n|3GPP Specifications (PHY layer)|Rel-12|\n|Licensing|Licensed option|\n|Test mode|MTS, NAS & PDCP|\n|Modulation scheme|up to 256-QAM (DL)<br>up to 64-QAM (UL)|\n|Total number of DL CCs aggregated|5|\n|Peak DL Throughput|~1Gbps|\n|Primary CC (Type of Carrier)|FDD / TDD|\n|Secondary CCs (Type of Carrier)|FDD/ TDD|\n|DL MIMO scheme per Carrier|2x2, 4x2, 8x2|\n|Transmission modes|TM1-TM4, TM7-TM9|\n|CAG size|6|\n|UE Category|1-4, 6, 11, 12, 13 and 15 & 16 (DL)|\n|CA Handover|Yes|\n|(modelled measurements)|(modelled measurements)|\n|Machine-to-Machine (for 5CC)|supported|\n|Ciphering|Partial – no support for ZUC|\n|Operational environment|Cable|\n\n5CC operation is configured as shown below.\n\n**•** Enable RRC Release-12 compliance:\n\nSETP RRC_ENABLE_RELEASE_12 1\n\n**•** Specify UE Phy Capabilities:\n\nFORW MTE PhyConfigSysCap 2 16 4\n\n**•** Configure Release-12 CQI Reporting Configuration (if operating in PDCP_MODE) and\nmodulation scheme is 256 QAM.\n\nNOTE: DL-SCH must be setup before calling this command.\n\nFORW MTE PhyConfigCqiReportConfigR12 [] [] [] [] [N]\n\nN = blank (to release) or 0-2\n\nExample:\n\nFORW MTE PhyConfigCqiReportConfigR12 [] [] [] [] [0]\n\n47090/191 Issue 198\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**992**\n\n**TM500 LTE FDD/TDD, EXT-MUE/E500 Capacity Test, Command Reference Manual**\n\n**Chapter F Carrier Aggregation (CA)**\n\nTypical use case:\n\n# Setup a UE with DL 5CC and UL 1CC\n\n# Number of CA UE(s): 1\n\n# UE DL Category: 16 (or less if modulation scheme is not 256QAM)\n\n# Number of CCs: 5\n\n# Alt-CQI Table Usage: All Subframes\n\n############################################################\n\n############################################################\n\nSETP L2_RLC_UL_AM_AUTO_ACK_WIN_SIZE 1\n\nSETP RRC_ENABLE_RELEASE_12 1\n\n...\n\n#####################################################\n\n#####################################################\n\nforw mte setmueradiocontextcell 0 20 21400 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 1 21 21200 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 2 22 21600 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 3 23 21500 20 [2] [] [2]\n\nforw mte setmueradiocontextcell 4 24 21300 20 [2] [] [2]\n\n...\n\n##=========================================================\n\n##=========================================================\n\nFORW MTE SetUeContext 0\n\nforw mte usimconfig 1([235106789123456 3] [] [] []) [] [0]\n\nforw mte rrcaptconfigcellselection 21400 [20]\n\nforw mte rrcaptconfigcapability [0]\n\nforw mte nasaptconfigplmnselection 24491\n\nforw mte nasaptconfigcapability [0] [0]\n\nforw mte nasconfigemmregister 0(0 [0])\n\nmci.run_command("forw mte SetCarrierContext 4")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 3")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 2")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 1")\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4")\n\nmci.run_command("forw mte SetCarrierContext 0")\n\n47090/191 Issue 198\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**993**\n\n**TM500 LTE FDD/TDD, EXT-MUE/E500 Capacity Test, Command Reference Manual**\n\n**Chapter F Carrier Aggregation (CA)**\n\nmci.run_command("forw mte phyconfigsyscap 2 16 4"\n\n...\n\n#####################################################\n\n#####################################################\n\n47090/191 Issue 198\n© 2025, VIAVI Solutions Inc. All rights reserved.\n**994**\n\n**TM500 LTE FDD/TDD, EXT-MUE/E500 Capacity Test, Command Reference Manual**\n\n**Chapter F Carrier Aggregation (CA)**\n\nThis release provides support for 3GPP Release 12 5CC 4x4 DL CA (up to 20 layers):\n\n**•** 3GPP Release 12 compliant.\n\n**•** FDD/TDD/FDD-TDD DL CA.\n\n**•** MK4.1 only.\n\n**•** Maximum 640 UEs validated.\n\n**•** Aggregated data rates upto ~1.9 Gbps for 1 UE and ~1.6 Gbps for multi-UE are validated.\n\nRefer to the table given later in this section for more details.\n\nFollowing work assumptions/limitations apply:\n\n**•** Minimum packet size of 500 bytes to achieve maximum data rate (Recommended packet size is\n1000 bytes or higher).\n\n**•** Maximum data rate achieved with AES and Snow 3G ciphering algorithms.\n\n- 1Gbps achieved with ZUC with packets of minimum 800 bytes.\n\n**•** The actual achievable peak DL throughput is also subject to the network under the test, i.e.\nFDD-TDD and other features combinations.\n\n**•** Support on Single HLS server set-up only. 5CC DL CA ->5CC DL CA HO is not supported.\n\n**•** SCells at unlicensed LTE band (5CC 4Rx working in conjunction with LTE-U or LAA) is not\nsupported.\n\n**•** M2M for 5CC 4x4 is not supported.',
]
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
Triplet
| Metric |
Value |
| cosine_accuracy |
1.0 |
Training Details
Training Dataset
Unnamed Dataset
Evaluation Dataset
Unnamed Dataset
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: steps
per_device_train_batch_size: 2
per_device_eval_batch_size: 2
gradient_accumulation_steps: 32
learning_rate: 2e-06
num_train_epochs: 10
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: True
tf32: True
deepspeed: /home/jovyan/himanshu/embedding_finetuning/ds_config.json
optim: adamw_torch_fused
batch_sampler: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir: False
do_predict: False
eval_strategy: steps
prediction_loss_only: True
per_device_train_batch_size: 2
per_device_eval_batch_size: 2
per_gpu_train_batch_size: None
per_gpu_eval_batch_size: None
gradient_accumulation_steps: 32
eval_accumulation_steps: None
torch_empty_cache_steps: None
learning_rate: 2e-06
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
max_grad_norm: 1.0
num_train_epochs: 10
max_steps: -1
lr_scheduler_type: cosine
lr_scheduler_kwargs: {}
warmup_ratio: 0.1
warmup_steps: 0
log_level: passive
log_level_replica: warning
log_on_each_node: True
logging_nan_inf_filter: True
save_safetensors: True
save_on_each_node: False
save_only_model: False
restore_callback_states_from_checkpoint: False
no_cuda: False
use_cpu: False
use_mps_device: False
seed: 42
data_seed: None
jit_mode_eval: False
use_ipex: False
bf16: True
fp16: False
fp16_opt_level: O1
half_precision_backend: auto
bf16_full_eval: False
fp16_full_eval: False
tf32: True
local_rank: 0
ddp_backend: None
tpu_num_cores: None
tpu_metrics_debug: False
debug: []
dataloader_drop_last: True
dataloader_num_workers: 0
dataloader_prefetch_factor: None
past_index: -1
disable_tqdm: False
remove_unused_columns: True
label_names: None
load_best_model_at_end: False
ignore_data_skip: False
fsdp: []
fsdp_min_num_params: 0
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
fsdp_transformer_layer_cls_to_wrap: None
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: /home/jovyan/himanshu/embedding_finetuning/ds_config.json
label_smoothing_factor: 0.0
optim: adamw_torch_fused
optim_args: None
adafactor: False
group_by_length: False
length_column_name: length
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
use_legacy_prediction_loop: False
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_inputs_for_metrics: False
include_for_metrics: []
eval_do_concat_batches: True
fp16_backend: auto
push_to_hub_model_id: None
push_to_hub_organization: None
mp_parameters:
auto_find_batch_size: False
full_determinism: False
torchdynamo: None
ray_scope: last
ddp_timeout: 1800
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
include_tokens_per_second: False
include_num_input_tokens_seen: False
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
prompts: None
batch_sampler: no_duplicates
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
Training Logs
| Epoch |
Step |
Training Loss |
Validation Loss |
Qwen/Qwen3-Embedding-4B-Matryoshka_cosine_accuracy |
| -1 |
-1 |
- |
- |
0.2766 |
| 4.5462 |
100 |
0.3355 |
0.0748 |
1.0 |
| 9.0910 |
200 |
0.0341 |
0.0633 |
1.0 |
Framework Versions
- Python: 3.11.10
- Sentence Transformers: 5.1.0
- Transformers: 4.56.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.10.1
- Datasets: 3.2.0
- Tokenizers: 0.22.0
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",
}
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}
}