tomaarsen's picture
tomaarsen HF Staff
Simplify model card
bfabbcb verified
|
Raw History Blame Contribute Delete
23.1 kB
---
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) <!-- at revision f821af159246ab4ac84669d42533281366bc55ab -->
- **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': ...}, ...]
```
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
<!--
## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->
<!--
### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->
## Training Details
### Training Dataset
#### parquet
* Dataset: parquet
* Size: 1,048,576 training samples
* Columns: <code>query</code>, <code>passage</code>, and <code>label</code>
* Approximate statistics based on the first 100 samples:
| | query | passage | label |
|:---------|:---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------|
| type | string | string | float |
| modality | text | text | |
| details | <ul><li>min: 4 tokens</li><li>mean: 8.23 tokens</li><li>max: 15 tokens</li></ul> | <ul><li>min: 30 tokens</li><li>mean: 88.86 tokens</li><li>max: 206 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.5</li><li>max: 1.0</li></ul> |
* Samples:
| query | passage | label |
|:--------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
| <code>how much does david cameron earn</code> | <code>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.</code> | <code>1.0</code> |
| <code>how much does david cameron earn</code> | <code>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.</code> | <code>0.0</code> |
| <code>distance from the island of palms to downtown charleston, sc</code> | <code>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.</code> | <code>1.0</code> |
* Loss: [<code>BinaryCrossEntropyLoss</code>](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
<details><summary>Click to expand</summary>
- `per_device_train_batch_size`: 32
- `num_train_epochs`: 1
- `max_steps`: -1
- `learning_rate`: 3e-05
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: None
- `warmup_steps`: 0.05
- `optim`: adamw_torch
- `optim_args`: None
- `weight_decay`: 0.01
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `optim_target_modules`: None
- `gradient_accumulation_steps`: 4
- `average_tokens_across_devices`: True
- `max_grad_norm`: 1.0
- `label_smoothing_factor`: 0.0
- `bf16`: True
- `fp16`: False
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: True
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `use_liger_kernel`: False
- `liger_kernel_config`: None
- `use_cache`: False
- `neftune_noise_alpha`: None
- `torch_empty_cache_steps`: None
- `auto_find_batch_size`: False
- `log_on_each_node`: True
- `logging_nan_inf_filter`: False
- `include_num_input_tokens_seen`: no
- `log_level`: passive
- `log_level_replica`: warning
- `disable_tqdm`: True
- `project`: huggingface
- `trackio_space_id`: None
- `trackio_bucket_id`: None
- `trackio_static_space_id`: None
- `per_device_eval_batch_size`: 32
- `prediction_loss_only`: True
- `eval_on_start`: False
- `eval_do_concat_batches`: True
- `eval_use_gather_object`: False
- `eval_accumulation_steps`: None
- `include_for_metrics`: []
- `batch_eval_metrics`: False
- `save_only_model`: False
- `save_on_each_node`: False
- `enable_jit_checkpoint`: False
- `push_to_hub`: True
- `hub_private_repo`: False
- `hub_model_id`: tomaarsen/ultrabert-150m-reranker-msmarco524k-3e-5-20261014
- `hub_strategy`: every_save
- `hub_always_push`: False
- `hub_revision`: None
- `load_best_model_at_end`: True
- `ignore_data_skip`: False
- `restore_callback_states_from_checkpoint`: False
- `full_determinism`: False
- `seed`: 12
- `data_seed`: 12
- `use_cpu`: False
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `parallelism_config`: None
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 2
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `dataloader_prefetch_factor`: None
- `dataloader_multiprocessing_context`: None
- `dataloader_in_order`: True
- `remove_unused_columns`: True
- `label_names`: None
- `train_sampling_strategy`: random
- `length_column_name`: length
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `ddp_static_graph`: None
- `ddp_backend`: None
- `ddp_timeout`: 1800
- `fsdp`: None
- `fsdp_config`: None
- `deepspeed`: None
- `debug`: []
- `skip_memory_metrics`: True
- `do_predict`: False
- `resume_from_checkpoint`: None
- `local_rank`: -1
- `prompts`: None
- `batch_sampler`: batch_sampler
- `multi_dataset_batch_sampler`: proportional
- `router_mapping`: {}
- `learning_rate_mapping`: {}
- `warmup_ratio`: None
</details>
### Training Logs
| Epoch | Step | Training Loss |
|:----------:|:--------:|:-------------:|
| 0.0001 | 1 | 1.1699 |
| 0.0122 | 100 | 0.7252 |
| 0.0244 | 200 | 0.3373 |
| 0.0366 | 300 | 0.3011 |
| 0.0488 | 400 | 0.3020 |
| 0.0610 | 500 | 0.2891 |
| 0.0625 | 512 | - |
| 0.0732 | 600 | 0.2700 |
| 0.0854 | 700 | 0.2660 |
| 0.0977 | 800 | 0.2738 |
| 0.1099 | 900 | 0.2579 |
| 0.1221 | 1000 | 0.2588 |
| 0.125 | 1024 | - |
| 0.1343 | 1100 | 0.2357 |
| 0.1465 | 1200 | 0.2382 |
| 0.1587 | 1300 | 0.2344 |
| 0.1709 | 1400 | 0.2334 |
| 0.1831 | 1500 | 0.2306 |
| 0.1875 | 1536 | - |
| 0.1953 | 1600 | 0.2278 |
| 0.2075 | 1700 | 0.2283 |
| 0.2197 | 1800 | 0.2183 |
| 0.2319 | 1900 | 0.2187 |
| 0.2441 | 2000 | 0.2115 |
| 0.25 | 2048 | - |
| 0.2563 | 2100 | 0.2069 |
| 0.2686 | 2200 | 0.2073 |
| 0.2808 | 2300 | 0.2072 |
| 0.2930 | 2400 | 0.2138 |
| 0.3052 | 2500 | 0.2062 |
| 0.3125 | 2560 | - |
| 0.3174 | 2600 | 0.2042 |
| 0.3296 | 2700 | 0.2034 |
| 0.3418 | 2800 | 0.1919 |
| 0.3540 | 2900 | 0.1980 |
| 0.3662 | 3000 | 0.1999 |
| 0.375 | 3072 | - |
| 0.3784 | 3100 | 0.1951 |
| 0.3906 | 3200 | 0.1949 |
| 0.4028 | 3300 | 0.2005 |
| 0.4150 | 3400 | 0.1909 |
| 0.4272 | 3500 | 0.1816 |
| **0.4375** | **3584** | **-** |
| 0.4395 | 3600 | 0.1890 |
| 0.4517 | 3700 | 0.1866 |
| 0.4639 | 3800 | 0.1868 |
| 0.4761 | 3900 | 0.1792 |
| 0.4883 | 4000 | 0.1803 |
| 0.5 | 4096 | - |
| 0.5005 | 4100 | 0.1794 |
| 0.5127 | 4200 | 0.1795 |
| 0.5249 | 4300 | 0.1751 |
| 0.5371 | 4400 | 0.1829 |
| 0.5493 | 4500 | 0.1716 |
| 0.5615 | 4600 | 0.1632 |
| 0.5625 | 4608 | - |
| 0.5737 | 4700 | 0.1773 |
| 0.5859 | 4800 | 0.1659 |
| 0.5981 | 4900 | 0.1636 |
| 0.6104 | 5000 | 0.1716 |
| 0.6226 | 5100 | 0.1654 |
| 0.625 | 5120 | - |
| 0.6348 | 5200 | 0.1679 |
| 0.6470 | 5300 | 0.1654 |
| 0.6592 | 5400 | 0.1671 |
| 0.6714 | 5500 | 0.1579 |
| 0.6836 | 5600 | 0.1579 |
| 0.6875 | 5632 | - |
| 0.6958 | 5700 | 0.1577 |
| 0.7080 | 5800 | 0.1509 |
| 0.7202 | 5900 | 0.1551 |
| 0.7324 | 6000 | 0.1528 |
| 0.7446 | 6100 | 0.1553 |
| 0.75 | 6144 | - |
| 0.7568 | 6200 | 0.1512 |
| 0.7690 | 6300 | 0.1464 |
| 0.7812 | 6400 | 0.1461 |
| 0.7935 | 6500 | 0.1431 |
| 0.8057 | 6600 | 0.1456 |
| 0.8125 | 6656 | - |
| 0.8179 | 6700 | 0.1520 |
| 0.8301 | 6800 | 0.1416 |
| 0.8423 | 6900 | 0.1418 |
| 0.8545 | 7000 | 0.1443 |
| 0.8667 | 7100 | 0.1418 |
| 0.875 | 7168 | - |
| 0.8789 | 7200 | 0.1423 |
| 0.8911 | 7300 | 0.1359 |
| 0.9033 | 7400 | 0.1385 |
| 0.9155 | 7500 | 0.1387 |
| 0.9277 | 7600 | 0.1340 |
| 0.9375 | 7680 | - |
| 0.9399 | 7700 | 0.1313 |
| 0.9521 | 7800 | 0.1297 |
| 0.9644 | 7900 | 0.1354 |
| 0.9766 | 8000 | 0.1340 |
| 0.9888 | 8100 | 0.1354 |
| 1.0 | 8192 | - |
* The bold row denotes the saved checkpoint.
### Training Time
- **Training**: 57.6 minutes
- **Evaluation**: 3.8 minutes
- **Total**: 1.0 hours
### Framework Versions
- Python: 3.12.12
- Sentence Transformers: 6.2.0.dev0
- Transformers: 5.16.1
- PyTorch: 2.10.0+cu128
- Accelerate: 1.15.0
- Datasets: 5.1.0
- Tokenizers: 0.23.3
## Additional Resources
- [Training and Finetuning Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-reranker): the end-to-end guide for training or finetuning Cross Encoder (reranker) models.
- [Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/multimodal-sentence-transformers): use text, image, audio, and video reranker models through the same API.
- [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-multimodal-sentence-transformers): training multimodal Cross Encoders.
## Citation
### BibTeX
#### Sentence Transformers
```bibtex
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
```
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->
## Retrieval scaling experiment
One epoch on 524,288 shared MS MARCO triplets, seed 12, LR 3e-05. Query content is clipped to 32 tokens, passage content to 256, combined cap 291. Checkpoint selected by the original 1,024-query validation set. Test scores do not select checkpoints. [Experiment artifacts](https://huggingface.co/buckets/tomaarsen/encoder-comparison-20261014).