CoolFace
Modelpublic

zyc-zju/qwen3-embedding-4b_search-r1_2wiki_lsr

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
Model Card

SentenceTransformer based on Qwen/Qwen3-Embedding-4B

This is a sentence-transformers model finetuned from Qwen/Qwen3-Embedding-4B on the flash_rag_datasets dataset. 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 <!-- at revision 5cf2132abc99cad020ac570b19d031efec650f2b -->
  • —Maximum Sequence Length: 40960 tokens
  • —Output Dimensionality: 2560 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —flash_rag_datasets
  • —Language: en <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 40960, 'do_lower_case': False, 'architecture': 'PeftModelForFeatureExtraction'})
  (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:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("qwen3-embedding-4b_search-r1_2wiki_lsr")
# Run inference
queries = [
    "Do both films Country (film) and Raid in St. Pauli have the directors that share the same nationality?",
]
documents = [
    'no',
    '13 October 1952',
    'yes',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 2560] [3, 2560]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.1784, 0.1785, 0.1738]])

<!--

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. -->

<!--

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

flashragdatasets
  • —Dataset: flash_rag_datasets at bcafb8d
  • —Size: 15,000 training samples
  • —Columns: <code>query</code> and <code>response</code>
  • —Approximate statistics based on the first 1000 samples: | | query | response | |:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 9 tokens</li><li>mean: 18.86 tokens</li><li>max: 38 tokens</li></ul> | <ul><li>min: 2 tokens</li><li>mean: 4.44 tokens</li><li>max: 15 tokens</li></ul> |
  • —Samples: | query | response | |:------------------------------------------------------------------------------------------------------------------------|:------------------------------| | <code>Are director of film Move (1970 Film) and director of film Méditerranée (1963 Film) from the same country?</code> | <code>no</code> | | <code>Do both films The Falcon (Film) and Valentin The Good have the directors from the same country?</code> | <code>no</code> | | <code>Which film whose director is younger, Charge It To Me or Danger: Diabolik?</code> | <code>Danger: Diabolik</code> |
  • —Loss: <code>fed_rag.loss.pytorch.lsr.LSRLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • —per_device_train_batch_size: 1
  • —gradient_accumulation_steps: 16
  • —learning_rate: 1e-05
  • —max_steps: 100
  • —lr_scheduler_type: constant
  • —remove_unused_columns: False
  • —dataloader_pin_memory: False
  • —push_to_hub: True
All Hyperparameters

<details><summary>Click to expand</summary>

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: no
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 1
  • —per_device_eval_batch_size: 8
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 16
  • —eval_accumulation_steps: None
  • —torch_empty_cache_steps: None
  • —learning_rate: 1e-05
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —max_grad_norm: 1.0
  • —num_train_epochs: 3.0
  • —max_steps: 100
  • —lr_scheduler_type: constant
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.0
  • —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
  • —bf16: False
  • —fp16: False
  • —fp16_opt_level: O1
  • —half_precision_backend: auto
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —local_rank: 0
  • —ddp_backend: None
  • —tpu_num_cores: None
  • —tpu_metrics_debug: False
  • —debug: []
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —past_index: -1
  • —disable_tqdm: False
  • —remove_unused_columns: False
  • —label_names: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —parallelism_config: None
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamwtorchfused
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —project: huggingface
  • —trackio_space_id: trackio
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —dataloader_pin_memory: False
  • —dataloader_persistent_workers: False
  • —skip_memory_metrics: True
  • —use_legacy_prediction_loop: False
  • —push_to_hub: True
  • —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: no
  • —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: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Loss
0.001110.0005
0.002120.0008
0.003230.0007
0.004340.0003
0.005350.0007
0.006460.0006
0.007570.0006
0.008580.0004
0.009690.0002
0.0107100.0006
0.0117110.0003
0.0128120.001
0.0139130.0006
0.0149140.0005
0.016150.0005
0.0171160.0004
0.0181170.0008
0.0192180.0004
0.0203190.0006
0.0213200.0003
0.0224210.0005
0.0235220.0005
0.0245230.0008
0.0256240.0007
0.0267250.0004
0.0277260.0009
0.0288270.0006
0.0299280.0008
0.0309290.0005
0.032300.0007
0.0331310.0003
0.0341320.0006
0.0352330.0003
0.0363340.0005
0.0373350.0006
0.0384360.0006
0.0395370.0005
0.0405380.0007
0.0416390.0003
0.0427400.0005
0.0437410.0005
0.0448420.0006
0.0459430.0009
0.0469440.0007
0.048450.0004
0.0491460.0006
0.0501470.001
0.0512480.0005
0.0523490.0009
0.0533500.0006
0.0544510.0004
0.0555520.0007
0.0565530.0007
0.0576540.0012
0.0587550.0006
0.0597560.0006
0.0608570.0005
0.0619580.0008
0.0629590.0005
0.064600.0008
0.0651610.0006
0.0661620.0005
0.0672630.0006
0.0683640.0006
0.0693650.0005
0.0704660.0005
0.0715670.0009
0.0725680.0004
0.0736690.0008
0.0747700.0006
0.0757710.0004
0.0768720.0006
0.0779730.0006
0.0789740.0008
0.08750.0008
0.0811760.0006
0.0821770.0006
0.0832780.0007
0.0843790.0004
0.0853800.0006
0.0864810.0006
0.0875820.0005
0.0885830.0009
0.0896840.0003
0.0907850.0004
0.0917860.0006
0.0928870.001
0.0939880.0008
0.0949890.0006
0.096900.0005
0.0971910.0006
0.0981920.0006
0.0992930.0006
0.1003940.001
0.1013950.0005
0.1024960.0005
0.1035970.0004
0.1045980.0007
0.1056990.0008
0.10671000.0004

Framework Versions

  • —Python: 3.11.14
  • —Sentence Transformers: 5.2.0
  • —Transformers: 4.57.2
  • —PyTorch: 2.9.1+cu128
  • —Accelerate: 1.12.0
  • —Datasets: 4.5.0
  • —Tokenizers: 0.22.2

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}

<!--

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. -->