---
language:
- en
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- loss:MatryoshkaLoss
- loss:MultipleNegativesRankingLoss
base_model: distilbert/distilroberta-base
metrics:
- pearson_cosine
- spearman_cosine
- pearson_manhattan
- spearman_manhattan
- pearson_euclidean
- spearman_euclidean
- pearson_dot
- spearman_dot
- pearson_max
- spearman_max
widget:
- source_sentence: The gate is yellow.
sentences:
- A yellow dog is playing in the snow.
- A turtle walks over the ground.
- Three men are on stage playing guitars.
- source_sentence: A woman is reading.
sentences:
- A woman is writing something.
- A tiger walks around aimlessly.
- Gunmen 'kill 10 tourists' in Kashmir
- source_sentence: A man jumping rope
sentences:
- A man is climbing a rope.
- Bombings kill 19 people in Iraq
- Kittens are eating from dishes.
- source_sentence: A baby is laughing.
sentences:
- A baby is crawling happily.
- Kittens are eating from dishes.
- SFG meeting reviews situation in Mali
- source_sentence: A man shoots a man.
sentences:
- A man is shooting off guns.
- A man is erasing a chalk board.
- A girl is riding a bicycle.
pipeline_tag: sentence-similarity
co2_eq_emissions:
emissions: 134.46101750442273
energy_consumed: 0.34592314293320514
source: codecarbon
training_type: fine-tuning
on_cloud: false
cpu_model: 13th Gen Intel(R) Core(TM) i7-13700K
ram_total_size: 31.777088165283203
hours_used: 1.296
hardware_used: 1 x NVIDIA GeForce RTX 3090
model-index:
- name: SentenceTransformer based on distilbert/distilroberta-base
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev 768
type: sts-dev-768
metrics:
- type: pearson_cosine
value: 0.8481251400932781
name: Pearson Cosine
- type: spearman_cosine
value: 0.851870210632031
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8393267568646925
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8384807951588668
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8409860761844343
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8402437232149903
name: Spearman Euclidean
- type: pearson_dot
value: 0.778375740024104
name: Pearson Dot
- type: spearman_dot
value: 0.7779671330832745
name: Spearman Dot
- type: pearson_max
value: 0.8481251400932781
name: Pearson Max
- type: spearman_max
value: 0.851870210632031
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev 512
type: sts-dev-512
metrics:
- type: pearson_cosine
value: 0.8481027005283404
name: Pearson Cosine
- type: spearman_cosine
value: 0.8523762836460506
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8386304289845581
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8377488866945335
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8402060724091132
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8394674780683281
name: Spearman Euclidean
- type: pearson_dot
value: 0.7711669414347555
name: Pearson Dot
- type: spearman_dot
value: 0.7713442697629354
name: Spearman Dot
- type: pearson_max
value: 0.8481027005283404
name: Pearson Max
- type: spearman_max
value: 0.8523762836460506
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev 256
type: sts-dev-256
metrics:
- type: pearson_cosine
value: 0.842129976172463
name: Pearson Cosine
- type: spearman_cosine
value: 0.8488334736505414
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8313278330554295
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8315716535622544
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8333448222091957
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8335338271135746
name: Spearman Euclidean
- type: pearson_dot
value: 0.7445817504026263
name: Pearson Dot
- type: spearman_dot
value: 0.7450058498333884
name: Spearman Dot
- type: pearson_max
value: 0.842129976172463
name: Pearson Max
- type: spearman_max
value: 0.8488334736505414
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev 128
type: sts-dev-128
metrics:
- type: pearson_cosine
value: 0.8346971467711455
name: Pearson Cosine
- type: spearman_cosine
value: 0.8445473333837453
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8240728025222037
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8248062249521573
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8254381823447683
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8261820268848477
name: Spearman Euclidean
- type: pearson_dot
value: 0.7083986436033697
name: Pearson Dot
- type: spearman_dot
value: 0.7093343189476312
name: Spearman Dot
- type: pearson_max
value: 0.8346971467711455
name: Pearson Max
- type: spearman_max
value: 0.8445473333837453
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev 64
type: sts-dev-64
metrics:
- type: pearson_cosine
value: 0.8201235619233855
name: Pearson Cosine
- type: spearman_cosine
value: 0.8352180907883887
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8032422421113089
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8047180797117756
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8059536263441476
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8072309964597537
name: Spearman Euclidean
- type: pearson_dot
value: 0.6360301824635421
name: Pearson Dot
- type: spearman_dot
value: 0.6388601952951507
name: Spearman Dot
- type: pearson_max
value: 0.8201235619233855
name: Pearson Max
- type: spearman_max
value: 0.8352180907883887
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 768
type: sts-test-768
metrics:
- type: pearson_cosine
value: 0.8262197279185375
name: Pearson Cosine
- type: spearman_cosine
value: 0.8297611922199533
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8103738584802076
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8032653500693283
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8113711464219397
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8047844488402207
name: Spearman Euclidean
- type: pearson_dot
value: 0.7351063083543349
name: Pearson Dot
- type: spearman_dot
value: 0.7222898603318773
name: Spearman Dot
- type: pearson_max
value: 0.8262197279185375
name: Pearson Max
- type: spearman_max
value: 0.8297611922199533
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 512
type: sts-test-512
metrics:
- type: pearson_cosine
value: 0.8265289700873992
name: Pearson Cosine
- type: spearman_cosine
value: 0.8303420710627304
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8092042518460232
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.8021561300791633
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8099517575676378
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.8034311442407586
name: Spearman Euclidean
- type: pearson_dot
value: 0.7239156858292818
name: Pearson Dot
- type: spearman_dot
value: 0.7141021600172974
name: Spearman Dot
- type: pearson_max
value: 0.8265289700873992
name: Pearson Max
- type: spearman_max
value: 0.8303420710627304
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 256
type: sts-test-256
metrics:
- type: pearson_cosine
value: 0.8247713863827557
name: Pearson Cosine
- type: spearman_cosine
value: 0.8304669772286988
name: Spearman Cosine
- type: pearson_manhattan
value: 0.8012313573943666
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7951476656544464
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.8028104839960224
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7974260171623634
name: Spearman Euclidean
- type: pearson_dot
value: 0.7011271518071694
name: Pearson Dot
- type: spearman_dot
value: 0.6946104528279369
name: Spearman Dot
- type: pearson_max
value: 0.8247713863827557
name: Pearson Max
- type: spearman_max
value: 0.8304669772286988
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 128
type: sts-test-128
metrics:
- type: pearson_cosine
value: 0.8205553018873636
name: Pearson Cosine
- type: spearman_cosine
value: 0.8283987535951244
name: Spearman Cosine
- type: pearson_manhattan
value: 0.7931877193499666
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7878356187942884
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7946730313407452
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7891423743206649
name: Spearman Euclidean
- type: pearson_dot
value: 0.6617612604436709
name: Pearson Dot
- type: spearman_dot
value: 0.658567255717814
name: Spearman Dot
- type: pearson_max
value: 0.8205553018873636
name: Pearson Max
- type: spearman_max
value: 0.8283987535951244
name: Spearman Max
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test 64
type: sts-test-64
metrics:
- type: pearson_cosine
value: 0.8118818737650724
name: Pearson Cosine
- type: spearman_cosine
value: 0.8241392189948019
name: Spearman Cosine
- type: pearson_manhattan
value: 0.7761319753952881
name: Pearson Manhattan
- type: spearman_manhattan
value: 0.7738169467058665
name: Spearman Manhattan
- type: pearson_euclidean
value: 0.7777045912119006
name: Pearson Euclidean
- type: spearman_euclidean
value: 0.7745630850628562
name: Spearman Euclidean
- type: pearson_dot
value: 0.5934162536230442
name: Pearson Dot
- type: spearman_dot
value: 0.5884207612393454
name: Spearman Dot
- type: pearson_max
value: 0.8118818737650724
name: Pearson Max
- type: spearman_max
value: 0.8241392189948019
name: Spearman Max
---
# SentenceTransformer based on distilbert/distilroberta-base
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [distilbert/distilroberta-base](https://huggingface.co/distilbert/distilroberta-base) on the [sentence-transformers/all-nli](https://huggingface.co/datasets/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.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [distilbert/distilroberta-base](https://huggingface.co/distilbert/distilroberta-base)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 tokens
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [sentence-transformers/all-nli](https://huggingface.co/datasets/sentence-transformers/all-nli)
- **Language:** en
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
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})
)
```
## 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("tomaarsen/distilroberta-base-nli-matryoshka-v3")
# Run inference
sentences = [
'A man shoots a man.',
'A man is shooting off guns.',
'A man is erasing a chalk board.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Semantic Similarity
* Dataset: `sts-dev-768`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8481 |
| **spearman_cosine** | **0.8519** |
| pearson_manhattan | 0.8393 |
| spearman_manhattan | 0.8385 |
| pearson_euclidean | 0.841 |
| spearman_euclidean | 0.8402 |
| pearson_dot | 0.7784 |
| spearman_dot | 0.778 |
| pearson_max | 0.8481 |
| spearman_max | 0.8519 |
#### Semantic Similarity
* Dataset: `sts-dev-512`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8481 |
| **spearman_cosine** | **0.8524** |
| pearson_manhattan | 0.8386 |
| spearman_manhattan | 0.8377 |
| pearson_euclidean | 0.8402 |
| spearman_euclidean | 0.8395 |
| pearson_dot | 0.7712 |
| spearman_dot | 0.7713 |
| pearson_max | 0.8481 |
| spearman_max | 0.8524 |
#### Semantic Similarity
* Dataset: `sts-dev-256`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8421 |
| **spearman_cosine** | **0.8488** |
| pearson_manhattan | 0.8313 |
| spearman_manhattan | 0.8316 |
| pearson_euclidean | 0.8333 |
| spearman_euclidean | 0.8335 |
| pearson_dot | 0.7446 |
| spearman_dot | 0.745 |
| pearson_max | 0.8421 |
| spearman_max | 0.8488 |
#### Semantic Similarity
* Dataset: `sts-dev-128`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8347 |
| **spearman_cosine** | **0.8445** |
| pearson_manhattan | 0.8241 |
| spearman_manhattan | 0.8248 |
| pearson_euclidean | 0.8254 |
| spearman_euclidean | 0.8262 |
| pearson_dot | 0.7084 |
| spearman_dot | 0.7093 |
| pearson_max | 0.8347 |
| spearman_max | 0.8445 |
#### Semantic Similarity
* Dataset: `sts-dev-64`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8201 |
| **spearman_cosine** | **0.8352** |
| pearson_manhattan | 0.8032 |
| spearman_manhattan | 0.8047 |
| pearson_euclidean | 0.806 |
| spearman_euclidean | 0.8072 |
| pearson_dot | 0.636 |
| spearman_dot | 0.6389 |
| pearson_max | 0.8201 |
| spearman_max | 0.8352 |
#### Semantic Similarity
* Dataset: `sts-test-768`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8262 |
| **spearman_cosine** | **0.8298** |
| pearson_manhattan | 0.8104 |
| spearman_manhattan | 0.8033 |
| pearson_euclidean | 0.8114 |
| spearman_euclidean | 0.8048 |
| pearson_dot | 0.7351 |
| spearman_dot | 0.7223 |
| pearson_max | 0.8262 |
| spearman_max | 0.8298 |
#### Semantic Similarity
* Dataset: `sts-test-512`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8265 |
| **spearman_cosine** | **0.8303** |
| pearson_manhattan | 0.8092 |
| spearman_manhattan | 0.8022 |
| pearson_euclidean | 0.81 |
| spearman_euclidean | 0.8034 |
| pearson_dot | 0.7239 |
| spearman_dot | 0.7141 |
| pearson_max | 0.8265 |
| spearman_max | 0.8303 |
#### Semantic Similarity
* Dataset: `sts-test-256`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8248 |
| **spearman_cosine** | **0.8305** |
| pearson_manhattan | 0.8012 |
| spearman_manhattan | 0.7951 |
| pearson_euclidean | 0.8028 |
| spearman_euclidean | 0.7974 |
| pearson_dot | 0.7011 |
| spearman_dot | 0.6946 |
| pearson_max | 0.8248 |
| spearman_max | 0.8305 |
#### Semantic Similarity
* Dataset: `sts-test-128`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8206 |
| **spearman_cosine** | **0.8284** |
| pearson_manhattan | 0.7932 |
| spearman_manhattan | 0.7878 |
| pearson_euclidean | 0.7947 |
| spearman_euclidean | 0.7891 |
| pearson_dot | 0.6618 |
| spearman_dot | 0.6586 |
| pearson_max | 0.8206 |
| spearman_max | 0.8284 |
#### Semantic Similarity
* Dataset: `sts-test-64`
* Evaluated with [EmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| pearson_cosine | 0.8119 |
| **spearman_cosine** | **0.8241** |
| pearson_manhattan | 0.7761 |
| spearman_manhattan | 0.7738 |
| pearson_euclidean | 0.7777 |
| spearman_euclidean | 0.7746 |
| pearson_dot | 0.5934 |
| spearman_dot | 0.5884 |
| pearson_max | 0.8119 |
| spearman_max | 0.8241 |
## Training Details
### Training Dataset
#### sentence-transformers/all-nli
* Dataset: [sentence-transformers/all-nli](https://huggingface.co/datasets/sentence-transformers/all-nli) at [65dd388](https://huggingface.co/datasets/sentence-transformers/all-nli/tree/65dd38867b600f42241d2066ba1a35fbd097fcfe)
* Size: 557,850 training samples
* Columns: anchor
, positive
, and negative
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
| type | string | string | string |
| details |
A person on a horse jumps over a broken down airplane.
| A person is outdoors, on a horse.
| A person is at a diner, ordering an omelette.
|
| Children smiling and waving at camera
| There are children present
| The kids are frowning
|
| A boy is jumping on skateboard in the middle of a red bridge.
| The boy does a skateboarding trick.
| The boy skates down the sidewalk.
|
* Loss: [MatryoshkaLoss
](https://sbert.net/docs/package_reference/losses.html#matryoshkaloss) with these parameters:
```json
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
```
### Evaluation Dataset
#### sentence-transformers/stsb
* Dataset: [sentence-transformers/stsb](https://huggingface.co/datasets/sentence-transformers/stsb) at [ab7a5ac](https://huggingface.co/datasets/sentence-transformers/stsb/tree/ab7a5ac0e35aa22088bdcf23e7fd99b220e53308)
* Size: 1,500 evaluation samples
* Columns: sentence1
, sentence2
, and score
* Approximate statistics based on the first 1000 samples:
| | sentence1 | sentence2 | score |
|:--------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details | A man with a hard hat is dancing.
| A man wearing a hard hat is dancing.
| 1.0
|
| A young child is riding a horse.
| A child is riding a horse.
| 0.95
|
| A man is feeding a mouse to a snake.
| The man is feeding a mouse to the snake.
| 1.0
|
* Loss: [MatryoshkaLoss
](https://sbert.net/docs/package_reference/losses.html#matryoshkaloss) with these parameters:
```json
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 128
- `per_device_eval_batch_size`: 128
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters