MiniLM-L12-H384 trained on GooAQ
This is a Cross Encoder model finetuned from answerdotai/ModernBERT-base on the gooaq 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: answerdotai/ModernBERT-base
- Maximum Sequence Length: 8192 tokens
- Number of Output Labels: 1 label
- Training Dataset:
- Language: en
- License: apache-2.0
Model Sources
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
model = CrossEncoder("tomaarsen/reranker-ModernBERT-base-gooaq-cmnrl")
pairs = [
['should you take ibuprofen with high blood pressure?', "In general, people with high blood pressure should use acetaminophen or possibly aspirin for over-the-counter pain relief. Unless your health care provider has said it's OK, you should not use ibuprofen, ketoprofen, or naproxen sodium. If aspirin or acetaminophen doesn't help with your pain, call your doctor."],
['how old do you have to be to work in sc?', 'The general minimum age of employment for South Carolina youth is 14, although the state allows younger children who are performers to work in show business. If their families are agricultural workers, children younger than age 14 may also participate in farm labor.'],
['how to write a topic proposal for a research paper?', "['Write down the main topic of your paper. ... ', 'Write two or three short sentences under the main topic that explain why you chose that topic. ... ', 'Write a thesis sentence that states the angle and purpose of your research paper. ... ', 'List the items you will cover in the body of the paper that support your thesis statement.']"],
['how much does aaf pay players?', 'These dates provided an opportunity for players cut at the NFL roster deadline, and each player signed a non-guaranteed three-year contract worth a total of $250,000 ($70,000 in 2019; $80,000 in 2020; $100,000 in 2021), with performance-based and fan-interaction incentives allowing for players to earn more.'],
['is jove and zeus the same?', 'Jupiter, or Jove, in Roman mythology is the king of the gods and the god of sky and thunder, equivalent to Zeus in Greek traditions.'],
]
scores = model.predict(pairs)
print(scores.shape)
ranks = model.rank(
'should you take ibuprofen with high blood pressure?',
[
"In general, people with high blood pressure should use acetaminophen or possibly aspirin for over-the-counter pain relief. Unless your health care provider has said it's OK, you should not use ibuprofen, ketoprofen, or naproxen sodium. If aspirin or acetaminophen doesn't help with your pain, call your doctor.",
'The general minimum age of employment for South Carolina youth is 14, although the state allows younger children who are performers to work in show business. If their families are agricultural workers, children younger than age 14 may also participate in farm labor.',
"['Write down the main topic of your paper. ... ', 'Write two or three short sentences under the main topic that explain why you chose that topic. ... ', 'Write a thesis sentence that states the angle and purpose of your research paper. ... ', 'List the items you will cover in the body of the paper that support your thesis statement.']",
'These dates provided an opportunity for players cut at the NFL roster deadline, and each player signed a non-guaranteed three-year contract worth a total of $250,000 ($70,000 in 2019; $80,000 in 2020; $100,000 in 2021), with performance-based and fan-interaction incentives allowing for players to earn more.',
'Jupiter, or Jove, in Roman mythology is the king of the gods and the god of sky and thunder, equivalent to Zeus in Greek traditions.',
]
)
Evaluation
Metrics
Cross Encoder Reranking
| Metric |
NanoMSMARCO_R100 |
NanoNFCorpus_R100 |
NanoNQ_R100 |
| map |
0.4386 (-0.0510) |
0.3362 (+0.0752) |
0.5793 (+0.1597) |
| mrr@10 |
0.4263 (-0.0512) |
0.5449 (+0.0451) |
0.5857 (+0.1590) |
| ndcg@10 |
0.5101 (-0.0303) |
0.3597 (+0.0347) |
0.6474 (+0.1468) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_R100_mean
- Evaluated with
CrossEncoderNanoBEIREvaluator with these parameters:{
"dataset_names": [
"msmarco",
"nfcorpus",
"nq"
],
"rerank_k": 100,
"at_k": 10,
"always_rerank_positives": true
}
| Metric |
Value |
| map |
0.4514 (+0.0613) |
| mrr@10 |
0.5190 (+0.0510) |
| ndcg@10 |
0.5057 (+0.0504) |
Training Details
Training Dataset
gooaq
- Dataset: gooaq at b089f72
- Size: 99,000 training samples
- Columns:
question and answer
- Approximate statistics based on the first 1000 samples:
|
question |
answer |
| type |
string |
string |
| details |
- min: 17 characters
- mean: 42.88 characters
- max: 95 characters
|
- min: 53 characters
- mean: 251.42 characters
- max: 398 characters
|
- Samples:
| question |
answer |
what are the 5 characteristics of a star? |
Key Concept: Characteristics used to classify stars include color, temperature, size, composition, and brightness. |
are copic markers alcohol ink? |
Copic Ink is alcohol-based and flammable. Keep away from direct sunlight and extreme temperatures. |
what is the difference between appellate term and appellate division? |
Appellate terms An appellate term is an intermediate appellate court that hears appeals from the inferior courts within their designated counties or judicial districts, and are intended to ease the workload on the Appellate Division and provide a less expensive forum closer to the people. |
- Loss:
CachedMultipleNegativesRankingLoss with these parameters:{
"scale": 10.0,
"num_negatives": 5,
"activation_fct": "torch.nn.modules.activation.Sigmoid",
"mini_batch_size": 16
}
Evaluation Dataset
gooaq
- Dataset: gooaq at b089f72
- Size: 1,000 evaluation samples
- Columns:
question and answer
- Approximate statistics based on the first 1000 samples:
|
question |
answer |
| type |
string |
string |
| details |
- min: 18 characters
- mean: 43.05 characters
- max: 88 characters
|
- min: 51 characters
- mean: 252.39 characters
- max: 386 characters
|
- Samples:
| question |
answer |
should you take ibuprofen with high blood pressure? |
In general, people with high blood pressure should use acetaminophen or possibly aspirin for over-the-counter pain relief. Unless your health care provider has said it's OK, you should not use ibuprofen, ketoprofen, or naproxen sodium. If aspirin or acetaminophen doesn't help with your pain, call your doctor. |
how old do you have to be to work in sc? |
The general minimum age of employment for South Carolina youth is 14, although the state allows younger children who are performers to work in show business. If their families are agricultural workers, children younger than age 14 may also participate in farm labor. |
how to write a topic proposal for a research paper? |
['Write down the main topic of your paper. ... ', 'Write two or three short sentences under the main topic that explain why you chose that topic. ... ', 'Write a thesis sentence that states the angle and purpose of your research paper. ... ', 'List the items you will cover in the body of the paper that support your thesis statement.'] |
- Loss:
CachedMultipleNegativesRankingLoss with these parameters:{
"scale": 10.0,
"num_negatives": 5,
"activation_fct": "torch.nn.modules.activation.Sigmoid",
"mini_batch_size": 16
}
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: steps
per_device_train_batch_size: 64
per_device_eval_batch_size: 64
learning_rate: 2e-05
num_train_epochs: 1
warmup_ratio: 0.1
seed: 12
bf16: True
All Hyperparameters
Click to expand
overwrite_output_dir: False
do_predict: False
eval_strategy: steps
prediction_loss_only: True
per_device_train_batch_size: 64
per_device_eval_batch_size: 64
per_gpu_train_batch_size: None
per_gpu_eval_batch_size: None
gradient_accumulation_steps: 1
eval_accumulation_steps: None
torch_empty_cache_steps: None
learning_rate: 2e-05
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
max_grad_norm: 1.0
num_train_epochs: 1
max_steps: -1
lr_scheduler_type: linear
lr_scheduler_kwargs: {}
warmup_ratio: 0.1
warmup_steps: 0
log_level: passive
log_level_replica: warning
log_on_each_node: True
logging_nan_inf_filter: True
save_safetensors: True
save_on_each_node: False
save_only_model: False
restore_callback_states_from_checkpoint: False
no_cuda: False
use_cpu: False
use_mps_device: False
seed: 12
data_seed: None
jit_mode_eval: False
use_ipex: False
bf16: True
fp16: False
fp16_opt_level: O1
half_precision_backend: auto
bf16_full_eval: False
fp16_full_eval: False
tf32: None
local_rank: 0
ddp_backend: None
tpu_num_cores: None
tpu_metrics_debug: False
debug: []
dataloader_drop_last: False
dataloader_num_workers: 0
dataloader_prefetch_factor: None
past_index: -1
disable_tqdm: False
remove_unused_columns: True
label_names: None
load_best_model_at_end: False
ignore_data_skip: False
fsdp: []
fsdp_min_num_params: 0
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
fsdp_transformer_layer_cls_to_wrap: None
accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
deepspeed: None
label_smoothing_factor: 0.0
optim: adamw_torch
optim_args: None
adafactor: False
group_by_length: False
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
dataloader_pin_memory: True
dataloader_persistent_workers: False
skip_memory_metrics: True
use_legacy_prediction_loop: False
push_to_hub: False
resume_from_checkpoint: None
hub_model_id: None
hub_strategy: every_save
hub_private_repo: None
hub_always_push: False
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
include_inputs_for_metrics: False
include_for_metrics: []
eval_do_concat_batches: True
fp16_backend: auto
push_to_hub_model_id: None
push_to_hub_organization: None
mp_parameters:
auto_find_batch_size: False
full_determinism: False
torchdynamo: None
ray_scope: last
ddp_timeout: 1800
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
dispatch_batches: None
split_batches: None
include_tokens_per_second: False
include_num_input_tokens_seen: False
neftune_noise_alpha: None
optim_target_modules: None
batch_eval_metrics: False
eval_on_start: False
use_liger_kernel: False
eval_use_gather_object: False
average_tokens_across_devices: False
prompts: None
batch_sampler: batch_sampler
multi_dataset_batch_sampler: proportional
Training Logs
| Epoch |
Step |
Training Loss |
Validation Loss |
NanoMSMARCO_R100_ndcg@10 |
NanoNFCorpus_R100_ndcg@10 |
NanoNQ_R100_ndcg@10 |
NanoBEIR_R100_mean_ndcg@10 |
| -1 |
-1 |
- |
- |
0.0077 (-0.5327) |
0.2528 (-0.0722) |
0.0311 (-0.4696) |
0.0972 (-0.3582) |
| 0.0006 |
1 |
2.0578 |
- |
- |
- |
- |
- |
| 0.0646 |
100 |
1.241 |
- |
- |
- |
- |
- |
| 0.1293 |
200 |
0.0547 |
- |
- |
- |
- |
- |
| 0.1616 |
250 |
- |
0.0271 |
0.4767 (-0.0637) |
0.3039 (-0.0212) |
0.5435 (+0.0429) |
0.4414 (-0.0140) |
| 0.1939 |
300 |
0.0203 |
- |
- |
- |
- |
- |
| 0.2586 |
400 |
0.0122 |
- |
- |
- |
- |
- |
| 0.3232 |
500 |
0.0094 |
0.0087 |
0.4937 (-0.0467) |
0.3334 (+0.0084) |
0.6134 (+0.1127) |
0.4802 (+0.0248) |
| 0.3878 |
600 |
0.0075 |
- |
- |
- |
- |
- |
| 0.4525 |
700 |
0.0065 |
- |
- |
- |
- |
- |
| 0.4848 |
750 |
- |
0.0070 |
0.5089 (-0.0315) |
0.3458 (+0.0208) |
0.6809 (+0.1802) |
0.5119 (+0.0565) |
| 0.5171 |
800 |
0.0062 |
- |
- |
- |
- |
- |
| 0.5818 |
900 |
0.0061 |
- |
- |
- |
- |
- |
| 0.6464 |
1000 |
0.0062 |
0.0058 |
0.5470 (+0.0066) |
0.3589 (+0.0339) |
0.6427 (+0.1421) |
0.5162 (+0.0608) |
| 0.7111 |
1100 |
0.0055 |
- |
- |
- |
- |
- |
| 0.7757 |
1200 |
0.0059 |
- |
- |
- |
- |
- |
| 0.8080 |
1250 |
- |
0.0055 |
0.5017 (-0.0388) |
0.3571 (+0.0321) |
0.6484 (+0.1478) |
0.5024 (+0.0470) |
| 0.8403 |
1300 |
0.0059 |
- |
- |
- |
- |
- |
| 0.9050 |
1400 |
0.0049 |
- |
- |
- |
- |
- |
| 0.9696 |
1500 |
0.0055 |
0.0096 |
0.5091 (-0.0313) |
0.3587 (+0.0337) |
0.6442 (+0.1435) |
0.5040 (+0.0486) |
| -1 |
-1 |
- |
- |
0.5101 (-0.0303) |
0.3597 (+0.0347) |
0.6474 (+0.1468) |
0.5057 (+0.0504) |
Framework Versions
- Python: 3.11.10
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0
- PyTorch: 2.5.1+cu124
- Accelerate: 1.2.0
- Datasets: 2.21.0
- Tokenizers: 0.21.0
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",
}