SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for retrieval.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/all-MiniLM-L6-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)
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("RinKana/all-MiniLM-L6-v2-iran-VS-USA-news")
# Run inference
sentences = [
'Iran Trump 2026',
'US intercepts and seizes Iranian-flagged cargo ship, Trump says | The US has intercepted an Iranian-flagged cargo ship in the Gulf as part of its naval blockade, Donald Trump has said.\n\nThe US president wrote on his Truth Social platform that the Touska was seized by the US Navy after failing to respond to a warning to stop. Iran said it was a violation of the ceasefire and it would retaliate soon for the "act of armed piracy".\n\nThe announcement came after the White House confirmed US Vice-President JD Vance would lead another delegation for a second round of talks on ending the war with Iran in Pakistan.\n\nTehran has not yet confirmed its attendance. Iranian state media has reported that officials will not participate while the US blockade remains in place.\n\n"Today, an Iranian-flagged cargo ship named TOUSKA, nearly 900 feet long and weighing almost as much as an aircraft carrier, tried to get past our Naval Blockade, and it did not go well for them," Trump wrote.\n\nHe added that the US had given the vessel fair warning to stop, which was ignored, "so our Navy ship stopped them right in their tracks by blowing a hole in the engineroom".\n\n"The TOUSKA is under US Treasury Sanctions because of their prior history of illegal activity. We have full custody of the ship, and are seeing what\'s on board!"\n\nUS Central Command later released footage it said showed a naval vessel intercepting a cargo ship. In the footage, a gun can be seen firing in the direction of the cargo ship.\n\nAccording to a statement carried on state media outlets, a spokesperson for Iran\'s top military headquarters, Khatam al-Anbiya, said the US in "violation of the ceasefire opened fire on one of Iran\'s commercial vessels in the waters of the Sea of Oman, disabled its navigation system, and boarded it" by "deploying" marines.\n\n"Armed Forces of the Islamic Republic of Iran will soon respond to and retaliate for this act of armed piracy by the US Navy," reads the statement.\n\nTrump said on Friday that the naval blockade of Iranian ports would continue until a deal was agreed by the two countries.\n\nThe conflict began with US and Israeli strikes across Iran on 28 February and continued with waves of attacks across the Middle East for five weeks until a two-week truce was declared.',
'UKIP sorry for PC Ali Hassan death \'karma\' tweet | UKIP has apologised for a tweet which said the death of a police officer under investigation in relation to the Rotherham abuse scandal was "karma".\n\nThe tweet from @PlymouthUKIP said: "South Yorkshire police says PC Hassan Ali who was under investigation in relation to child abuse in Rotherham has died in a car crash KARMA!"\n\nPC Ali, 44, died in hospital nine days after he was hit by a car in Sheffield.\n\nA UKIP spokesman said the tweeter had been rebuked.\n\nMr Ali was being investigated by the Independent Police Complaints Commission (IPCC) over allegations made about him, the BBC understands.\n\nSouth Yorkshire Police said his death was being treated as a "tragic accident". Officers are continuing to investigate the collision.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.5469, 0.3149],
# [0.5469, 1.0000, 0.4410],
# [0.3149, 0.4410, 1.0000]])
Evaluation
Metrics
Information Retrieval
- Dataset:
val-ir - Evaluated with InformationRetrievalEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.0568 |
| cosine_accuracy@3 | 0.1703 |
| cosine_accuracy@5 | 0.2533 |
| cosine_accuracy@10 | 0.4454 |
| cosine_precision@1 | 0.0568 |
| cosine_precision@3 | 0.0568 |
| cosine_precision@5 | 0.0507 |
| cosine_precision@10 | 0.0445 |
| cosine_recall@1 | 0.0568 |
| cosine_recall@3 | 0.1703 |
| cosine_recall@5 | 0.2533 |
| cosine_recall@10 | 0.4454 |
| cosine_ndcg@10 | 0.2169 |
| cosine_mrr@10 | 0.1484 |
| cosine_map@100 | 0.1705 |
Training Details
It's trained by Iran vs USA COnflict News Dataset by doing Train/Val: 90/10 in this dataset.
Training Dataset
Iran vs USA Conflict News Dataset source:https://www.kaggle.com/datasets/solowpm23/iran-vs-us-coflict-news-dataset
Unnamed Dataset
-
Size: 2,057 training samples
-
Columns: sentence_0 and sentence_1
-
Approximate statistics based on the first 1000 samples:
sentence_0 sentence_1 type string string details min: 4 tokensmean: 6.31 tokensmax: 8 tokens min: 45 tokensmean: 223.76 tokensmax: 256 tokens -
Samples:
sentence_0 sentence_1 Iran Israel war 2025 Israel warns Iran after launching major raids in Syria | Israeli PM Benjamin Netanyahu says his country will defend itself "against any attack" after carrying out what appear to be its largest strikes on sites in Syria in decades.Israel launched raids against Iranian targets after saying it had intercepted an Iranian drone crossing the Syria-Israel border.Iran denies the allegation.During the offensive an Israeli F-16 fighter jet was shot down by Syria air defences, crashing in northern Israel.Its pilots ejected from the plane and were taken to hospital.It is believed to be the first time Israel has lost a jet in combat since 2006.Mr Netanyahu warned that Israel's policy to defend itself against "any attempt to harm our sovereignty" was "absolutely clear"."Iran brazenly violated Israel's sovereignty," he said, adding: "They dispatched an Iranian drone from Syrian territory into Israel... Israel holds Iran and its Syrian hosts responsible." Iran oil blockade Cuba confirms negotiations with US as country faces effects of oil blockade Díaz-Canel said no fuel had entered Cuba in three months.
Talks between the two nations were in their initial stages, said Díaz-Canel, who is leading the Cuban side of negotiations, in a national broadcast on Friday.
US President Donald Trump said on Monday that Cuba was in "deep trouble" as he threatened a "friendly takeover".
Cuba is experiencing several blackouts as the island struggles with fuel shortages, which have been made worse by pressure from the US.
Since returning to the White House, Trump has made clear his desire to change Cuba's leadership. He has also threatened tariffs on goods imported into the US from any country that gives Cuba oil.
The White House tol... | | rss | Settebello: Three Indian sailors killed in US strike on tanker in Gulf of Oman | As Trump turns 80, what's it really like to work as an octogenarian?As President Donald Trump celebrates his birthday, we ask people who have worked into their 80s themselves about what it takes to keep going. |
-
Loss: MultipleNegativesRankingLoss with these parameters:
{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
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
do_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16gradient_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: Nonewarmup_ratio: Nonewarmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_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: Nonegroup_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: Truepush_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_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_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: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | val-ir_cosine_ndcg@10 |
|---|---|---|
| 0.7692 | 50 | 0.2048 |
| 1.0 | 65 | 0.2128 |
| 1.5385 | 100 | 0.2116 |
| 2.0 | 130 | 0.2169 |
Training Time
- Training: 43.5 seconds
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.4.1
- Transformers: 5.0.0
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0
- Datasets: 5.0.0
- Tokenizers: 0.22.2
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{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}