---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:3012496
- loss:MultipleNegativesRankingLoss
base_model: nreimers/MiniLM-L6-H384-uncased
datasets:
- sentence-transformers/gooaq
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy@1
- cosine_accuracy@3
- cosine_accuracy@5
- cosine_accuracy@10
- cosine_precision@1
- cosine_precision@3
- cosine_precision@5
- cosine_precision@10
- cosine_recall@1
- cosine_recall@3
- cosine_recall@5
- cosine_recall@10
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@100
co2_eq_emissions:
emissions: 22.281960304608415
energy_consumed: 0.05732401763975595
source: codecarbon
training_type: fine-tuning
on_cloud: false
cpu_model: 13th Gen Intel(R) Core(TM) i7-13700K
ram_total_size: 31.777088165283203
hours_used: 0.212
hardware_used: 1 x NVIDIA GeForce RTX 3090
model-index:
- name: MPNet base trained on AllNLI triplets
results:
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: gooaq dev
type: gooaq-dev
metrics:
- type: cosine_accuracy@1
value: 0.1588
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.2785
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.3457
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.4466
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.1588
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.09283333333333332
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.06914
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.04466
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.1588
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.2785
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.3457
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.4466
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.2881970902221442
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.23927892857142846
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.2521367709898081
name: Cosine Map@100
---
# MPNet base trained on AllNLI triplets
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [nreimers/MiniLM-L6-H384-uncased](https://huggingface.co/nreimers/MiniLM-L6-H384-uncased) on the [gooaq](https://huggingface.co/datasets/sentence-transformers/gooaq) 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:** [nreimers/MiniLM-L6-H384-uncased](https://huggingface.co/nreimers/MiniLM-L6-H384-uncased)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 384 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [gooaq](https://huggingface.co/datasets/sentence-transformers/gooaq)
- **Language:** en
- **License:** apache-2.0
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, '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})
(asym): Asym(
(query-0): Dense({'in_features': 384, 'out_features': 384, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
(doc-0): Dense({'in_features': 384, 'out_features': 384, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
)
)
```
## 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("tomaarsen/MiniLM-L6-H384-uncased-gooaq-asym")
# Run inference
sentences = [
'The weather is lovely today.',
"It's so sunny outside!",
'He drove to the stadium.',
]
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]
```
## Evaluation
### Metrics
#### Information Retrieval
* Dataset: `gooaq-dev`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@1 | 0.1588 |
| cosine_accuracy@3 | 0.2785 |
| cosine_accuracy@5 | 0.3457 |
| cosine_accuracy@10 | 0.4466 |
| cosine_precision@1 | 0.1588 |
| cosine_precision@3 | 0.0928 |
| cosine_precision@5 | 0.0691 |
| cosine_precision@10 | 0.0447 |
| cosine_recall@1 | 0.1588 |
| cosine_recall@3 | 0.2785 |
| cosine_recall@5 | 0.3457 |
| cosine_recall@10 | 0.4466 |
| **cosine_ndcg@10** | **0.2882** |
| cosine_mrr@10 | 0.2393 |
| cosine_map@100 | 0.2521 |
## Training Details
### Training Dataset
#### gooaq
* Dataset: [gooaq](https://huggingface.co/datasets/sentence-transformers/gooaq) at [b089f72](https://huggingface.co/datasets/sentence-transformers/gooaq/tree/b089f728748a068b7bc5234e5bcf5b25e3c8279c)
* Size: 3,012,496 training samples
* Columns: question
and answer
* Approximate statistics based on the first 1000 samples:
| | question | answer |
|:--------|:-------------------|:-------------------|
| type | dict | dict |
| details |
{'query': 'what is the difference between broilers and layers?'}
| {'doc': 'An egg laying poultry is called egger or layer whereas broilers are reared for obtaining meat. So a layer should be able to produce more number of large sized eggs, without growing too much. On the other hand, a broiler should yield more meat and hence should be able to grow well.'}
|
| {'query': 'what is the difference between chronological order and spatial order?'}
| {'doc': 'As a writer, you should always remember that unlike chronological order and the other organizational methods for data, spatial order does not take into account the time. Spatial order is primarily focused on the location. All it does is take into account the location of objects and not the time.'}
|
| {'query': 'is kamagra same as viagra?'}
| {'doc': 'Kamagra is thought to contain the same active ingredient as Viagra, sildenafil citrate. In theory, it should work in much the same way as Viagra, taking about 45 minutes to take effect, and lasting for around 4-6 hours. However, this will vary from person to person.'}
|
* Loss: [MultipleNegativesRankingLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Evaluation Dataset
#### gooaq
* Dataset: [gooaq](https://huggingface.co/datasets/sentence-transformers/gooaq) at [b089f72](https://huggingface.co/datasets/sentence-transformers/gooaq/tree/b089f728748a068b7bc5234e5bcf5b25e3c8279c)
* Size: 3,012,496 evaluation samples
* Columns: question
and answer
* Approximate statistics based on the first 1000 samples:
| | question | answer |
|:--------|:-------------------|:-------------------|
| type | dict | dict |
| details | {'query': 'how do i program my directv remote with my tv?'}
| {'doc': "['Press MENU on your remote.', 'Select Settings & Help > Settings > Remote Control > Program Remote.', 'Choose the device (TV, audio, DVD) you wish to program. ... ', 'Follow the on-screen prompts to complete programming.']"}
|
| {'query': 'are rodrigues fruit bats nocturnal?'}
| {'doc': 'Before its numbers were threatened by habitat destruction, storms, and hunting, some of those groups could number 500 or more members. Sunrise, sunset. Rodrigues fruit bats are most active at dawn, at dusk, and at night.'}
|
| {'query': 'why does your heart rate increase during exercise bbc bitesize?'}
| {'doc': 'During exercise there is an increase in physical activity and muscle cells respire more than they do when the body is at rest. The heart rate increases during exercise. The rate and depth of breathing increases - this makes sure that more oxygen is absorbed into the blood, and more carbon dioxide is removed from it.'}
|
* Loss: [MultipleNegativesRankingLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 128
- `per_device_eval_batch_size`: 128
- `learning_rate`: 2e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `seed`: 24
- `bf16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters