---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- sparse-encoder
- sparse
- splade
- generated_from_trainer
- dataset_size:5749
- loss:SpladeLoss
- loss:SparseCosineSimilarityLoss
- loss:FlopsLoss
base_model: naver/splade-cocondenser-ensembledistil
widget:
- text: There is no 'still' that is not relative to some other object.
- text: A woman is adding oil on fishes.
- text: Minimum wage laws hurt the least skilled, least productive the most.
- text: Although I believe Searle is mistaken, I don't think you have found the problem.
- text: A man plays the guitar.
datasets:
- sentence-transformers/stsb
pipeline_tag: feature-extraction
library_name: sentence-transformers
metrics:
- pearson_cosine
- spearman_cosine
- active_dims
- sparsity_ratio
co2_eq_emissions:
emissions: 0.004571308812647019
energy_consumed: 0.0019229652366223092
source: codecarbon
training_type: fine-tuning
on_cloud: false
cpu_model: AMD Ryzen 9 6900HX with Radeon Graphics
ram_total_size: 30.6114501953125
hours_used: 0.016
hardware_used: 1 x NVIDIA GeForce RTX 3070 Ti Laptop GPU
model-index:
- name: 'splade-cocondenser-ensembledistil trained on '
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev
type: sts-dev
metrics:
- type: pearson_cosine
value: 0.8760417145994235
name: Pearson Cosine
- type: spearman_cosine
value: 0.8704199278417449
name: Spearman Cosine
- type: active_dims
value: 49.305667877197266
name: Active Dims
- type: sparsity_ratio
value: 0.9983845859420353
name: Sparsity Ratio
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test
type: sts-test
metrics:
- type: pearson_cosine
value: 0.840843473698782
name: Pearson Cosine
- type: spearman_cosine
value: 0.8291534166645268
name: Spearman Cosine
- type: active_dims
value: 47.07070350646973
name: Active Dims
- type: sparsity_ratio
value: 0.9984578106445688
name: Sparsity Ratio
---
# splade-cocondenser-ensembledistil trained on
This is a [SPLADE Sparse Encoder](https://www.sbert.net/docs/sparse_encoder/usage/usage.html) model finetuned from [naver/splade-cocondenser-ensembledistil](https://huggingface.co/naver/splade-cocondenser-ensembledistil) on the [stsb](https://huggingface.co/datasets/sentence-transformers/stsb) dataset using the [sentence-transformers](https://www.SBERT.net) library. It maps sentences & paragraphs to a 30522-dimensional sparse vector space and can be used for semantic search and sparse retrieval.
## Model Details
### Model Description
- **Model Type:** SPLADE Sparse Encoder
- **Base model:** [naver/splade-cocondenser-ensembledistil](https://huggingface.co/naver/splade-cocondenser-ensembledistil)
- **Maximum Sequence Length:** 256 tokens
- **Output Dimensionality:** 30522 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [stsb](https://huggingface.co/datasets/sentence-transformers/stsb)
- **Language:** en
- **License:** apache-2.0
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Sparse Encoder Documentation](https://www.sbert.net/docs/sparse_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sparse Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=sparse-encoder)
### Full Model Architecture
```
SparseEncoder(
(0): MLMTransformer({'max_seq_length': 256, 'do_lower_case': False}) with MLMTransformer model: BertForMaskedLM
(1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', 'word_embedding_dimension': 30522})
)
```
## 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 SparseEncoder
# Download from the 🤗 Hub
model = SparseEncoder("arthurbresnu/splade-cocondenser-ensembledistil-sts")
# Run inference
sentences = [
'While Queen may refer to both Queen regent (sovereign) or Queen consort, the King has always been the sovereign.',
'There is a very good reason not to refer to the Queen\'s spouse as "King" - because they aren\'t the King.',
'A man plays the guitar.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# (3, 30522)
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Semantic Similarity
* Datasets: `sts-dev` and `sts-test`
* Evaluated with [SparseEmbeddingSimilarityEvaluator
](https://sbert.net/docs/package_reference/sparse_encoder/evaluation.html#sentence_transformers.sparse_encoder.evaluation.SparseEmbeddingSimilarityEvaluator)
| Metric | sts-dev | sts-test |
|:--------------------|:-----------|:-----------|
| pearson_cosine | 0.876 | 0.8408 |
| **spearman_cosine** | **0.8704** | **0.8292** |
| active_dims | 49.3057 | 47.0707 |
| sparsity_ratio | 0.9984 | 0.9985 |
## Training Details
### Training Dataset
#### stsb
* Dataset: [stsb](https://huggingface.co/datasets/sentence-transformers/stsb) at [ab7a5ac](https://huggingface.co/datasets/sentence-transformers/stsb/tree/ab7a5ac0e35aa22088bdcf23e7fd99b220e53308)
* Size: 5,749 training samples
* Columns: sentence1
, sentence2
, and score
* Approximate statistics based on the first 1000 samples:
| | sentence1 | sentence2 | score |
|:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
A plane is taking off.
| An air plane is taking off.
| 1.0
|
| A man is playing a large flute.
| A man is playing a flute.
| 0.76
|
| A man is spreading shreded cheese on a pizza.
| A man is spreading shredded cheese on an uncooked pizza.
| 0.76
|
* Loss: [SpladeLoss
](https://sbert.net/docs/package_reference/sparse_encoder/losses.html#spladeloss) with these parameters:
```json
{
"loss": "SparseCosineSimilarityLoss(loss_fct='torch.nn.modules.loss.MSELoss')",
"lambda_corpus": 0.003
}
```
### Evaluation Dataset
#### stsb
* Dataset: [stsb](https://huggingface.co/datasets/sentence-transformers/stsb) at [ab7a5ac](https://huggingface.co/datasets/sentence-transformers/stsb/tree/ab7a5ac0e35aa22088bdcf23e7fd99b220e53308)
* Size: 1,500 evaluation samples
* Columns: sentence1
, sentence2
, and score
* Approximate statistics based on the first 1000 samples:
| | sentence1 | sentence2 | score |
|:--------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details | A man with a hard hat is dancing.
| A man wearing a hard hat is dancing.
| 1.0
|
| A young child is riding a horse.
| A child is riding a horse.
| 0.95
|
| A man is feeding a mouse to a snake.
| The man is feeding a mouse to the snake.
| 1.0
|
* Loss: [SpladeLoss
](https://sbert.net/docs/package_reference/sparse_encoder/losses.html#spladeloss) with these parameters:
```json
{
"loss": "SparseCosineSimilarityLoss(loss_fct='torch.nn.modules.loss.MSELoss')",
"lambda_corpus": 0.003
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `learning_rate`: 4e-06
- `num_train_epochs`: 1
- `bf16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters