UltraBERT-150M reranker MS MARCO pilot
This is a Cross Encoder model finetuned from dmis-lab/UltraBERT-150M on the parquet dataset using the sentence-transformers 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
- 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
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
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:
pip install -U sentence-transformers
Then you can load this model and run inference.
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 min: 4 tokensmean: 8.23 tokensmax: 15 tokens min: 30 tokensmean: 88.86 tokensmax: 206 tokens min: 0.0mean: 0.5max: 1.0 - Samples:
query passage label 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 with these parameters:
{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": 1.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 32num_train_epochs: 1learning_rate: 3e-05warmup_steps: 0.05optim: adamw_torchweight_decay: 0.01gradient_accumulation_steps: 4bf16: Truetf32: Truelogging_nan_inf_filter: Falsedisable_tqdm: Trueper_device_eval_batch_size: 32push_to_hub: Truehub_private_repo: Falsehub_model_id: tomaarsen/ultrabert-150m-reranker-msmarco524k-3e-5-20261014load_best_model_at_end: Trueseed: 12data_seed: 12dataloader_num_workers: 2
All Hyperparameters
per_device_train_batch_size: 32num_train_epochs: 1max_steps: -1learning_rate: 3e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.05optim: adamw_torchoptim_args: Noneweight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 4average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Truegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Falseinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Trueproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 32prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Truehub_private_repo: Falsehub_model_id: tomaarsen/ultrabert-150m-reranker-msmarco524k-3e-5-20261014hub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Trueignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 12data_seed: 12use_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 2dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
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: the end-to-end guide for training or finetuning Cross Encoder (reranker) models.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video reranker models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: training multimodal Cross Encoders.
Citation
BibTeX
Sentence Transformers
@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",
}
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.