CoolFace
Modelpublic

ejun26/minilm-mrpc-clean-retrieval

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes76downloads
Model Card

SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2 on the nyu-mll/glue dataset. It maps sentences & paragraphs to a 384-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: sentence-transformers/all-MiniLM-L6-v2 <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 tokens
  • Similarity Function: Cosine Similarity
  • Training Dataset:
  • nyu-mll/glue
  • Language: en <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, '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})
  (2): Normalize()
)

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("ejun26/minilm-mrpc-clean-retrieval")
# Run inference
sentences = [
    'In a statement later , he said it appeared his side may have fallen a bit short .',
    'Zilkha conceded in a statement issued today that his group may have fallen " a bit short . "',
    "U.S. law enforcement officials are sneering at Dar Heatherington 's version of of the events -- including a police conspiracy to discredit her -- which thrust her into the public spotlight .",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# 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

Clean Information Retrieval
  • Dataset: mrpc-validation-clean-v2
  • Evaluated with <code>models.evaluator.CleanInformationRetrievalEvaluator</code>
MetricValue
cosine_accuracy@10.0
cosine_accuracy@31.0
cosine_accuracy@51.0
cosine_accuracy@101.0
cosine_precision@10.0
cosine_precision@30.3357
cosine_precision@50.2014
cosine_precision@100.1007
cosine_recall@10.0
cosine_recall@31.0
cosine_recall@51.0
cosine_recall@101.0
cosine_ndcg@100.6309
cosine_mrr@100.4994
cosine_map@1000.5
dot_accuracy@10.0
dot_accuracy@31.0
dot_accuracy@51.0
dot_accuracy@101.0
dot_precision@10.0
dot_precision@30.3357
dot_precision@50.2014
dot_precision@100.1007
dot_recall@10.0
dot_recall@31.0
dot_recall@51.0
dot_recall@101.0
dot_ndcg@100.6309
dot_mrr@100.4994
dot_map@1000.5
Clean Information Retrieval
  • Dataset: mrpc-test-clean-v2
  • Evaluated with <code>models.evaluator.CleanInformationRetrievalEvaluator</code>
MetricValue
cosine_accuracy@10.0
cosine_accuracy@30.9799
cosine_accuracy@50.9895
cosine_accuracy@100.9965
cosine_precision@10.0
cosine_precision@30.3275
cosine_precision@50.1984
cosine_precision@100.0999
cosine_recall@10.0
cosine_recall@30.9799
cosine_recall@50.9891
cosine_recall@100.9961
cosine_ndcg@100.623
cosine_mrr@100.4912
cosine_map@1000.4915
dot_accuracy@10.0
dot_accuracy@30.9799
dot_accuracy@50.9895
dot_accuracy@100.9965
dot_precision@10.0
dot_precision@30.3275
dot_precision@50.1984
dot_precision@100.0999
dot_recall@10.0
dot_recall@30.9799
dot_recall@50.9891
dot_recall@100.9961
dot_ndcg@100.623
dot_mrr@100.4912
dot_map@1000.4915

<!--

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

nyu-mll/glue
  • Dataset: nyu-mll/glue at bcdcba7
  • Size: 3,668 training samples
  • Columns: <code>text1</code>, <code>text2</code>, and <code>label</code>
  • Approximate statistics based on the first 1000 samples: | | text1 | text2 | label | |:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 9 tokens</li><li>mean: 27.16 tokens</li><li>max: 47 tokens</li></ul> | <ul><li>min: 11 tokens</li><li>mean: 26.88 tokens</li><li>max: 49 tokens</li></ul> | <ul><li>0: ~33.70%</li><li>1: ~66.30%</li></ul> |
  • Samples: | text1 | text2 | label | |:-----------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:---------------| | <code>Amrozi accused his brother , whom he called " the witness " , of deliberately distorting his evidence .</code> | <code>Referring to him as only " the witness " , Amrozi accused his brother of deliberately distorting his evidence .</code> | <code>1</code> | | <code>Yucaipa owned Dominick 's before selling the chain to Safeway in 1998 for $ 2.5 billion .</code> | <code>Yucaipa bought Dominick 's in 1995 for $ 693 million and sold it to Safeway for $ 1.8 billion in 1998 .</code> | <code>0</code> | | <code>They had published an advertisement on the Internet on June 10 , offering the cargo for sale , he added .</code> | <code>On June 10 , the ship 's owners had published an advertisement on the Internet , offering the explosives for sale .</code> | <code>1</code> |
  • Loss: <code>OnlineContrastiveLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • learning_rate: 2e-05
  • num_train_epochs: 5
  • warmup_ratio: 0.1
  • load_best_model_at_end: True
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: 32
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • learning_rate: 2e-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: 5
  • 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: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • 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: 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
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining Lossmrpc-test-clean-v2_cosine_map@100mrpc-validation-clean-v2_cosine_map@100
00--0.4961
0.0870101.6166--
0.1739201.668--
0.2609301.5081--
0.3478401.3996--
0.4348501.2969-0.4985
0.5217601.1771--
0.6087700.9977--
0.6957801.1213--
0.7826901.139--
0.86961001.0821-0.5
0.95651101.1488--
1.04351200.932--
1.13041300.794--
1.21741400.9996--
1.30431500.9328-0.5
1.39131601.1032--
1.47831700.9692--
1.56521800.9501--
1.65221900.7863--
1.73912000.8454-0.5
1.82612100.9311--
1.91302200.8134--
2.02301.0013--
2.08702400.7564--
2.17392500.9165-0.5
2.26092600.7668--
2.34782700.6587--
2.43482800.5904--
2.52172900.7431--
2.60873000.6133-0.5
2.69573100.5994--
2.78263200.6256--
2.86963300.7294--
2.95653400.7527--
3.04353500.6908-0.5
3.13043600.6455--
3.21743700.3765--
3.30433800.5955--
3.39133900.6239--
3.47834000.6666-0.5
3.56524100.6498--
3.65224200.6363--
3.73914300.7046--
3.82614400.4384--
3.91304500.6721-0.5
4.04600.5341--
4.08704700.4459--
4.17394800.4153--
4.26094900.5116--
4.34785000.4221-0.5
4.43485100.4696--
4.52175200.4552--
4.60875300.5403--
4.69575400.367--
4.78265500.3275-0.5
4.86965600.4016--
4.95655700.4889--
5.0575-0.4915-
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.12.12
  • Sentence Transformers: 3.0.1
  • Transformers: 4.41.0
  • PyTorch: 2.2.2+cu121
  • Accelerate: 1.12.0
  • Datasets: 3.3.2
  • Tokenizers: 0.19.1

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",
}

<!--

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