---
language:
- fr
tags:
- sentence-transformers
- sparse-encoder
- sparse
- splade
- generated_from_trainer
- dataset_size:12227
- loss:SpladeLoss
- loss:SparseCosineSimilarityLoss
- loss:FlopsLoss
base_model: EuroBERT/EuroBERT-210m
widget:
- text: Une femme, un petit garçon et un petit bébé se tiennent devant une statue
de vache.
- text: En anglais, l'utilisation la plus courante de do est certainement Do-Support.
- text: Je ne pense pas que la charge de la preuve repose sur des versions positives
ou négatives.
- text: Cinq lévriers courent sur une piste de sable.
- text: J'envisage de dépenser les 48 dollars par mois pour le système GTD (Getting
things done) annoncé par David Allen.
datasets:
- CATIE-AQ/frenchSTS
pipeline_tag: feature-extraction
library_name: sentence-transformers
metrics:
- pearson_cosine
- spearman_cosine
- active_dims
- sparsity_ratio
model-index:
- name: SPLADE Sparse Encoder
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts dev
type: sts-dev
metrics:
- type: pearson_cosine
value: 0.36927990368160857
name: Pearson Cosine
- type: spearman_cosine
value: 0.37469558585276597
name: Spearman Cosine
- type: active_dims
value: 11.744894981384277
name: Active Dims
- type: sparsity_ratio
value: 0.9999084261556466
name: Sparsity Ratio
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: sts test
type: sts-test
metrics:
- type: pearson_cosine
value: 0.35396199996568556
name: Pearson Cosine
- type: spearman_cosine
value: 0.3848714264523539
name: Spearman Cosine
- type: active_dims
value: 10.178544044494629
name: Active Dims
- type: sparsity_ratio
value: 0.9999206388469585
name: Sparsity Ratio
---
# SPLADE Sparse Encoder
This is a [SPLADE Sparse Encoder](https://www.sbert.net/docs/sparse_encoder/usage/usage.html) model finetuned from [EuroBERT/EuroBERT-210m](https://huggingface.co/EuroBERT/EuroBERT-210m) on the [french_sts](https://huggingface.co/datasets/CATIE-AQ/frenchSTS) dataset using the [sentence-transformers](https://www.SBERT.net) library. It maps sentences & paragraphs to a 128256-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:** [EuroBERT/EuroBERT-210m](https://huggingface.co/EuroBERT/EuroBERT-210m)
- **Maximum Sequence Length:** 8192 tokens
- **Output Dimensionality:** 128256 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [french_sts](https://huggingface.co/datasets/CATIE-AQ/frenchSTS)
- **Language:** fr
### 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': 8192, 'do_lower_case': False, 'architecture': 'EuroBertForMaskedLM'})
(1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', 'word_embedding_dimension': 128256})
)
```
## 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("bourdoiscatie/SPLADE_EuroBERT-210m_STS")
# Run inference
sentences = [
"Oui, je peux vous dire d'après mon expérience personnelle qu'ils ont certainement sifflé.",
"Il est vrai que les bombes de la Seconde Guerre mondiale faisaient un bruit de sifflet lorsqu'elles tombaient.",
"J'envisage de dépenser les 48 dollars par mois pour le système GTD (Getting things done) annoncé par David Allen.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 128256]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.6421, 0.5114],
# [0.6421, 1.0000, 0.3132],
# [0.5114, 0.3132, 1.0000]])
```
## 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.3693 | 0.354 |
| **spearman_cosine** | **0.3747** | **0.3849** |
| active_dims | 11.7449 | 10.1785 |
| sparsity_ratio | 0.9999 | 0.9999 |
## Training Details
### Training Dataset
#### french_sts
* Dataset: [french_sts](https://huggingface.co/datasets/CATIE-AQ/frenchSTS) at [47128cc](https://huggingface.co/datasets/CATIE-AQ/frenchSTS/tree/47128cc18c893e5b93679037cdca303849e05309)
* Size: 12,227 training samples
* Columns: sentence1, sentence2, and score
* Approximate statistics based on the first 1000 samples:
| | sentence1 | sentence2 | score |
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
Un avion est en train de décoller. | Un avion est en train de décoller. | 1.0 |
| Un homme est en train de fumer. | Un homme fait du patinage. | 0.10000000149011612 |
| Une personne jette un chat au plafond. | Une personne jette un chat au plafond. | 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')",
"document_regularizer_weight": 0.003
}
```
### Evaluation Dataset
#### french_sts
* Dataset: [french_sts](https://huggingface.co/datasets/CATIE-AQ/frenchSTS) at [47128cc](https://huggingface.co/datasets/CATIE-AQ/frenchSTS/tree/47128cc18c893e5b93679037cdca303849e05309)
* Size: 3,526 evaluation samples
* Columns: sentence1, sentence2, and score
* Approximate statistics based on the first 1000 samples:
| | sentence1 | sentence2 | score |
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details | Un homme avec un casque de sécurité est en train de danser. | Un homme portant un casque de sécurité est en train de danser. | 1.0 |
| Un jeune enfant monte à cheval. | Un enfant monte à cheval. | 0.949999988079071 |
| Un homme donne une souris à un serpent. | L'homme donne une souris au serpent. | 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')",
"document_regularizer_weight": 0.003
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: epoch
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `bf16`: True
#### All Hyperparameters