---
tags:
- sentence-transformers
- cross-encoder
- text-classification
- generated_from_trainer
- dataset_size:19990000
- loss:BinaryCrossEntropyLoss
base_model: answerdotai/ModernBERT-base
pipeline_tag: text-classification
library_name: sentence-transformers
metrics:
- map
- mrr@10
- ndcg@10
model-index:
- name: CrossEncoder based on answerdotai/ModernBERT-base
results: []
---
# CrossEncoder based on answerdotai/ModernBERT-base
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Cross Encoder
- **Base model:** [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base)
- **Maximum Sequence Length:** 8192 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("tomaarsen/reranker-modernbert-base-msmarco-bce")
# Get scores for pairs of texts
pairs = [
['what gb sp model is bright', 'From the list above it is easy to understand that Gegabyte is bigger than Megabyte. Or GB is bigger between MB and GB. Thanks.'],
['does immunotherapy work', 'The US and Drug Administration (FDA) this week convened a panel of outside experts to weigh in on the readiness of a first-of-its-kind cancer therapy. The treatment, which works by tweaking a patientâ\x80\x99s own cells, is a type of immunotherapy called CAR T-cell therapy and has been in clinical trials for several years. One drug maker is now seeking FDA approval to use the treatment in pediatric and young adult patients ages 3 to 25 with B-cell acute lymphoblastic leukemia (ALL) that has not responded to standard care.'],
['how long to wear oasis contacts', 'There is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.here is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.'],
['water baby definition', "Someone very comfortable in the water, Good swimmers, and never scared while in bodies of water. There's Jadine, back in the lake. She's such a water baby. #water #aqua #babies #water babies #water kids."],
['youngest suicide case', 'Samantha Kuberskki was found hanging by a belt at her home in Oregon after being sent to her room for arguing with her mother. A six-year-old girl who was sent to her room for punishment is feared to be one of the youngest people to have ever committed suicide in the U.S. Samantha Kuberskki was found hanging by a belt at her home in Oregon after being sent to her room for arguing with her mother. Her death was ruled as suicide by the coroner - sparking a bitter row with police who investigated her death and insist it was an accident.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'what gb sp model is bright',
[
'From the list above it is easy to understand that Gegabyte is bigger than Megabyte. Or GB is bigger between MB and GB. Thanks.',
'The US and Drug Administration (FDA) this week convened a panel of outside experts to weigh in on the readiness of a first-of-its-kind cancer therapy. The treatment, which works by tweaking a patientâ\x80\x99s own cells, is a type of immunotherapy called CAR T-cell therapy and has been in clinical trials for several years. One drug maker is now seeking FDA approval to use the treatment in pediatric and young adult patients ages 3 to 25 with B-cell acute lymphoblastic leukemia (ALL) that has not responded to standard care.',
'There is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.here is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.',
"Someone very comfortable in the water, Good swimmers, and never scared while in bodies of water. There's Jadine, back in the lake. She's such a water baby. #water #aqua #babies #water babies #water kids.",
'Samantha Kuberskki was found hanging by a belt at her home in Oregon after being sent to her room for arguing with her mother. A six-year-old girl who was sent to her room for punishment is feared to be one of the youngest people to have ever committed suicide in the U.S. Samantha Kuberskki was found hanging by a belt at her home in Oregon after being sent to her room for arguing with her mother. Her death was ruled as suicide by the coroner - sparking a bitter row with police who investigated her death and insist it was an accident.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Evaluation
### Metrics
#### Cross Encoder Reranking
* Datasets: `NanoMSMARCO`, `NanoNFCorpus` and `NanoNQ`
* Evaluated with [CERerankingEvaluator
](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CERerankingEvaluator)
| Metric | NanoMSMARCO | NanoNFCorpus | NanoNQ |
|:------------|:---------------------|:---------------------|:---------------------|
| map | 0.6519 (+0.1623) | 0.3432 (+0.0728) | 0.6951 (+0.2744) |
| mrr@10 | 0.6449 (+0.1674) | 0.5016 (+0.0017) | 0.7152 (+0.2885) |
| **ndcg@10** | **0.7069 (+0.1665)** | **0.3801 (+0.0550)** | **0.7469 (+0.2462)** |
#### Cross Encoder Nano BEIR
* Dataset: `NanoBEIR_mean`
* Evaluated with [CENanoBEIREvaluator
](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CENanoBEIREvaluator)
| Metric | Value |
|:------------|:---------------------|
| map | 0.5634 (+0.1698) |
| mrr@10 | 0.6206 (+0.1525) |
| **ndcg@10** | **0.6113 (+0.1559)** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 19,990,000 training samples
* Columns: query
, answer
, and label
* Approximate statistics based on the first 1000 samples:
| | query | answer | label |
|:--------|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details |
who plays the trickster on flash
| The Flash (2014 TV series) The Flash is a TV show based on the fictional character Flash, a costumed superhero crime-fighter who appears in comic books published by DC Comics.
| 0
|
| what type of business is plastics engineering company
| Plastics Engineering Company is a leading North American manufacturer of phenolic resins and thermoset molding materials, selling products under its trademark Plenco. If you have a phenolic resin or thermoset molding material project, chances are, the Plenco team can make it work. We've been doing it for over 80 years. Come and benefit from the Plenco difference. Plastics Engineering Company, a family owned and managed business founded in 1934, established as its corporate mission a sincere desire to respond efficiently to the needs of our customers through development, manufacture, and servicing of useful, high-value products.
| 1
|
| what is allianz global assistance
| Please choose 'Allianz Direct Customers' for Car, Home, Pet, Boat and Horse & Rider Insurance. Allianz Direct Customers Allianz Direct Customers Car, Home, Pet, Boat and Horse & Rider Insurance. Phone. In the Republic of Ireland: 01 448 48 48. Outside Republic of Ireland: 00 353 1 448 48 48. Opening Hours: Monday to Friday 8am - 6pm and Saturday 9am - 1pm.
| 0
|
* Loss: [BinaryCrossEntropyLoss
](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fct": "Identity",
"pos_weight": 4
}
```
### Evaluation Dataset
#### Unnamed Dataset
* Size: 10,000 evaluation samples
* Columns: query
, answer
, and label
* Approximate statistics based on the first 1000 samples:
| | query | answer | label |
|:--------|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details | what gb sp model is bright
| From the list above it is easy to understand that Gegabyte is bigger than Megabyte. Or GB is bigger between MB and GB. Thanks.
| 0
|
| does immunotherapy work
| The US and Drug Administration (FDA) this week convened a panel of outside experts to weigh in on the readiness of a first-of-its-kind cancer therapy. The treatment, which works by tweaking a patient’s own cells, is a type of immunotherapy called CAR T-cell therapy and has been in clinical trials for several years. One drug maker is now seeking FDA approval to use the treatment in pediatric and young adult patients ages 3 to 25 with B-cell acute lymphoblastic leukemia (ALL) that has not responded to standard care.
| 0
|
| how long to wear oasis contacts
| There is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.here is something wrong with my Xperia Z last week, and I did a resetting to make the phone become original, but I forgot backing up some important contacts, so I have to find the way for Sony Xperia Z contacts recovery, finanlly, I got this Android Data Recovery software to recover lost contacts from my phone.
| 0
|
* Loss: [BinaryCrossEntropyLoss
](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fct": "Identity",
"pos_weight": 4
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 128
- `per_device_eval_batch_size`: 128
- `learning_rate`: 8e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `seed`: 12
- `bf16`: True
- `dataloader_num_workers`: 4
- `load_best_model_at_end`: True
#### All Hyperparameters