SentenceTransformer based on distilbert/distilroberta-base
This is a sentence-transformers model finetuned from distilbert/distilroberta-base on the mathstackexchange, socratic and stackexchange datasets. 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
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 tokens
- Similarity Function: Cosine Similarity
- Training Datasets:
- mathstackexchange
- socratic
- stackexchange
Model Sources
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:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("mrm8488/distilroberta-base-ft-webintruct-512")
sentences = [
"What should I do if I'm not satisfied with the answers to a question for which I've offered a bounty?\n\nIn my case, I've put a bounty on a question, but the two responses I received don't address the issue effectively. I requested the original poster (OP) to provide an answer so I could reward them for the interesting question, but they haven't done so. \n\nAre there any acceptable actions in this scenario? For instance, can I post my own non-answer, award myself the bounty, and then start a new bounty on a different question? Or are there alternative suggestions?",
"If all the provided answers do not adequately address your question, it's advisable to let the bounty expire. The system will handle the distribution of the bounty in such situations according to predefined rules.\n\nBounties carry a risk, as there is no guarantee that you will receive a satisfactory answer, even with the incentive. It's important to understand that you cannot reclaim your bounty once it's been offered. \n\nInstead of posting a non-answer, you might consider editing and clarifying your original question to attract better responses, or seeking assistance from the community through comments or chat. If needed, you can also start a new bounty on a different question, but ensure that it's clear and well-defined to increase the likelihood of receiving quality answers.",
'The issue you\'re experiencing with your 40kHz crystal oscillator might be due to insufficient drive strength and an incorrect load capacitance. Here are two potential causes and solutions:\n\n1. High Series Resistance: The 150 kΩ series resistance in your circuit might be too high, which results in a low drive strength for the crystal. This can lead to a reduced overall loop gain and prevents the oscillator from properly starting. To resolve this, try using a lower resistance value as recommended in the crystal\'s datasheet.\n\n2. Incorrect Load Capacitance: Ensure that the 33 pF load capacitors you\'re using are compatible with your crystal. Some low-power "watch" crystals require only 5-10 pF load capacitors. Always refer to the crystal\'s datasheet to verify the appropriate load capacitance value.\n\nIn summary, carefully review the crystal\'s datasheet to determine the correct series resistance and load capacitance values, and make the necessary adjustments to your circuit. By doing so, you should be able to resolve the issue and get your oscillator functioning properly.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
Evaluation
Metrics
Semantic Similarity
Metric |
Value |
pearson_cosine |
0.7294 |
spearman_cosine |
0.7554 |
pearson_manhattan |
0.7659 |
spearman_manhattan |
0.7695 |
pearson_euclidean |
0.767 |
spearman_euclidean |
0.7704 |
pearson_dot |
0.5262 |
spearman_dot |
0.5063 |
pearson_max |
0.767 |
spearman_max |
0.7704 |
Semantic Similarity
Metric |
Value |
pearson_cosine |
0.7064 |
spearman_cosine |
0.7116 |
pearson_manhattan |
0.7219 |
spearman_manhattan |
0.7117 |
pearson_euclidean |
0.7233 |
spearman_euclidean |
0.7131 |
pearson_dot |
0.4464 |
spearman_dot |
0.4372 |
pearson_max |
0.7233 |
spearman_max |
0.7131 |
Training Details
Training Datasets
mathstackexchange
socratic
stackexchange
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: steps
per_device_train_batch_size
: 64
per_device_eval_batch_size
: 64
num_train_epochs
: 1
warmup_ratio
: 0.1
fp16
: True
batch_sampler
: no_duplicates
multi_dataset_batch_sampler
: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir
: False
do_predict
: False
eval_strategy
: steps
prediction_loss_only
: True
per_device_train_batch_size
: 64
per_device_eval_batch_size
: 64
per_gpu_train_batch_size
: None
per_gpu_eval_batch_size
: None
gradient_accumulation_steps
: 1
eval_accumulation_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
: 1
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
: {'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}
deepspeed
: None
label_smoothing_factor
: 0.0
optim
: adamw_torch
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
: False
hub_always_push
: False
gradient_checkpointing
: False
gradient_checkpointing_kwargs
: None
include_inputs_for_metrics
: False
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
dispatch_batches
: None
split_batches
: 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
batch_sampler
: no_duplicates
multi_dataset_batch_sampler
: round_robin
Training Logs
Click to expand
Epoch |
Step |
Training Loss |
sts-dev_spearman_cosine |
sts-test_spearman_cosine |
0.0067 |
100 |
3.6873 |
- |
- |
0.0134 |
200 |
0.984 |
- |
- |
0.0202 |
300 |
0.2259 |
- |
- |
0.0269 |
400 |
0.1696 |
- |
- |
0.0336 |
500 |
0.1468 |
- |
- |
0.0403 |
600 |
0.1235 |
- |
- |
0.0471 |
700 |
0.1125 |
- |
- |
0.0538 |
800 |
0.1032 |
- |
- |
0.0605 |
900 |
0.097 |
- |
- |
0.0672 |
1000 |
0.0992 |
0.8011 |
- |
0.0740 |
1100 |
0.0937 |
- |
- |
0.0807 |
1200 |
0.0818 |
- |
- |
0.0874 |
1300 |
0.0909 |
- |
- |
0.0941 |
1400 |
0.0836 |
- |
- |
0.1009 |
1500 |
0.0705 |
- |
- |
0.1076 |
1600 |
0.081 |
- |
- |
0.1143 |
1700 |
0.0791 |
- |
- |
0.1210 |
1800 |
0.0677 |
- |
- |
0.1278 |
1900 |
0.0697 |
- |
- |
0.1345 |
2000 |
0.0661 |
0.7721 |
- |
0.1412 |
2100 |
0.0727 |
- |
- |
0.1479 |
2200 |
0.0683 |
- |
- |
0.1547 |
2300 |
0.0597 |
- |
- |
0.1614 |
2400 |
0.06 |
- |
- |
0.1681 |
2500 |
0.0598 |
- |
- |
0.1748 |
2600 |
0.051 |
- |
- |
0.1816 |
2700 |
0.0629 |
- |
- |
0.1883 |
2800 |
0.0513 |
- |
- |
0.1950 |
2900 |
0.0517 |
- |
- |
0.2017 |
3000 |
0.048 |
0.7783 |
- |
0.2085 |
3100 |
0.0418 |
- |
- |
0.2152 |
3200 |
0.0447 |
- |
- |
0.2219 |
3300 |
0.0458 |
- |
- |
0.2286 |
3400 |
0.0504 |
- |
- |
0.2354 |
3500 |
0.0463 |
- |
- |
0.2421 |
3600 |
0.0433 |
- |
- |
0.2488 |
3700 |
0.0447 |
- |
- |
0.2555 |
3800 |
0.0444 |
- |
- |
0.2623 |
3900 |
0.0432 |
- |
- |
0.2690 |
4000 |
0.0452 |
0.7910 |
- |
0.2757 |
4100 |
0.0419 |
- |
- |
0.2824 |
4200 |
0.0373 |
- |
- |
0.2892 |
4300 |
0.0385 |
- |
- |
0.2959 |
4400 |
0.0381 |
- |
- |
0.3026 |
4500 |
0.0383 |
- |
- |
0.3093 |
4600 |
0.0367 |
- |
- |
0.3161 |
4700 |
0.0353 |
- |
- |
0.3228 |
4800 |
0.034 |
- |
- |
0.3295 |
4900 |
0.0333 |
- |
- |
0.3362 |
5000 |
0.0406 |
0.7862 |
- |
0.3429 |
5100 |
0.0319 |
- |
- |
0.3497 |
5200 |
0.0332 |
- |
- |
0.3564 |
5300 |
0.0337 |
- |
- |
0.3631 |
5400 |
0.0347 |
- |
- |
0.3698 |
5500 |
0.0333 |
- |
- |
0.3766 |
5600 |
0.036 |
- |
- |
0.3833 |
5700 |
0.0319 |
- |
- |
0.3900 |
5800 |
0.0342 |
- |
- |
0.3967 |
5900 |
0.0296 |
- |
- |
0.4035 |
6000 |
0.0313 |
0.7675 |
- |
0.4102 |
6100 |
0.0289 |
- |
- |
0.4169 |
6200 |
0.0292 |
- |
- |
0.4236 |
6300 |
0.0271 |
- |
- |
0.4304 |
6400 |
0.0295 |
- |
- |
0.4371 |
6500 |
0.0353 |
- |
- |
0.4438 |
6600 |
0.035 |
- |
- |
0.4505 |
6700 |
0.0324 |
- |
- |
0.4573 |
6800 |
0.0281 |
- |
- |
0.4640 |
6900 |
0.0265 |
- |
- |
0.4707 |
7000 |
0.031 |
0.7634 |
- |
0.4774 |
7100 |
0.0302 |
- |
- |
0.4842 |
7200 |
0.0268 |
- |
- |
0.4909 |
7300 |
0.0275 |
- |
- |
0.4976 |
7400 |
0.0267 |
- |
- |
0.5043 |
7500 |
0.0249 |
- |
- |
0.5111 |
7600 |
0.0285 |
- |
- |
0.5178 |
7700 |
0.0311 |
- |
- |
0.5245 |
7800 |
0.0248 |
- |
- |
0.5312 |
7900 |
0.0278 |
- |
- |
0.5380 |
8000 |
0.0267 |
0.7658 |
- |
0.5447 |
8100 |
0.0245 |
- |
- |
0.5514 |
8200 |
0.0261 |
- |
- |
0.5581 |
8300 |
0.0227 |
- |
- |
0.5649 |
8400 |
0.0261 |
- |
- |
0.5716 |
8500 |
0.0241 |
- |
- |
0.5783 |
8600 |
0.0261 |
- |
- |
0.5850 |
8700 |
0.0173 |
- |
- |
0.5918 |
8800 |
0.0226 |
- |
- |
0.5985 |
8900 |
0.0221 |
- |
- |
0.6052 |
9000 |
0.023 |
0.7558 |
- |
0.6119 |
9100 |
0.0218 |
- |
- |
0.6187 |
9200 |
0.0245 |
- |
- |
0.6254 |
9300 |
0.0232 |
- |
- |
0.6321 |
9400 |
0.0208 |
- |
- |
0.6388 |
9500 |
0.0202 |
- |
- |
0.6456 |
9600 |
0.022 |
- |
- |
0.6523 |
9700 |
0.0212 |
- |
- |
0.6590 |
9800 |
0.0228 |
- |
- |
0.6657 |
9900 |
0.0214 |
- |
- |
0.6724 |
10000 |
0.0206 |
0.7686 |
- |
0.6792 |
10100 |
0.0227 |
- |
- |
0.6859 |
10200 |
0.0225 |
- |
- |
0.6926 |
10300 |
0.018 |
- |
- |
0.6993 |
10400 |
0.0185 |
- |
- |
0.7061 |
10500 |
0.0204 |
- |
- |
0.7128 |
10600 |
0.0216 |
- |
- |
0.7195 |
10700 |
0.0212 |
- |
- |
0.7262 |
10800 |
0.0156 |
- |
- |
0.7330 |
10900 |
0.0232 |
- |
- |
0.7397 |
11000 |
0.0146 |
0.7610 |
- |
0.7464 |
11100 |
0.0165 |
- |
- |
0.7531 |
11200 |
0.0187 |
- |
- |
0.7599 |
11300 |
0.0199 |
- |
- |
0.7666 |
11400 |
0.0215 |
- |
- |
0.7733 |
11500 |
0.0222 |
- |
- |
0.7800 |
11600 |
0.021 |
- |
- |
0.7868 |
11700 |
0.0163 |
- |
- |
0.7935 |
11800 |
0.0192 |
- |
- |
0.8002 |
11900 |
0.0206 |
- |
- |
0.8069 |
12000 |
0.017 |
0.7658 |
- |
0.8137 |
12100 |
0.0152 |
- |
- |
0.8204 |
12200 |
0.0175 |
- |
- |
0.8271 |
12300 |
0.0211 |
- |
- |
0.8338 |
12400 |
0.0162 |
- |
- |
0.8406 |
12500 |
0.0178 |
- |
- |
0.8473 |
12600 |
0.0142 |
- |
- |
0.8540 |
12700 |
0.02 |
- |
- |
0.8607 |
12800 |
0.0166 |
- |
- |
0.8675 |
12900 |
0.0187 |
- |
- |
0.8742 |
13000 |
0.017 |
0.7603 |
- |
0.8809 |
13100 |
0.0167 |
- |
- |
0.8876 |
13200 |
0.0211 |
- |
- |
0.8944 |
13300 |
0.0162 |
- |
- |
0.9011 |
13400 |
0.0161 |
- |
- |
0.9078 |
13500 |
0.0157 |
- |
- |
0.9145 |
13600 |
0.016 |
- |
- |
0.9213 |
13700 |
0.0139 |
- |
- |
0.9280 |
13800 |
0.0175 |
- |
- |
0.9347 |
13900 |
0.0172 |
- |
- |
0.9414 |
14000 |
0.0148 |
0.7554 |
- |
0.9482 |
14100 |
0.0227 |
- |
- |
0.9549 |
14200 |
0.0174 |
- |
- |
0.9616 |
14300 |
0.0191 |
- |
- |
0.9683 |
14400 |
0.0151 |
- |
- |
0.9751 |
14500 |
0.0184 |
- |
- |
0.9818 |
14600 |
0.02 |
- |
- |
0.9885 |
14700 |
0.0163 |
- |
- |
0.9952 |
14800 |
0.0141 |
- |
- |
1.0 |
14871 |
- |
- |
0.7116 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.0.1
- Transformers: 4.42.4
- PyTorch: 2.4.0+cu121
- Accelerate: 0.34.0
- Datasets: 2.21.0
- Tokenizers: 0.19.1
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}
}