---
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:942069
- loss:BinaryCrossEntropyLoss
base_model: microsoft/deberta-v3-base
pipeline_tag: text-ranking
library_name: sentence-transformers
metrics:
- accuracy
- accuracy_threshold
- f1
- f1_threshold
- precision
- recall
- average_precision
model-index:
- name: CrossEncoder based on microsoft/deberta-v3-base
results:
- task:
type: cross-encoder-classification
name: Cross Encoder Classification
dataset:
name: AllNLI norm dev
type: AllNLI-norm-dev
metrics:
- type: accuracy
value: 0.6807244238693595
name: Accuracy
- type: accuracy_threshold
value: 0.4375791847705841
name: Accuracy Threshold
- type: f1
value: 0.5465734265734266
name: F1
- type: f1_threshold
value: 0.00438243243843317
name: F1 Threshold
- type: precision
value: 0.40035514274006284
name: Precision
- type: recall
value: 0.8610458284371327
name: Recall
- type: average_precision
value: 0.49929639749742777
name: Average Precision
- task:
type: cross-encoder-classification
name: Cross Encoder Classification
dataset:
name: AllNLI test
type: AllNLI-test
metrics:
- type: accuracy
value: 0.6814204314204314
name: Accuracy
- type: accuracy_threshold
value: 0.5599576234817505
name: Accuracy Threshold
- type: f1
value: 0.5269568771714694
name: F1
- type: f1_threshold
value: 0.0010413693962618709
name: F1 Threshold
- type: precision
value: 0.3655438357718045
name: Precision
- type: recall
value: 0.9436392914653784
name: Recall
- type: average_precision
value: 0.48186391164637776
name: Average Precision
---
# CrossEncoder based on microsoft/deberta-v3-base
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [microsoft/deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base) using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
## Model Details
### Model Description
- **Model Type:** Cross Encoder
- **Base model:** [microsoft/deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base)
- **Maximum Sequence Length:** 512 tokens
- **Number of Output Labels:** 1 label
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
## 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 CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("tani-at-nola/reranker-deberta-v3-base-nli")
# Get scores for pairs of texts
pairs = [
['The sisters are hugging goodbye while holding to go packages after just eating lunch.', 'Two women are embracing while holding to go packages.'],
['Two woman are holding packages.', 'Two women are embracing while holding to go packages.'],
['The men are fighting outside a deli.', 'Two women are embracing while holding to go packages.'],
['Two kids in numbered jerseys wash their hands.', 'Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.'],
['Two kids at a ballgame wash their hands.', 'Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'The sisters are hugging goodbye while holding to go packages after just eating lunch.',
[
'Two women are embracing while holding to go packages.',
'Two women are embracing while holding to go packages.',
'Two women are embracing while holding to go packages.',
'Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.',
'Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Evaluation
### Metrics
#### Cross Encoder Classification
* Datasets: `AllNLI-norm-dev` and `AllNLI-test`
* Evaluated with [CrossEncoderClassificationEvaluator](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CrossEncoderClassificationEvaluator)
| Metric | AllNLI-norm-dev | AllNLI-test |
|:----------------------|:----------------|:------------|
| accuracy | 0.6807 | 0.6814 |
| accuracy_threshold | 0.4376 | 0.56 |
| f1 | 0.5466 | 0.527 |
| f1_threshold | 0.0044 | 0.001 |
| precision | 0.4004 | 0.3655 |
| recall | 0.861 | 0.9436 |
| **average_precision** | **0.4993** | **0.4819** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 942,069 training samples
* Columns: hypothesis, premise, and label
* Approximate statistics based on the first 1000 samples:
| | hypothesis | premise | label |
|:--------|:------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details |
A person is training his horse for a competition. | A person on a horse jumps over a broken down airplane. | 0 |
| A person is at a diner, ordering an omelette. | A person on a horse jumps over a broken down airplane. | 0 |
| A person is outdoors, on a horse. | A person on a horse jumps over a broken down airplane. | 1 |
* Loss: [BinaryCrossEntropyLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
```
### Evaluation Dataset
#### Unnamed Dataset
* Size: 19,657 evaluation samples
* Columns: hypothesis, premise, and label
* Approximate statistics based on the first 1000 samples:
| | hypothesis | premise | label |
|:--------|:------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details | The sisters are hugging goodbye while holding to go packages after just eating lunch. | Two women are embracing while holding to go packages. | 0 |
| Two woman are holding packages. | Two women are embracing while holding to go packages. | 1 |
| The men are fighting outside a deli. | Two women are embracing while holding to go packages. | 0 |
* Loss: [BinaryCrossEntropyLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `num_train_epochs`: 5
- `warmup_ratio`: 0.1
- `bf16`: True
- `load_best_model_at_end`: True
#### All Hyperparameters