---
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:3943
- loss:ListNetLoss
base_model: sentence-transformers/all-mpnet-base-v2
pipeline_tag: text-ranking
library_name: sentence-transformers
---
# CrossEncoder based on sentence-transformers/all-mpnet-base-v2
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) 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:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
- **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("varadsrivastava/findocranker-mpnet-base-v2")
# Get scores for pairs of texts
pairs = [
['What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?', '[DOC=10-K | annual report | comprehensive business overview, risks, financials | 100-300 pages]'],
['What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?', '[DOC=10-Q | quarterly report | interim financials, MD&A updates | 30-60 pages]'],
['What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?', '[DOC=DEF-14A | proxy statement | governance, compensation, shareholder voting matters | annual filing]'],
['What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?', '[DOC=8-K | current report | material events, timely disclosures | ad-hoc filing]'],
['What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?', '[DOC=Earnings | earnings call transcript | forward guidance, Q&A, management commentary | quarterly]'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy?',
[
'[DOC=10-K | annual report | comprehensive business overview, risks, financials | 100-300 pages]',
'[DOC=10-Q | quarterly report | interim financials, MD&A updates | 30-60 pages]',
'[DOC=DEF-14A | proxy statement | governance, compensation, shareholder voting matters | annual filing]',
'[DOC=8-K | current report | material events, timely disclosures | ad-hoc filing]',
'[DOC=Earnings | earnings call transcript | forward guidance, Q&A, management commentary | quarterly]',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 3,943 training samples
* Columns: query, docs, and labels
* Approximate statistics based on the first 1000 samples:
| | query | docs | labels |
|:--------|:-------------------------------------------------------------------------------------------------|:-----------------------------------|:-----------------------------------|
| type | string | list | list |
| details |
What did Fifth Third Bancorp’s leadership say about Fifth Third Bancorp’s dividend policy? | ['[DOC=10-K \| annual report \| comprehensive business overview, risks, financials \| 100-300 pages]', '[DOC=10-Q \| quarterly report \| interim financials, MD&A updates \| 30-60 pages]', '[DOC=DEF-14A \| proxy statement \| governance, compensation, shareholder voting matters \| annual filing]', '[DOC=8-K \| current report \| material events, timely disclosures \| ad-hoc filing]', '[DOC=Earnings \| earnings call transcript \| forward guidance, Q&A, management commentary \| quarterly]'] | [4, 3, 2, 1, 0] |
| How did Qualcomm’s management describe forecasted capital allocation between developing new semiconductor technologies and potential acquisitions? | ['[DOC=10-K \| annual report \| comprehensive business overview, risks, financials \| 100-300 pages]', '[DOC=10-Q \| quarterly report \| interim financials, MD&A updates \| 30-60 pages]', '[DOC=8-K \| current report \| material events, timely disclosures \| ad-hoc filing]', '[DOC=DEF-14A \| proxy statement \| governance, compensation, shareholder voting matters \| annual filing]', '[DOC=Earnings \| earnings call transcript \| forward guidance, Q&A, management commentary \| quarterly]'] | [4, 3, 2, 1, 0] |
| What did GE HealthCare Technologies Inc.’s leadership say about GE HealthCare Technologies Inc.’s dividend policy? | ['[DOC=10-K \| annual report \| comprehensive business overview, risks, financials \| 100-300 pages]', '[DOC=8-K \| current report \| material events, timely disclosures \| ad-hoc filing]', '[DOC=Earnings \| earnings call transcript \| forward guidance, Q&A, management commentary \| quarterly]', '[DOC=10-Q \| quarterly report \| interim financials, MD&A updates \| 30-60 pages]', '[DOC=DEF-14A \| proxy statement \| governance, compensation, shareholder voting matters \| annual filing]'] | [4, 3, 2, 1, 0] |
* Loss: [ListNetLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#listnetloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"mini_batch_size": null
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 4
- `gradient_accumulation_steps`: 4
- `learning_rate`: 2e-05
- `weight_decay`: 0.01
- `num_train_epochs`: 5
- `lr_scheduler_type`: cosine
- `warmup_ratio`: 0.1
- `data_seed`: 42
- `fp16`: True
- `dataloader_num_workers`: 2
#### All Hyperparameters