Sentence Similarity
sentence-transformers
Safetensors
deberta-v2
feature-extraction
dense
Generated from Trainer
dataset_size:44114
loss:ContrastiveLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use laura2243/deberta-sota with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use laura2243/deberta-sota with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("laura2243/deberta-sota") sentences = [ "The Sadrist movement left the Alliance before the elections in December 2005 , which also brought the Iraqi National Congress more firmly to the Alliance .", "The Iraqi National Congress left the Alliance before the December 2005 elections , which also brought the Sadrist movement more to the Alliance .", "He pioneered important developments in the style of sculpting in wood , parallel to those driven by Filippo Parodi in marble sculpture and Domenico Piola in painting .", "The Mine South Deep is a large mine in the northern part of Gauteng in South Africa ." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:44114
- loss:ContrastiveLoss
widget:
- source_sentence: >-
The Sadrist movement left the Alliance before the elections in December
2005 , which also brought the Iraqi National Congress more firmly to the
Alliance .
sentences:
- >-
The Iraqi National Congress left the Alliance before the December 2005
elections , which also brought the Sadrist movement more to the Alliance
.
- >-
He pioneered important developments in the style of sculpting in wood ,
parallel to those driven by Filippo Parodi in marble sculpture and
Domenico Piola in painting .
- >-
The Mine South Deep is a large mine in the northern part of Gauteng in
South Africa .
- source_sentence: >-
Mike Monroney was challenged by A.S. Thomas in the Democratic Prefix in
1950 .
sentences:
- was challenged in 1950 by A.S. Mike Monroney in the Democratic Primary .
- >-
The T helper cells then activate the B cells , which are also in the
presence of these antigens , causing the production of autoantibodies .
- >-
Illinois Route 158 , or Washington Avenue , leads west to Columbia and
east to Belleville .
- source_sentence: >-
Morrow can mean either the next day in particular or the future in general
.
sentences:
- >-
Brockton is located approximately 25 miles northeast of Providence ,
Rhode Island and 30 miles south of Boston .
- >-
He had been in the state playing for Melbourne , but moved to Victoria
in 1925 and appointed New Town .
- >-
Morrow can either mean the next day in general , or the future in
particular .
- source_sentence: >-
Fotbal Club Forex Braşov was a Romanian professional club from Braşov ,
Romania , who was founded in October 2002 and was dissolved in 2011 .
sentences:
- >-
Fotbal Club Forex Braşov was a Romanian professional club from Braşov ,
Romania , which was dissolved in October 2002 and was founded in 2011 .
- Nate decides to struggle for Ricky and confirms his love for her .
- >-
Ricardo Lingan Baccay was ordained a priest on April 10 , 1987 by
Diosdado Aenlle Talamayan .
- source_sentence: He was born in July 1973 in Petroupoli ( Athens ) .
sentences:
- >-
Carmen Aub Romero ( born October 24 , 1989 in Mexico City , DF , Mexico
) is a Mexican actress .
- He was born in Athens in July 1973 ( Petroupoli ) .
- >-
At the age of nine , Garcia appeared in his first concert and since then
has appeared alone or with his aunt and his uncle in all parts of France
.
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy
- cosine_accuracy_threshold
- cosine_f1
- cosine_f1_threshold
- cosine_precision
- cosine_recall
- cosine_ap
- cosine_mcc
model-index:
- name: SentenceTransformer
results:
- task:
type: binary-classification
name: Binary Classification
dataset:
name: paws val deberta
type: paws-val-deberta
metrics:
- type: cosine_accuracy
value: 0.9121457489878543
name: Cosine Accuracy
- type: cosine_accuracy_threshold
value: 0.8481842279434204
name: Cosine Accuracy Threshold
- type: cosine_f1
value: 0.9024280575539567
name: Cosine F1
- type: cosine_f1_threshold
value: 0.8432618379592896
name: Cosine F1 Threshold
- type: cosine_precision
value: 0.8860927152317881
name: Cosine Precision
- type: cosine_recall
value: 0.9193770041227668
name: Cosine Recall
- type: cosine_ap
value: 0.9503471324249102
name: Cosine Ap
- type: cosine_mcc
value: 0.8230430822451054
name: Cosine Mcc
SentenceTransformer
This is a sentence-transformers model trained. 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
- Maximum Sequence Length: 64 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 64, 'do_lower_case': False, 'architecture': 'DebertaV2Model'})
(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
# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
'He was born in July 1973 in Petroupoli ( Athens ) .',
'He was born in Athens in July 1973 ( Petroupoli ) .',
'At the age of nine , Garcia appeared in his first concert and since then has appeared alone or with his aunt and his uncle in all parts of France .',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.9386, 0.5843],
# [0.9386, 1.0000, 0.5614],
# [0.5843, 0.5614, 1.0000]])
Evaluation
Metrics
Binary Classification
- Dataset:
paws-val-deberta - Evaluated with
BinaryClassificationEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy | 0.9121 |
| cosine_accuracy_threshold | 0.8482 |
| cosine_f1 | 0.9024 |
| cosine_f1_threshold | 0.8433 |
| cosine_precision | 0.8861 |
| cosine_recall | 0.9194 |
| cosine_ap | 0.9503 |
| cosine_mcc | 0.823 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 44,114 training samples
- Columns:
sentence_0,sentence_1, andlabel - Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 label type string string float details - min: 8 tokens
- mean: 25.39 tokens
- max: 47 tokens
- min: 8 tokens
- mean: 25.47 tokens
- max: 45 tokens
- min: 0.0
- mean: 0.48
- max: 1.0
- Samples:
sentence_0 sentence_1 label The Song of Ceylon is a 1934 British documentary film produced by Basil Wright and directed by John Grierson for the Ceylon Tea Propaganda Board .The Song of Ceylon is a British documentary film directed by Basil Wright by John Grierson for the Ceylon Tea Propaganda Board in 1934 .0.0The two leased aircraft were returned to the BAE Systems lessor on 9 November 2006 .Centavia 's two leased aircraft were returned to the lessor , BAE Systems , on November 9 , 2006 .1.0When , in 1818 , Ortona was assigned to Lanciano , Campli was joined to the diocese of Teramo .When Ortona was assigned to Lanciano in 1818 , Campli was connected to the Diocese of Teramo .1.0 - Loss:
ContrastiveLosswith these parameters:{ "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 0.5, "size_average": true }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 2multi_dataset_batch_sampler: round_robin
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 2max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Falsebf16: Falsefp16: Falsefp16_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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | paws-val-deberta_cosine_ap |
|---|---|---|---|
| 0.1813 | 500 | 0.0314 | - |
| 0.3626 | 1000 | 0.023 | - |
| 0.5439 | 1500 | 0.0188 | - |
| 0.7252 | 2000 | 0.0161 | - |
| 0.9065 | 2500 | 0.0148 | - |
| 1.0 | 2758 | - | 0.9361 |
| 1.0877 | 3000 | 0.0121 | - |
| 1.2690 | 3500 | 0.0107 | - |
| 1.4503 | 4000 | 0.01 | - |
| 1.6316 | 4500 | 0.0098 | - |
| 1.8129 | 5000 | 0.0094 | - |
| 1.9942 | 5500 | 0.0091 | - |
| 2.0 | 5516 | - | 0.9503 |
Framework Versions
- Python: 3.12.12
- Sentence Transformers: 5.2.0
- Transformers: 4.57.3
- PyTorch: 2.9.0+cu126
- Accelerate: 1.12.0
- Datasets: 4.0.0
- Tokenizers: 0.22.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",
}
ContrastiveLoss
@inproceedings{hadsell2006dimensionality,
author={Hadsell, R. and Chopra, S. and LeCun, Y.},
booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
title={Dimensionality Reduction by Learning an Invariant Mapping},
year={2006},
volume={2},
number={},
pages={1735-1742},
doi={10.1109/CVPR.2006.100}
}