CoolFace
Modelpublic

panalexeu/xlm-roberta-ua-distilled

sourceHugging Facemitupdated 1y agoView on Hugging Face
2likes99downloads
Model Card

SentenceTransformer based on FacebookAI/xlm-roberta-base

This is a sentence-transformers model finetuned from FacebookAI/xlm-roberta-base. 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.

👉 Check out the model on GitHub.

Model Details

Model Description

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel 
  (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("panalexeu/xlm-roberta-ua-distilled")
# Run inference
sentences = [
    "You'd better consult the doctor.",
    'Краще проконсультуйся у лікаря.',
    'Їх позначають як Aufklärungsfahrzeug 93 та Aufklärungsfahrzeug 97 відповідно.',
]
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. -->

Evaluation

Metrics

Knowledge Distillation
MetricValue
negative_mse-1.1089
Semantic Similarity
Metricsts17-en-ensts17-en-uasts17-ua-ua
pearson_cosine0.67850.59260.6159
spearman_cosine0.73080.61980.6446

<!--

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

  • —Dataset: parallel-sentences-talks, parallel-sentences-wikimatrix, parallel-sentences-tatoeba
  • —Size: 523,982 training samples
  • —Columns: <code>english</code>, <code>non_english</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | english | non_english | label | |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-------------------------------------| | type | string | string | list | | details | <ul><li>min: 5 tokens</li><li>mean: 21.11 tokens</li><li>max: 254 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 23.15 tokens</li><li>max: 293 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
  • —Samples: | english | non_english | label | |:----------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------| | <code>Her real name is Lydia (リディア, Ridia), but she was mistaken for a boy and called Ricard.</code> | <code>Справжнє ім'я — Лідія, але її помилково сприйняли за хлопчика і назвали Рікард.</code> | <code>[0.15217968821525574, -0.17830222845077515, -0.12677159905433655, 0.22082313895225525, 0.40085524320602417, ...]</code> | | <code>(Applause) So he didn't just learn water.</code> | <code>(Аплодисменти) Він не тільки вивчив слово "вода".</code> | <code>[-0.1058148592710495, -0.08846072107553482, -0.2684604823589325, -0.105219267308712, 0.3050258755683899, ...]</code> | | <code>It is tightly integrated with SAM, the Storage and Archive Manager, and hence is often referred to as SAM-QFS.</code> | <code>Вона тісно інтегрована з SAM (Storage and Archive Manager), тому часто називається SAM-QFS.</code> | <code>[0.03270340710878372, -0.45798248052597046, -0.20090211927890778, 0.006579531356692314, -0.03178019821643829, ...]</code> |
  • —Loss: <code>MSELoss</code>

Evaluation Dataset

  • —Dataset: parallel-sentences-talks, parallel-sentences-wikimatrix, parallel-sentences-tatoeba
  • —Size: 3,838 evaluation samples
  • —Columns: <code>english</code>, <code>non_english</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | english | non_english | label | |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-------------------------------------| | type | string | string | list | | details | <ul><li>min: 5 tokens</li><li>mean: 15.64 tokens</li><li>max: 143 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 16.98 tokens</li><li>max: 148 tokens</li></ul> | <ul><li>size: 768 elements</li></ul> |
  • —Samples: | english | non_english | label | |:---------------------------------------------------------|:-----------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------| | <code>I have lost my wallet.</code> | <code>Я загубив гаманець.</code> | <code>[-0.11186987161636353, -0.03419225662946701, -0.31304317712783813, 0.0838347002863884, 0.108644500374794, ...]</code> | | <code>It's a pharmaceutical product.</code> | <code>Це фармацевтичний продукт.</code> | <code>[0.04133488982915878, -0.4182000756263733, -0.30786487460136414, -0.09351564198732376, -0.023946482688188553, ...]</code> | | <code>We've all heard of the Casual Friday thing.</code> | <code>Всі ми чули про «джинсову п’ятницю» (вільна форма одягу).</code> | <code>[-0.10697802156209946, 0.21002227067947388, -0.2513434886932373, -0.3718843460083008, 0.06871984899044037, ...]</code> |
  • —Loss: <code>MSELoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —gradient_accumulation_steps: 3
  • —num_train_epochs: 4
  • —warmup_ratio: 0.1
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: 3
  • —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: False
  • —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}
  • —tp_size: 0
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: None
  • —hub_always_push: False
  • —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
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: False
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining LossValidation Lossmse-en-ua_negative_msests17-en-en_spearman_cosinests17-en-ua_spearman_cosinests17-ua-ua_spearman_cosine
0.093810240.32810.0297-2.95920.23250.15470.2265
0.187620480.11360.2042-21.66930.05530.04290.2442
0.281430720.10080.0273-2.74610.26660.07580.2613
0.375240960.08430.0243-2.46230.25410.00120.3680
0.469051200.07560.0216-2.20950.39330.25350.4342
0.562861440.06610.0187-1.95390.57390.42220.5056
0.656671680.05790.0164-1.75130.61840.48970.5826
0.750481920.05260.0153-1.65460.62190.45680.5842
0.844292160.04880.0142-1.55250.61600.50120.5884
0.9380102400.0460.0135-1.49570.63610.50460.5969
1.0318112640.04370.0130-1.45060.64530.50930.5939
1.1256122880.04190.0125-1.40490.64030.50540.6020
1.2194133120.04040.0122-1.37940.66540.54420.6182
1.3132143360.03940.0118-1.34340.68000.57900.6291
1.4070153600.03830.0115-1.31840.68360.58050.6301
1.5008163840.03750.0114-1.30670.67420.55550.6055
1.5946174080.03680.0111-1.28640.69090.57650.6256
1.6884184320.0360.0109-1.26330.68750.58010.6178
1.7822194560.03530.0107-1.24900.70600.59590.6322
1.8760204800.0350.0106-1.23570.71270.60470.6389
1.9698215040.03440.0105-1.22650.72650.62330.6459
2.0636225280.03350.0103-1.21080.71840.61510.6438
2.1574235520.03270.0103-1.21010.71220.60740.6427
2.2512245760.03240.0102-1.19720.72320.61740.6447
2.3450256000.03220.0100-1.18130.72170.61660.6457
2.4388266240.0320.0099-1.17450.73080.62720.6534
2.5326276480.03160.0098-1.16730.72890.61250.6441
2.6264286720.03140.0098-1.16220.72220.61050.6365
2.7202296960.03120.0097-1.15930.71750.61210.6348
2.8140307200.03080.0096-1.14570.72040.60440.6377
2.9078317440.03070.0095-1.14110.72300.61750.6353
3.0016327680.03050.0095-1.14140.71300.60520.6340
3.0954337920.02960.0095-1.13600.72340.61600.6411
3.1892348160.02950.0094-1.13170.72200.61310.6396
3.2830358400.02940.0094-1.13060.73150.61670.6505
3.3768368640.02930.0094-1.12630.72190.60890.6450
3.4706378880.02920.0093-1.12250.72360.61410.6451
3.5644389120.02910.0093-1.12040.73310.61790.6460
3.6582399360.0290.0092-1.11470.72260.61270.6406
3.7520409600.0290.0092-1.11180.72450.61840.6425
3.8458419840.02890.0092-1.11020.72790.61790.6465
3.9396430080.02880.0092-1.10990.72980.61910.6438
3.999743664-0.0092-1.10890.73080.61980.6446

Framework Versions

  • —Python: 3.11.11
  • —Sentence Transformers: 3.4.1
  • —Transformers: 4.51.1
  • —PyTorch: 2.5.1+cu124
  • —Accelerate: 1.3.0
  • —Datasets: 3.5.0
  • —Tokenizers: 0.21.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",
}
MSELoss
bibtex
@inproceedings{reimers-2020-multilingual-sentence-bert,
    title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2020",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/2004.09813",
}

<!--

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. -->