CrossEncoder based on microsoft/MiniLM-L12-H384-uncased
This is a Cross Encoder model finetuned from microsoft/MiniLM-L12-H384-uncased on the ms-marco-shuffled dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: microsoft/MiniLM-L12-H384-uncased
- Maximum Sequence Length: 512 tokens
- Number of Output Labels: 1 label
- Training Dataset:
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
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/reranker-modernbert-base-msmarco-mse")
# Get scores for pairs of texts
pairs = [
['what is a electrophoresis apparatus', 'Gel electrophoresis is a method for separation and analysis of macromolecules (DNA, RNA and proteins) and their fragments, based on their size and charge.el electrophoresis of large DNA or RNA is usually done by agarose gel electrophoresis. See the Chain termination method page for an example of a polyacrylamide DNA sequencing gel. Characterization through ligand interaction of nucleic acids or fragments may be performed by mobility shift affinity electrophoresis.'],
['does creatine elevate creatinine levels', "Creatinine is produced from creatine, a molecule of major importance for energy production in muscles. Approximately 2% of the body's creatine is converted to creatinine every day. Creatinine is transported through the bloodstream to the kidneys."],
['how to get rid of caffeine in the body', 'In addition to quickly curing caffeine withdrawal headaches, caffeine may help cure regular headaches and even migraines. Some studies have shown that small doses of caffeine taken in conjunction with pain killers may help the body absorb the medication more quickly and cure the headache in a shorter period of time.'],
['define splanchnopleure', 'delineated, represented, delineate(verb) represented accurately or precisely. define, delineate(verb) show the form or outline of. The tree was clearly defined by the light; The camera could define the smallest object. specify, define, delineate, delimit, delimitate(verb) determine the essential quality of.'],
['how many calories does a glass of wine', 'A large glass of wine contains as many calories as an ice cream. We often drink wine with a meal. But did you know that a large glass of wine (250ml) with 13% ABV can add 228 calories to your dinner? Thatâ\x80\x99s similar to an ice cream or two fish fingers. A standard glass of red or white wine (175ml) with 13% ABV could also contain up to 160 calories, similar to a slice of Madeira cake.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'what is a electrophoresis apparatus',
[
'Gel electrophoresis is a method for separation and analysis of macromolecules (DNA, RNA and proteins) and their fragments, based on their size and charge.el electrophoresis of large DNA or RNA is usually done by agarose gel electrophoresis. See the Chain termination method page for an example of a polyacrylamide DNA sequencing gel. Characterization through ligand interaction of nucleic acids or fragments may be performed by mobility shift affinity electrophoresis.',
"Creatinine is produced from creatine, a molecule of major importance for energy production in muscles. Approximately 2% of the body's creatine is converted to creatinine every day. Creatinine is transported through the bloodstream to the kidneys.",
'In addition to quickly curing caffeine withdrawal headaches, caffeine may help cure regular headaches and even migraines. Some studies have shown that small doses of caffeine taken in conjunction with pain killers may help the body absorb the medication more quickly and cure the headache in a shorter period of time.',
'delineated, represented, delineate(verb) represented accurately or precisely. define, delineate(verb) show the form or outline of. The tree was clearly defined by the light; The camera could define the smallest object. specify, define, delineate, delimit, delimitate(verb) determine the essential quality of.',
'A large glass of wine contains as many calories as an ice cream. We often drink wine with a meal. But did you know that a large glass of wine (250ml) with 13% ABV can add 228 calories to your dinner? Thatâ\x80\x99s similar to an ice cream or two fish fingers. A standard glass of red or white wine (175ml) with 13% ABV could also contain up to 160 calories, similar to a slice of Madeira cake.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Evaluation
Metrics
Cross Encoder Reranking
- Datasets:
NanoMSMARCO
,NanoNFCorpus
andNanoNQ
- Evaluated with
CERerankingEvaluator
Metric | NanoMSMARCO | NanoNFCorpus | NanoNQ |
---|---|---|---|
map | 0.5979 (+0.1083) | 0.3464 (+0.0760) | 0.6886 (+0.2679) |
mrr@10 | 0.5893 (+0.1118) | 0.6264 (+0.1266) | 0.6962 (+0.2695) |
ndcg@10 | 0.6585 (+0.1181) | 0.3864 (+0.0613) | 0.7366 (+0.2359) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_mean
- Evaluated with
CENanoBEIREvaluator
Metric | Value |
---|---|
map | 0.5443 (+0.1507) |
mrr@10 | 0.6373 (+0.1693) |
ndcg@10 | 0.5938 (+0.1385) |
Training Details
Training Dataset
ms-marco-shuffled
- Dataset: ms-marco-shuffled at 0e80192
- Size: 1,990,000 training samples
- Columns:
score
,query
, andpassage
- Approximate statistics based on the first 1000 samples:
score query passage type float string string details - min: -11.8
- mean: 0.75
- max: 11.16
- min: 9 characters
- mean: 33.33 characters
- max: 123 characters
- min: 53 characters
- mean: 348.8 characters
- max: 1016 characters
- Samples:
score query passage 6.732539335886638
what is shielding in welding
A benefit in using a shielding gas when welding is that there is no slag left on the weld that requires chipping and cleaning like that which is found on an arc weld. When a new wire welding machine is purchased, it does not come with a shielding gas tank. This must be purchased or rented from a gas supplier. Most welding supply stores also sell welding gasses and will be able to assist the buyer in a tank purchase.
-5.769245758652687
what degree do you need for physical therapy
E. Medicaid covers occupational therapy, physical therapy and speech therapy services when provided to eligible Medicaid beneficiaries under age 21 in the Child Health Services (EPSDT) Program by qualified occupational, physical or speech therapy providers.
9.033631960550943
cascade effect definition
In medicine, cascade effect may also refer to a chain of events initiated by an unnecessary test, an unexpected result, or patient or physician anxiety, which results in ill-advised tests or treatments that may cause harm to patients as the results are pursued.
- Loss:
MSELoss
Evaluation Dataset
ms-marco-shuffled
- Dataset: ms-marco-shuffled at 0e80192
- Size: 10,000 evaluation samples
- Columns:
score
,query
, andpassage
- Approximate statistics based on the first 1000 samples:
score query passage type float string string details - min: -11.86
- mean: 0.72
- max: 11.07
- min: 10 characters
- mean: 33.83 characters
- max: 101 characters
- min: 50 characters
- mean: 343.73 characters
- max: 929 characters
- Samples:
score query passage 4.691008905569713
what is a electrophoresis apparatus
Gel electrophoresis is a method for separation and analysis of macromolecules (DNA, RNA and proteins) and their fragments, based on their size and charge.el electrophoresis of large DNA or RNA is usually done by agarose gel electrophoresis. See the Chain termination method page for an example of a polyacrylamide DNA sequencing gel. Characterization through ligand interaction of nucleic acids or fragments may be performed by mobility shift affinity electrophoresis.
0.7860534191131592
does creatine elevate creatinine levels
Creatinine is produced from creatine, a molecule of major importance for energy production in muscles. Approximately 2% of the body's creatine is converted to creatinine every day. Creatinine is transported through the bloodstream to the kidneys.
-1.2669222354888916
how to get rid of caffeine in the body
In addition to quickly curing caffeine withdrawal headaches, caffeine may help cure regular headaches and even migraines. Some studies have shown that small doses of caffeine taken in conjunction with pain killers may help the body absorb the medication more quickly and cure the headache in a shorter period of time.
- Loss:
MSELoss
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 64per_device_eval_batch_size
: 64learning_rate
: 8e-06num_train_epochs
: 1warmup_ratio
: 0.1seed
: 12bf16
: Truedataloader_num_workers
: 4load_best_model_at_end
: True
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 64per_device_eval_batch_size
: 64per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 8e-06weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.1warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 12data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Truefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 4dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Trueignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss | NanoMSMARCO_ndcg@10 | NanoNFCorpus_ndcg@10 | NanoNQ_ndcg@10 | NanoBEIR_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | - | 0.0219 (-0.5185) | 0.2538 (-0.0712) | 0.0498 (-0.4509) | 0.1085 (-0.3469) |
0.0000 | 1 | 64.054 | - | - | - | - | - |
0.0322 | 1000 | 55.8586 | - | - | - | - | - |
0.0643 | 2000 | 31.6183 | - | - | - | - | - |
0.0965 | 3000 | 13.1762 | - | - | - | - | - |
0.1286 | 4000 | 6.1773 | - | - | - | - | - |
0.1608 | 5000 | 4.2945 | 3.4889 | 0.6180 (+0.0776) | 0.3893 (+0.0643) | 0.7144 (+0.2137) | 0.5739 (+0.1185) |
0.1930 | 6000 | 3.6451 | - | - | - | - | - |
0.2251 | 7000 | 3.3041 | - | - | - | - | - |
0.2573 | 8000 | 2.9813 | - | - | - | - | - |
0.2894 | 9000 | 2.8473 | - | - | - | - | - |
0.3216 | 10000 | 2.6852 | 2.6960 | 0.6124 (+0.0720) | 0.3992 (+0.0742) | 0.7315 (+0.2309) | 0.5811 (+0.1257) |
0.3538 | 11000 | 2.6128 | - | - | - | - | - |
0.3859 | 12000 | 2.5252 | - | - | - | - | - |
0.4181 | 13000 | 2.461 | - | - | - | - | - |
0.4502 | 14000 | 2.3625 | - | - | - | - | - |
0.4824 | 15000 | 2.2746 | 2.0279 | 0.6397 (+0.0993) | 0.3963 (+0.0713) | 0.7369 (+0.2363) | 0.5910 (+0.1356) |
0.5146 | 16000 | 2.2551 | - | - | - | - | - |
0.5467 | 17000 | 2.2193 | - | - | - | - | - |
0.5789 | 18000 | 2.2099 | - | - | - | - | - |
0.6111 | 19000 | 2.1277 | - | - | - | - | - |
0.6432 | 20000 | 2.0969 | 1.9564 | 0.6468 (+0.1063) | 0.3936 (+0.0685) | 0.7391 (+0.2385) | 0.5932 (+0.1378) |
0.6754 | 21000 | 2.0624 | - | - | - | - | - |
0.7075 | 22000 | 2.0565 | - | - | - | - | - |
0.7397 | 23000 | 2.0226 | - | - | - | - | - |
0.7719 | 24000 | 1.9583 | - | - | - | - | - |
0.8040 | 25000 | 2.0048 | 1.8239 | 0.6575 (+0.1171) | 0.3884 (+0.0634) | 0.7339 (+0.2333) | 0.5933 (+0.1379) |
0.8362 | 26000 | 1.9861 | - | - | - | - | - |
0.8683 | 27000 | 1.9675 | - | - | - | - | - |
0.9005 | 28000 | 1.9531 | - | - | - | - | - |
0.9327 | 29000 | 1.9139 | - | - | - | - | - |
0.9648 | 30000 | 1.9224 | 1.7848 | 0.6585 (+0.1181) | 0.3864 (+0.0613) | 0.7366 (+0.2359) | 0.5938 (+0.1385) |
0.9970 | 31000 | 1.9059 | - | - | - | - | - |
-1 | -1 | - | - | 0.6585 (+0.1181) | 0.3864 (+0.0613) | 0.7366 (+0.2359) | 0.5938 (+0.1385) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.10
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0.dev0
- PyTorch: 2.6.0.dev20241112+cu121
- Accelerate: 1.2.0
- Datasets: 3.2.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",
}
- Downloads last month
- 16
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The HF Inference API does not support text-classification models for sentence-transformers library.
Model tree for tomaarsen/reranker-MiniLM-L12-H384-msmarco-mse
Base model
microsoft/MiniLM-L12-H384-uncased