---
language:
- en
license: apache-2.0
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:1048576
- loss:BinaryCrossEntropyLoss
base_model: dmis-lab/UltraBERT-150M
pipeline_tag: text-ranking
library_name: sentence-transformers
---
# UltraBERT-150M reranker MS MARCO
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [dmis-lab/UltraBERT-150M](https://huggingface.co/dmis-lab/UltraBERT-150M) on the parquet dataset 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:** [dmis-lab/UltraBERT-150M](https://huggingface.co/dmis-lab/UltraBERT-150M)
- **Maximum Sequence Length:** 291 tokens
- **Number of Output Labels:** 1 label
- **Supported Modality:** Text
- **Training Dataset:**
- parquet
- **Language:** en
- **License:** apache-2.0
### 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/huggingface/sentence-transformers)
- **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
### Full Model Architecture
```
CrossEncoder(
(0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'UltrabertForSequenceClassification'})
)
```
## 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/ultrabert-150m-reranker-msmarco524k-3e-5-20261014")
# Get scores for pairs of inputs
pairs = [
['how much does david cameron earn', "OK-So definitively David Cameron who is the current British Prime Minister earns £142,500 per year. Recently the Civil Service disclosed the salary's of all of the Cabinet members who earn over £150,000. David Cameron's £142,500 was used as a bench mark for this."],
['how much does david cameron earn', 'Celebrities wealth, income, and salary in 2016, 2017. Cameron Dallas. Handsome Vine star Cameron Dallas earned his first million before he was 20 years old. His current net worth is approximately $1.2 million as of 2017 and although he never admitted having any official girlfriend, we know the names of last two girls he was dating.'],
['distance from the island of palms to downtown charleston, sc', 'Distance, Gas Consumption and Emission Notes. Distance from Isle of Palms, SC to Charleston, SC is 18Miles or 29 Km. You can get this distance about 39 mins. If you want to planning travel with plane for 13 Miles or 20 Km, You can get this distance about 31 mins . A car with an average MPG will needs 0.83 gallons of gas to get the route between these points. The estimated cost of gas to get between Isle of Palms, SC and Charleston, SC is $1.88. During the route, an average car will release 16.26 pounds of CO 2 to the atmosphere. Your carbon footprint is 0.9 pounds of CO 2 per mile.'],
['distance from the island of palms to downtown charleston, sc', 'Once youâ\x80\x99ve done your obligatory sunbathing and beachcombing at the Isle of Palms County Park Beach, head to nearby Charleston, a 30-minute drive away, which has historic sites, landmarks, shopping districts, golf courses and family attractions like The South Carolina Aquarium and Fountain Walk, a new dining, entertainment and shopping complex nearby.'],
['how much does nicu cost per day', 'According to a 2010 article in Managed Care Magazine, the average cost for infants in NICU is around $3,000 per day. This average does not include surgeries or helicopter transports.'],
]
scores = model.predict(pairs)
print(scores)
# [ 6.9062 -3.8906 5.9688 -2.3438 4.4375]
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'how much does david cameron earn',
[
"OK-So definitively David Cameron who is the current British Prime Minister earns £142,500 per year. Recently the Civil Service disclosed the salary's of all of the Cabinet members who earn over £150,000. David Cameron's £142,500 was used as a bench mark for this.",
'Celebrities wealth, income, and salary in 2016, 2017. Cameron Dallas. Handsome Vine star Cameron Dallas earned his first million before he was 20 years old. His current net worth is approximately $1.2 million as of 2017 and although he never admitted having any official girlfriend, we know the names of last two girls he was dating.',
'Distance, Gas Consumption and Emission Notes. Distance from Isle of Palms, SC to Charleston, SC is 18Miles or 29 Km. You can get this distance about 39 mins. If you want to planning travel with plane for 13 Miles or 20 Km, You can get this distance about 31 mins . A car with an average MPG will needs 0.83 gallons of gas to get the route between these points. The estimated cost of gas to get between Isle of Palms, SC and Charleston, SC is $1.88. During the route, an average car will release 16.26 pounds of CO 2 to the atmosphere. Your carbon footprint is 0.9 pounds of CO 2 per mile.',
'Once youâ\x80\x99ve done your obligatory sunbathing and beachcombing at the Isle of Palms County Park Beach, head to nearby Charleston, a 30-minute drive away, which has historic sites, landmarks, shopping districts, golf courses and family attractions like The South Carolina Aquarium and Fountain Walk, a new dining, entertainment and shopping complex nearby.',
'According to a 2010 article in Managed Care Magazine, the average cost for infants in NICU is around $3,000 per day. This average does not include surgeries or helicopter transports.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Training Details
### Training Dataset
#### parquet
* Dataset: parquet
* Size: 1,048,576 training samples
* Columns: query, passage, and label
* Approximate statistics based on the first 100 samples:
| | query | passage | label |
|:---------|:---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------|
| type | string | string | float |
| modality | text | text | |
| details |
how much does david cameron earn | OK-So definitively David Cameron who is the current British Prime Minister earns £142,500 per year. Recently the Civil Service disclosed the salary's of all of the Cabinet members who earn over £150,000. David Cameron's £142,500 was used as a bench mark for this. | 1.0 |
| how much does david cameron earn | Celebrities wealth, income, and salary in 2016, 2017. Cameron Dallas. Handsome Vine star Cameron Dallas earned his first million before he was 20 years old. His current net worth is approximately $1.2 million as of 2017 and although he never admitted having any official girlfriend, we know the names of last two girls he was dating. | 0.0 |
| distance from the island of palms to downtown charleston, sc | Distance, Gas Consumption and Emission Notes. Distance from Isle of Palms, SC to Charleston, SC is 18Miles or 29 Km. You can get this distance about 39 mins. If you want to planning travel with plane for 13 Miles or 20 Km, You can get this distance about 31 mins . A car with an average MPG will needs 0.83 gallons of gas to get the route between these points. The estimated cost of gas to get between Isle of Palms, SC and Charleston, SC is $1.88. During the route, an average car will release 16.26 pounds of CO 2 to the atmosphere. Your carbon footprint is 0.9 pounds of CO 2 per mile. | 1.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": 1.0
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `num_train_epochs`: 1
- `learning_rate`: 3e-05
- `warmup_steps`: 0.05
- `optim`: adamw_torch
- `weight_decay`: 0.01
- `gradient_accumulation_steps`: 4
- `bf16`: True
- `tf32`: True
- `logging_nan_inf_filter`: False
- `disable_tqdm`: True
- `per_device_eval_batch_size`: 32
- `push_to_hub`: True
- `hub_private_repo`: False
- `hub_model_id`: tomaarsen/ultrabert-150m-reranker-msmarco524k-3e-5-20261014
- `load_best_model_at_end`: True
- `seed`: 12
- `data_seed`: 12
- `dataloader_num_workers`: 2
#### All Hyperparameters