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 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: microsoft/MiniLM-L12-H384-uncased
- Maximum Sequence Length: 512 tokens
- Number of Output Labels: 1 label
- Training Dataset:
- Language: en
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-msmarco-v1.1-MiniLM-L12-H384-uncased-plistmle-sum-to-1")
# Get scores for pairs of texts
pairs = [
['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (3,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'How many calories in an egg',
[
'There are on average between 55 and 80 calories in an egg depending on its size.',
'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
'Most of the calories in an egg come from the yellow yolk in the center.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Evaluation
Metrics
Cross Encoder Reranking
- Datasets:
NanoMSMARCO_R100
,NanoNFCorpus_R100
andNanoNQ_R100
- Evaluated with
CrossEncoderRerankingEvaluator
with these parameters:{ "at_k": 10, "always_rerank_positives": true }
Metric | NanoMSMARCO_R100 | NanoNFCorpus_R100 | NanoNQ_R100 |
---|---|---|---|
map | 0.4779 (-0.0116) | 0.3322 (+0.0712) | 0.5906 (+0.1710) |
mrr@10 | 0.4676 (-0.0099) | 0.5765 (+0.0767) | 0.5981 (+0.1714) |
ndcg@10 | 0.5461 (+0.0057) | 0.3701 (+0.0450) | 0.6559 (+0.1552) |
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.4669 (+0.0768) |
mrr@10 | 0.5474 (+0.0794) |
ndcg@10 | 0.5240 (+0.0686) |
Training Details
Training Dataset
ms_marco
- Dataset: ms_marco at a47ee7a
- Size: 78,704 training samples
- Columns:
query
,docs
, andlabels
- Approximate statistics based on the first 1000 samples:
query docs labels type string list list details - min: 11 characters
- mean: 33.5 characters
- max: 113 characters
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
- Samples:
query docs labels what does it cost to remove a tree stump
['Stump removal costs will vary depending on a variety of things, most notably whether you do it yourself or hire a professional. By learning about the costs and prices associated with removing a tree stump, you will avoid unpleasant surprises. Learn more about stump removal prices with our cost guide below. The average cost to remove a tree stump ranges from $60 to $350 per stump, depending on various factors like size. The average removal cost breaks down to approximately $2 to $3 per diameter of the stump. If you do it yourself, it may only cost you about $75 to $150.', 'Get an INSTANT estimate of the cost to Grind a Large Tree Stump! Our free calculator uses recent, trusted data to estimate costs for your Large Stump Grinding project. For a basic 1 stump project in zip code 47474, the benchmark cost to Grind a Large Tree Stump ranges between $87.22 - $150.54 per stump.', 'Tree limb removal costs vary, but it is usually between $50 and $75. Additional services that may be added on f...
[1, 0, 0, 0, 0, ...]
what is the currency used in tenerife
['Language: The language spoken in Tenerife is Spanish. Currency: The currency used in Tenerife is Euro (€). Local time: Tenerife is 1 hour ahead of GMT/UK time. Fly to: Tenerife has two airports. Tenerife South, near the island’s most popular resorts, is larger and busier than Tenerife North, which is about 11km west of the capital. Tenerife is the largest and most developed Canary Island. Attractive beaches, watersports and exciting adventures to Loro Parque, Siam Park and the cliffs of Los Gigantes make holidays to Tenerife popular year after year, offering activities for everyone to enjoy.', 'Due to Tenerife being a part of Spain, the currency is the Euro. 1 The Pegged Exchange Rate and Modern Money Markets A pegged exchange rate is used when a government fixes the exchange rate of its currency for other currencies, and is also called a fixed exchange rate.', 'Santa Cruz The capital of Tenerife is Santa Cruz de Tenerife which is also, together with Las Palmas on Gran Canaria, the c...
[1, 0, 0, 0, 0, ...]
what is the average salary for a tax consultant
['According to a salary survey, a tax consultant earns almost $325,000 per year on an average. This is applicable for the period 2008 to 2012. And at present, the average salary for a tax consultant in UK is £38,500. In this nation, working 250 days a year and 8 hours a day fetches an hourly rate of £20.18. Overall, the hourly rate actually depends on how much messy the work is and how highly qualified a tax consultant is! The factors that affect the hourly pay rate for tax consultant are the area in which the consultant is operating, experience level, complexity of tax return, and the type of company for whom the service is provided. A CPA candidate or a staff bookkeeper would get almost $65-$85 per hour for sorting out the receipts.', 'With regard to age and impact on salary for a Tax Consultant, a statistical average weighting (that is based on how salary varies by age and not for a specific job which may vary considerably) suggests these figures: £30,560 for a worker in their 20s, ...
[1, 0, 0, 0, 0, ...]
- Loss:
PListMLELoss
with these parameters:{ "lambda_weight": "sentence_transformers.cross_encoder.losses.PListMLELoss.PListMLELambdaWeight", "activation_fct": "torch.nn.modules.linear.Identity", "mini_batch_size": 16, "respect_input_order": true }
Evaluation Dataset
ms_marco
- Dataset: ms_marco at a47ee7a
- Size: 1,000 evaluation samples
- Columns:
query
,docs
, andlabels
- Approximate statistics based on the first 1000 samples:
query docs labels type string list list details - min: 9 characters
- mean: 33.37 characters
- max: 105 characters
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
- Samples:
query docs labels what is mosfet transistor
['Mosfet Transistor. A MOSFET transistor is a semiconductor device which is widely used to switch the amplification signals in the electronic devices. MOSFET can be expanded metal-oxide-semiconductor field-effect transistor that is used to influence the flow of electric charges by influencing the flow of the charges to greater extent. The major advantage of the MOSFET transistor is that it uses low power for accomplishing its purpose and the dissipation of power in terms of loss is very llittle, which makes it a major component in the modern computers and electronic devices like the cell phones, digital watches, small robotic toys and calculators.', 'A transistor is used to amplify and switch electronic signals and electrical power. They are used in a variety of circuits and they come in many different shapes. You can use a transistor as a switch or you can use a transistor as an amplifier. Metal-oxide-semiconductor field-effect transistor is a type of transistor commonly found in digi...
[1, 0, 0, 0, 0, ...]
what was the most famous native american massacres
["The Massacre at Bear River took place in 1863 when heightened tensions between the Native Americans and federal troops from the California reserves reached a tipping point. Remembering those passed: Patty Timbimboo-Madsen is a descendant of one of the few survivors from the Bear River Massacre which took place in 1863. Native Americans remember 'forgotten' massacre that left 450 dead in vicious attack during the Civil War. By Daily Mail Reporter. Published: 00:47 EST, 30 January 2013
Updated: 01:00 EST, 30 January 2013.", "While the Native Americans had collected a few firearms from various raids on other villages, their weapons were nothing compared to the guns used by the soldiers. Because this battle took place in the midst of the Civil War, Colonel Connor's men from the California Volunteers were armed with federally-issued guns. Native Americans remember 'forgotten' massacre that left 450 dead in vicious attack during the Civil War. By Daily Mail Reporter. Published: 00:47 EST... where is canberra located
["168 pages on this wiki. Canberra is the capital city of Australia and with a population of over 332,000, is Australia's largest inland city. The city is located at the northern end of the Australian Capital Territory, 300 kilometres (190 mi) southwest of Sydney, and 650 kilometres (400 mi) north-east of Melbourne. ", "it looks as though the author of this plan ... had been carefully reading books upon town planning without having much more theoretical knowledge to go upon. Canberra, in the Australian Capital Territory, is Australia's capital city. ", 'Canberra is a city/town with a medium population in the state/region of Australian Capital Territory, Australia which is located in the continent/region of Oceania. Cities, towns and places near Canberra include City, Reid, Braddon and Turner. ', 'History [edit]. Canberra was established in 1913 as the capital for the newly federated Australian nation. The ACT was excised from New South Wales and put under the control of the federal gov...
[1, 0, 0, 0, 0, ...]
- Loss:
PListMLELoss
with these parameters:{ "lambda_weight": "sentence_transformers.cross_encoder.losses.PListMLELoss.PListMLELambdaWeight", "activation_fct": "torch.nn.modules.linear.Identity", "mini_batch_size": 16, "respect_input_order": true }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 16per_device_eval_batch_size
: 16learning_rate
: 2e-05num_train_epochs
: 1warmup_ratio
: 0.1seed
: 12bf16
: Trueload_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
: 16per_device_eval_batch_size
: 16per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 2e-05weight_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
: 0dataloader_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_R100_ndcg@10 | NanoNFCorpus_R100_ndcg@10 | NanoNQ_R100_ndcg@10 | NanoBEIR_R100_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | - | 0.0293 (-0.5111) | 0.2379 (-0.0872) | 0.0249 (-0.4757) | 0.0974 (-0.3580) |
0.0002 | 1 | 2.1926 | - | - | - | - | - |
0.0508 | 250 | 2.1 | - | - | - | - | - |
0.1016 | 500 | 1.9636 | 1.9124 | 0.2430 (-0.2975) | 0.2494 (-0.0756) | 0.3521 (-0.1486) | 0.2815 (-0.1739) |
0.1525 | 750 | 1.9151 | - | - | - | - | - |
0.2033 | 1000 | 1.8844 | 1.8574 | 0.4329 (-0.1076) | 0.3198 (-0.0053) | 0.6016 (+0.1009) | 0.4514 (-0.0040) |
0.2541 | 1250 | 1.8748 | - | - | - | - | - |
0.3049 | 1500 | 1.8636 | 1.8745 | 0.5198 (-0.0206) | 0.3698 (+0.0447) | 0.6365 (+0.1358) | 0.5087 (+0.0533) |
0.3558 | 1750 | 1.854 | - | - | - | - | - |
0.4066 | 2000 | 1.8437 | 1.8239 | 0.4936 (-0.0469) | 0.3820 (+0.0570) | 0.6065 (+0.1059) | 0.4940 (+0.0387) |
0.4574 | 2250 | 1.843 | - | - | - | - | - |
0.5082 | 2500 | 1.8509 | 1.8222 | 0.5435 (+0.0031) | 0.3720 (+0.0469) | 0.6201 (+0.1195) | 0.5119 (+0.0565) |
0.5591 | 2750 | 1.842 | - | - | - | - | - |
0.6099 | 3000 | 1.83 | 1.8252 | 0.5303 (-0.0101) | 0.3629 (+0.0379) | 0.6177 (+0.1171) | 0.5037 (+0.0483) |
0.6607 | 3250 | 1.8293 | - | - | - | - | - |
0.7115 | 3500 | 1.8254 | 1.8177 | 0.5461 (+0.0057) | 0.3701 (+0.0450) | 0.6559 (+0.1552) | 0.5240 (+0.0686) |
0.7624 | 3750 | 1.8163 | - | - | - | - | - |
0.8132 | 4000 | 1.8338 | 1.8092 | 0.5555 (+0.0151) | 0.3650 (+0.0400) | 0.6347 (+0.1340) | 0.5184 (+0.0630) |
0.8640 | 4250 | 1.8233 | - | - | - | - | - |
0.9148 | 4500 | 1.8127 | 1.8116 | 0.5512 (+0.0108) | 0.3737 (+0.0487) | 0.6424 (+0.1417) | 0.5224 (+0.0671) |
0.9656 | 4750 | 1.8255 | - | - | - | - | - |
-1 | -1 | - | - | 0.5461 (+0.0057) | 0.3701 (+0.0450) | 0.6559 (+0.1552) | 0.5240 (+0.0686) |
- The bold row denotes the saved checkpoint.
Environmental Impact
Carbon emissions were measured using CodeCarbon.
- Energy Consumed: 0.235 kWh
- Carbon Emitted: 0.091 kg of CO2
- Hours Used: 0.881 hours
Training Hardware
- On Cloud: No
- GPU Model: 1 x NVIDIA GeForce RTX 3090
- CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
- RAM Size: 31.78 GB
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0
- PyTorch: 2.6.0+cu124
- Accelerate: 1.5.1
- Datasets: 3.3.2
- 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",
}
PListMLELoss
@inproceedings{lan2014position,
title={Position-Aware ListMLE: A Sequential Learning Process for Ranking.},
author={Lan, Yanyan and Zhu, Yadong and Guo, Jiafeng and Niu, Shuzi and Cheng, Xueqi},
booktitle={UAI},
volume={14},
pages={449--458},
year={2014}
}
- Downloads last month
- 2
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for tomaarsen/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-plistmle-sum-to-1
Base model
microsoft/MiniLM-L12-H384-uncasedDataset used to train tomaarsen/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-plistmle-sum-to-1
Evaluation results
- Map on NanoMSMARCO R100self-reported0.478
- Mrr@10 on NanoMSMARCO R100self-reported0.468
- Ndcg@10 on NanoMSMARCO R100self-reported0.546
- Map on NanoNFCorpus R100self-reported0.332
- Mrr@10 on NanoNFCorpus R100self-reported0.577
- Ndcg@10 on NanoNFCorpus R100self-reported0.370
- Map on NanoNQ R100self-reported0.591
- Mrr@10 on NanoNQ R100self-reported0.598
- Ndcg@10 on NanoNQ R100self-reported0.656
- Map on NanoBEIR R100 meanself-reported0.467