Downloads · 30 days
35
6% of all-time downloads
mrm8488/distilroberta-base-ft-allnli-matryoshka-768-16-1e-128bs
distilroberta-base-ft-allnli-matryoshka-768-16-1e-128bs is a sentence similarity model from mrm8488. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from distilbert/distilroberta-base on the sentence-transformers/all-nli dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used f…
Downloads · 30 days
35
6% of all-time downloads
All-time downloads
580
Public
Parameters
82.1M
328 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors328 MB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from distilbert/distilroberta-base on the sentence-transformers/all-nli dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
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
# Download from the 🤗 Hub
model = SentenceTransformer("mrm8488/distilroberta-base-ft-allnli-matryoshka-768-16-1e-128bs")
# Run inference
sentences = [
'It is well.',
"That's convenient.",
'away from the children',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
<!--
### 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.*
-->
sts-dev-768| Metric | Value |
|---|---|
| pearson_cosine | 0.8413 |
| spearman_cosine | 0.8478 |
| pearson_manhattan | 0.8414 |
| spearman_manhattan | 0.8395 |
| pearson_euclidean | 0.8423 |
| spearman_euclidean | 0.8401 |
| pearson_dot | 0.7855 |
| spearman_dot | 0.7814 |
| pearson_max | 0.8423 |
| spearman_max | 0.8478 |
sts-dev-512| Metric | Value |
|---|---|
| pearson_cosine | 0.8395 |
| spearman_cosine | 0.847 |
| pearson_manhattan | 0.8399 |
| spearman_manhattan | 0.8377 |
| pearson_euclidean | 0.8407 |
| spearman_euclidean | 0.838 |
| pearson_dot | 0.7811 |
| spearman_dot | 0.7777 |
| pearson_max | 0.8407 |
| spearman_max | 0.847 |
sts-dev-256| Metric | Value |
|---|---|
| pearson_cosine | 0.8327 |
| spearman_cosine | 0.8436 |
| pearson_manhattan | 0.8351 |
| spearman_manhattan | 0.8332 |
| pearson_euclidean | 0.836 |
| spearman_euclidean | 0.8338 |
| pearson_dot | 0.75 |
| spearman_dot | 0.7453 |
| pearson_max | 0.836 |
| spearman_max | 0.8436 |
sts-dev-128| Metric | Value |
|---|---|
| pearson_cosine | 0.8243 |
| spearman_cosine | 0.84 |
| pearson_manhattan | 0.8282 |
| spearman_manhattan | 0.827 |
| pearson_euclidean | 0.8282 |
| spearman_euclidean | 0.8267 |
| pearson_dot | 0.711 |
| spearman_dot | 0.705 |
| pearson_max | 0.8282 |
| spearman_max | 0.84 |
sts-dev-64| Metric | Value |
|---|---|
| pearson_cosine | 0.8116 |
| spearman_cosine | 0.8317 |
| pearson_manhattan | 0.8113 |
| spearman_manhattan | 0.8105 |
| pearson_euclidean | 0.8114 |
| spearman_euclidean | 0.8111 |
| pearson_dot | 0.6412 |
| spearman_dot | 0.6347 |
| pearson_max | 0.8116 |
| spearman_max | 0.8317 |
sts-dev-32| Metric | Value |
|---|---|
| pearson_cosine | 0.7834 |
| spearman_cosine | 0.8141 |
| pearson_manhattan | 0.7832 |
| spearman_manhattan | 0.786 |
| pearson_euclidean | 0.7869 |
| spearman_euclidean | 0.7894 |
| pearson_dot | 0.5534 |
| spearman_dot | 0.5449 |
| pearson_max | 0.7869 |
| spearman_max | 0.8141 |
sts-dev-16| Metric | Value |
|---|---|
| pearson_cosine | 0.7259 |
| spearman_cosine | 0.7751 |
| pearson_manhattan | 0.7421 |
| spearman_manhattan | 0.7553 |
| pearson_euclidean | 0.7483 |
| spearman_euclidean | 0.7599 |
| pearson_dot | 0.4387 |
| spearman_dot | 0.4259 |
| pearson_max | 0.7483 |
| spearman_max | 0.7751 |
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 7 tokens</li><li>mean: 10.38 tokens</li><li>max: 45 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 12.8 tokens</li><li>max: 39 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 13.4 tokens</li><li>max: 50 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>A person on a horse jumps over a broken down airplane.</code> | <code>A person is outdoors, on a horse.</code> | <code>A person is at a diner, ordering an omelette.</code> |
| <code>Children smiling and waving at camera</code> | <code>There are children present</code> | <code>The kids are frowning</code> |
| <code>A boy is jumping on skateboard in the middle of a red bridge.</code> | <code>The boy does a skateboarding trick.</code> | <code>The boy skates down the sidewalk.</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64,
32,
16
],
"matryoshka_weights": [
1,
1,
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 6 tokens</li><li>mean: 18.02 tokens</li><li>max: 66 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 9.81 tokens</li><li>max: 29 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 10.37 tokens</li><li>max: 29 tokens</li></ul> |
| anchor | positive | negative |
|---|---|---|
| <code>Two women are embracing while holding to go packages.</code> | <code>Two woman are holding packages.</code> | <code>The men are fighting outside a deli.</code> |
| <code>Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.</code> | <code>Two kids in numbered jerseys wash their hands.</code> | <code>Two kids in jackets walk to school.</code> |
| <code>A man selling donuts to a customer during a world exhibition event held in the city of Angeles</code> | <code>A man selling donuts to a customer.</code> | <code>A woman drinks her coffee in a small cafe.</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64,
32,
16
],
"matryoshka_weights": [
1,
1,
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
eval_strategy: stepsper_device_train_batch_size: 128per_device_eval_batch_size: 128num_train_epochs: 1warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_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: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_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: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_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: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_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: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falsebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | loss | sts-dev-128_spearman_cosine | sts-dev-16_spearman_cosine | sts-dev-256_spearman_cosine | sts-dev-32_spearman_cosine | sts-dev-512_spearman_cosine | sts-dev-64_spearman_cosine | sts-dev-768_spearman_cosine |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.0229 | 100 | 29.0917 | 14.1514 | 0.7659 | 0.7440 | 0.7915 | 0.7749 | 0.7999 | 0.7909 | 0.7918 |
| 0.0459 | 200 | 15.6915 | 11.7031 | 0.7718 | 0.7487 | 0.7940 | 0.7776 | 0.8005 | 0.7931 | 0.7871 |
| 0.0688 | 300 | 14.3136 | 11.1970 | 0.7744 | 0.7389 | 0.7952 | 0.7728 | 0.8036 | 0.7925 | 0.7938 |
| 0.0918 | 400 | 12.8122 | 10.4416 | 0.7899 | 0.7536 | 0.8040 | 0.7764 | 0.8065 | 0.7953 | 0.8018 |
| 0.1147 | 500 | 12.1747 | 10.5491 | 0.7871 | 0.7513 | 0.8035 | 0.7785 | 0.8094 | 0.7978 | 0.8008 |
| 0.1376 | 600 | 11.6784 | 9.6618 | 0.7785 | 0.7465 | 0.7956 | 0.7762 | 0.8027 | 0.7953 | 0.7935 |
| 0.1606 | 700 | 11.9351 | 9.3279 | 0.7907 | 0.7403 | 0.7995 | 0.7706 | 0.8036 | 0.7894 | 0.7982 |
| 0.1835 | 800 | 10.4998 | 9.1538 | 0.7911 | 0.7516 | 0.8043 | 0.7820 | 0.8078 | 0.8025 | 0.8010 |
| 0.2065 | 900 | 10.6069 | 9.0531 | 0.7874 | 0.7371 | 0.7974 | 0.7704 | 0.8042 | 0.7910 | 0.8010 |
| 0.2294 | 1000 | 10.0316 | 8.9759 | 0.7842 | 0.7356 | 0.7981 | 0.7721 | 0.8024 | 0.7905 | 0.7955 |
| 0.2524 | 1100 | 10.199 | 8.5398 | 0.7863 | 0.7322 | 0.7961 | 0.7691 | 0.8002 | 0.7910 | 0.7936 |
| 0.2753 | 1200 | 9.9393 | 8.1356 | 0.7860 | 0.7304 | 0.7990 | 0.7682 | 0.8025 | 0.7908 | 0.7954 |
| 0.2982 | 1300 | 9.8711 | 7.9177 | 0.7932 | 0.7319 | 0.8028 | 0.7708 | 0.8067 | 0.7924 | 0.8013 |
| 0.3212 | 1400 | 9.3594 | 7.8870 | 0.7892 | 0.7296 | 0.8032 | 0.7710 | 0.8070 | 0.7961 | 0.8030 |
| 0.3441 | 1500 | 9.4534 | 7.5756 | 0.8003 | 0.7518 | 0.8078 | 0.7857 | 0.8112 | 0.8063 | 0.8068 |
| 0.3671 | 1600 | 8.9061 | 7.8164 | 0.7781 | 0.7390 | 0.7942 | 0.7761 | 0.8002 | 0.7968 | 0.7941 |
| 0.3900 | 1700 | 8.5164 | 7.4869 | 0.7934 | 0.7530 | 0.8063 | 0.7864 | 0.8120 | 0.8055 | 0.8080 |
| 0.4129 | 1800 | 8.9262 | 7.7155 | 0.7846 | 0.7301 | 0.7991 | 0.7728 | 0.8065 | 0.7945 | 0.8003 |
| 0.4359 | 1900 | 8.3242 | 7.3068 | 0.7850 | 0.7273 | 0.7976 | 0.7710 | 0.8020 | 0.7904 | 0.7976 |
| 0.4588 | 2000 | 8.5374 | 7.1026 | 0.7845 | 0.7272 | 0.7993 | 0.7717 | 0.8042 | 0.7925 | 0.7963 |
| 0.4818 | 2100 | 8.2304 | 7.1601 | 0.7879 | 0.7354 | 0.8015 | 0.7719 | 0.8059 | 0.7944 | 0.8029 |
| 0.5047 | 2200 | 8.1347 | 7.8267 | 0.7715 | 0.7230 | 0.7889 | 0.7626 | 0.7956 | 0.7849 | 0.7930 |
| 0.5276 | 2300 | 8.3057 | 8.0057 | 0.7622 | 0.7148 | 0.7814 | 0.7572 | 0.7881 | 0.7769 | 0.7836 |
| 0.5506 | 2400 | 8.215 | 7.6922 | 0.7772 | 0.7210 | 0.7929 | 0.7637 | 0.7995 | 0.7858 | 0.7956 |
| 0.5735 | 2500 | 8.4343 | 7.2104 | 0.7869 | 0.7307 | 0.8017 | 0.7707 | 0.8071 | 0.7929 | 0.8048 |
| 0.5965 | 2600 | 8.159 | 6.9977 | 0.7893 | 0.7297 | 0.8031 | 0.7733 | 0.8071 | 0.7928 | 0.8045 |
| 0.6194 | 2700 | 8.2048 | 6.9465 | 0.7859 | 0.7280 | 0.8006 | 0.7725 | 0.8052 | 0.7926 | 0.8004 |
| 0.6423 | 2800 | 8.187 | 7.3185 | 0.7790 | 0.7266 | 0.7960 | 0.7690 | 0.8018 | 0.7911 | 0.7964 |
| 0.6653 | 2900 | 8.4768 | 7.5535 | 0.7756 | 0.7192 | 0.7913 | 0.7618 | 0.7958 | 0.7827 | 0.7907 |
| 0.6882 | 3000 | 8.4153 | 7.3732 | 0.7825 | 0.7276 | 0.7988 | 0.7692 | 0.8029 | 0.7899 | 0.7988 |
| 0.7112 | 3100 | 7.9226 | 6.8469 | 0.7912 | 0.7311 | 0.8055 | 0.7765 | 0.8101 | 0.7977 | 0.8058 |
| 0.7341 | 3200 | 8.1155 | 6.7604 | 0.7880 | 0.7298 | 0.8024 | 0.7747 | 0.8071 | 0.7959 | 0.8025 |
| 0.7571 | 3300 | 6.8463 | 5.4863 | 0.8357 | 0.7638 | 0.8407 | 0.8085 | 0.8431 | 0.8283 | 0.8440 |
| 0.7800 | 3400 | 5.2008 | 5.2472 | 0.8362 | 0.7655 | 0.8401 | 0.8105 | 0.8429 | 0.8279 | 0.8445 |
| 0.8029 | 3500 | 4.5415 | 5.1649 | 0.8385 | 0.7700 | 0.8421 | 0.8138 | 0.8454 | 0.8304 | 0.8465 |
| 0.8259 | 3600 | 4.4474 | 5.0933 | 0.8371 | 0.7693 | 0.8410 | 0.8112 | 0.8443 | 0.8288 | 0.8451 |
| 0.8488 | 3700 | 4.12 | 5.0555 | 0.8396 | 0.7718 | 0.8439 | 0.8140 | 0.8463 | 0.8311 | 0.8471 |
| 0.8718 | 3800 | 3.9104 | 5.0147 | 0.8386 | 0.7749 | 0.8432 | 0.8129 | 0.8459 | 0.8304 | 0.8471 |
| 0.8947 | 3900 | 3.9054 | 4.9966 | 0.8379 | 0.7733 | 0.8424 | 0.8125 | 0.8456 | 0.8296 | 0.8464 |
| 0.9176 | 4000 | 3.757 | 4.9892 | 0.8407 | 0.7763 | 0.8447 | 0.8156 | 0.8478 | 0.8326 | 0.8488 |
| 0.9406 | 4100 | 3.7729 | 4.9859 | 0.8400 | 0.7751 | 0.8436 | 0.8141 | 0.8470 | 0.8317 | 0.8478 |
@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",
}
@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}
}
@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.*
-->