CoolFace
Modelpublic

kushalc1/sarashina-embedding-v2-1b-jsts

sourceHugging Faceupdated 9mo agoView on Hugging Face
1likes71downloads
Model Card

SentenceTransformer based on sbintuitions/sarashina-embedding-v2-1b

This is a sentence-transformers model finetuned from sbintuitions/sarashina-embedding-v2-1b on the jsts dataset. It maps sentences & paragraphs to a 1792-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: sbintuitions/sarashina-embedding-v2-1b <!-- at revision 1f3408afaa7b617e3445d891310a9c26dd0c68a5 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 1792 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —jsts
  • —Language: jpn <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'LlamaModel'})
  (1): Pooling({'word_embedding_dimension': 1792, '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': False})
)

Loss

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("kushalc1/sarashina-embedding-v2-1b-jsts-matryoshka")
# Run inference
sentences = [
    '樹木に囲まれた芝生の上に三頭のキリンが立っています。',
    '芝生の上に数頭のキリンが歩いています。',
    '茶色のテーブルの上にピザと飲み物が置かれています。',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1792]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.8499, 0.3438],
#         [0.8499, 1.0000, 0.3127],
#         [0.3438, 0.3127, 1.0000]])

<!--

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

Semantic Similarity
json
  {
      "truncate_dim": 1792
  }
Metricsts-dev-1792sts-test-1792
pearson_cosine0.81250.8124
spearman_cosine0.75210.7521
Semantic Similarity
json
  {
      "truncate_dim": 1280
  }
Metricsts-dev-1280sts-test-1280
pearson_cosine0.80990.8099
spearman_cosine0.74920.7491
Semantic Similarity
json
  {
      "truncate_dim": 768
  }
Metricsts-dev-768sts-test-768
pearson_cosine0.80580.8057
spearman_cosine0.74620.7461
Semantic Similarity
json
  {
      "truncate_dim": 256
  }
Metricsts-dev-256sts-test-256
pearson_cosine0.79460.7945
spearman_cosine0.73810.738
Semantic Similarity
json
  {
      "truncate_dim": 64
  }
Metricsts-dev-64sts-test-64
pearson_cosine0.7530.7531
spearman_cosine0.7080.708

<!--

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

jsts
  • —Dataset: jsts at b3d3097
  • —Size: 12,451 training samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 5 tokens</li><li>mean: 10.64 tokens</li><li>max: 35 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 10.53 tokens</li><li>max: 30 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 2.32</li><li>max: 5.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:------------------------------------|:-----------------------------------|:-------------------------------| | <code>川べりでサーフボードを持った人たちがいます。</code> | <code>トイレの壁に黒いタオルがかけられています。</code> | <code>0.0</code> | | <code>二人の男性がジャンボジェット機を見ています。</code> | <code>2人の男性が、白い飛行機を眺めています。</code> | <code>3.799999952316284</code> | | <code>男性が子供を抱き上げて立っています。</code> | <code>坊主頭の男性が子供を抱いて立っています。</code> | <code>4.0</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Evaluation Dataset

jsts
  • —Dataset: jsts at b3d3097
  • —Size: 1,457 evaluation samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 5 tokens</li><li>mean: 10.78 tokens</li><li>max: 34 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 10.63 tokens</li><li>max: 37 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 2.22</li><li>max: 5.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:-----------------------------------------|:------------------------------------|:--------------------------------| | <code>レンガの建物の前を、乳母車を押した女性が歩いています。</code> | <code>厩舎で馬と女性とが寄り添っています。</code> | <code>0.0</code> | | <code>山の上に顔の白い牛が2頭います。</code> | <code>曇り空の山肌で、牛が2匹草を食んでいます。</code> | <code>2.4000000953674316</code> | | <code>バナナを持った人が道路を通行しています。</code> | <code>道の上をバナナを背負った男性が歩いています。</code> | <code>3.5999999046325684</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —num_train_epochs: 4
  • —warmup_ratio: 0.1
  • —fp16: True
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_steps: None
  • —torch_empty_cache_steps: None
  • —learning_rate: 5e-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: 4
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —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: False
  • —fp16: True
  • —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: True
  • —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
  • —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: False
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Losssts-dev-1792_spearman_cosinests-dev-1280_spearman_cosinests-dev-768_spearman_cosinests-dev-256_spearman_cosinests-dev-64_spearman_cosinests-test-1792_spearman_cosinests-test-1280_spearman_cosinests-test-768_spearman_cosinests-test-256_spearman_cosinests-test-64_spearman_cosine
0.12841000.91041.08030.77320.77420.77000.76590.7287-----
0.25672001.06211.15980.72080.72040.71980.70960.6787-----
0.38513001.22891.48080.62250.63050.62340.61540.5922-----
0.51354001.2151.34080.65590.65270.64970.64730.6329-----
0.64185001.29911.45410.63000.63240.63140.62760.5959-----
0.77026001.25371.38910.64180.64160.64220.63890.6019-----
0.89867001.22481.27780.68170.68550.68320.68000.6562-----
1.02708001.17721.39470.66740.66660.66520.66180.6392-----
1.15539001.1191.22910.70860.70660.70180.70320.6758-----
1.283710001.05031.16550.71830.71630.71350.71300.6961-----
1.412111001.07291.15500.73330.73400.72990.72600.6955-----
1.540412001.09521.31860.67530.67900.67280.67380.6417-----
1.668813001.02841.18160.71460.71310.70710.70960.6786-----
1.797214001.02481.14950.72820.72700.72060.71960.6913-----
1.925515001.01381.13710.72640.72400.71750.71300.6738-----
2.053916000.97391.15770.71730.71430.70880.71420.6881-----
2.182317000.79081.16270.73580.73410.73000.72780.7045-----
2.310718000.88771.13960.73120.73030.72630.72190.6942-----
2.439019000.84031.18680.73950.73790.73460.73240.7167-----
2.567420000.85581.14810.74240.74110.73790.73730.7143-----
2.695821000.83041.13770.73910.73660.73140.72870.7075-----
2.824122000.80531.08740.73840.73670.73130.72840.7153-----
2.952523000.80711.07200.75040.74870.74360.73720.7205-----
3.080924000.60821.14070.75330.75210.74800.74030.7195-----
3.209225000.51831.15550.75620.75460.75050.74370.7124-----
3.337626000.53111.19230.74940.74760.74340.73820.7084-----
3.466027000.49141.17520.74460.74160.73760.73260.7034-----
3.594428000.54861.19240.74720.74390.74000.73130.6989-----
3.722729000.47021.19030.75260.74970.74660.73800.7075-----
3.851130000.46741.17490.75190.74870.74590.73780.7071-----
3.979531000.46961.17950.75210.74920.74620.73810.7080-----
-1-1-------0.75210.74910.74610.73800.7080

Framework Versions

  • —Python: 3.12.6
  • —Sentence Transformers: 5.2.0
  • —Transformers: 4.56.0
  • —PyTorch: 2.8.0+cu129
  • —Accelerate: 1.10.1
  • —Datasets: 4.4.2
  • —Tokenizers: 0.22.0

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",
}
MultipleNegativesRankingLoss
bibtex
@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. -->