Splade++ SelfDistil finetuned on MS MARCO
This is a SPLADE Sparse Encoder model finetuned from naver/splade-cocondenser-selfdistil using the sentence-transformers library. It maps sentences & paragraphs to a 30522-dimensional sparse vector space and can be used for semantic search and sparse retrieval.
Model Details
Model Description
- Model Type: SPLADE Sparse Encoder
- Base model: naver/splade-cocondenser-selfdistil
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 30522 dimensions
- Similarity Function: Dot Product
- Language: en
- License: apache-2.0
Model Sources
Full Model Architecture
SparseEncoder(
(0): MLMTransformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertForMaskedLM'})
(1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', 'word_embedding_dimension': 30522})
)
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 SparseEncoder
model = SparseEncoder("tomaarsen/splade-cocondenser-selfdistil-msmarco-kldiv-marginmse-minilm-temp-2")
queries = [
"who started gladiator lacrosse",
]
documents = [
'Weed Eater was a string trimmer company founded in 1971 in Houston, Texas by George C. Ballas, Sr. , the inventor of the device. The idea for the Weed Eater trimmer came to him from the spinning nylon bristles of an automatic car wash.He thought that he could come up with a similar technique to protect the bark on trees that he was trimming around. His company was eventually bought by Emerson Electric and merged with Poulan.Poulan/Weed Eater was later purchased by Electrolux, which spun off the outdoors division as Husqvarna AB in 2006.Inventor Ballas was the father of champion ballroom dancer Corky Ballas and the grandfather of Dancing with the Stars dancer Mark Ballas.George Ballas died on June 25, 2011.he idea for the Weed Eater trimmer came to him from the spinning nylon bristles of an automatic car wash. He thought that he could come up with a similar technique to protect the bark on trees that he was trimming around. His company was eventually bought by Emerson Electric and merged with Poulan.',
"The earliest types of gladiator were named after Rome's enemies of that time: the Samnite, Thracian and Gaul. The Samnite, heavily armed, elegantly helmed and probably the most popular type, was renamed Secutor and the Gaul renamed Murmillo, once these former enemies had been conquered then absorbed into Rome's Empire.",
'Summit Hill, PA. Sponsored Topics. Summit Hill is a borough in Carbon County, Pennsylvania, United States. The population was 2,974 at the 2000 census. Summit Hill is located at 40°49â\x80²39â\x80³N 75°51â\x80²57â\x80³W / 40.8275°N 75.86583°W / 40.8275; -75.86583 (40.827420, -75.865892).',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
Evaluation
Metrics
Sparse Information Retrieval
| Metric |
NanoMSMARCO |
NanoNFCorpus |
NanoNQ |
| dot_accuracy@1 |
0.48 |
0.44 |
0.5 |
| dot_accuracy@3 |
0.72 |
0.6 |
0.74 |
| dot_accuracy@5 |
0.76 |
0.64 |
0.86 |
| dot_accuracy@10 |
0.88 |
0.66 |
0.9 |
| dot_precision@1 |
0.48 |
0.44 |
0.5 |
| dot_precision@3 |
0.24 |
0.42 |
0.2533 |
| dot_precision@5 |
0.152 |
0.368 |
0.18 |
| dot_precision@10 |
0.088 |
0.268 |
0.096 |
| dot_recall@1 |
0.48 |
0.0439 |
0.48 |
| dot_recall@3 |
0.72 |
0.1003 |
0.7 |
| dot_recall@5 |
0.76 |
0.1206 |
0.81 |
| dot_recall@10 |
0.88 |
0.14 |
0.86 |
| dot_ndcg@10 |
0.6789 |
0.3503 |
0.6881 |
| dot_mrr@10 |
0.6152 |
0.5247 |
0.6457 |
| dot_map@100 |
0.6237 |
0.1644 |
0.6259 |
| query_active_dims |
51.3 |
47.88 |
56.98 |
| query_sparsity_ratio |
0.9983 |
0.9984 |
0.9981 |
| corpus_active_dims |
457.3064 |
851.705 |
527.3356 |
| corpus_sparsity_ratio |
0.985 |
0.9721 |
0.9827 |
Sparse Nano BEIR
| Metric |
Value |
| dot_accuracy@1 |
0.4733 |
| dot_accuracy@3 |
0.6867 |
| dot_accuracy@5 |
0.7533 |
| dot_accuracy@10 |
0.8133 |
| dot_precision@1 |
0.4733 |
| dot_precision@3 |
0.3044 |
| dot_precision@5 |
0.2333 |
| dot_precision@10 |
0.1507 |
| dot_recall@1 |
0.3346 |
| dot_recall@3 |
0.5068 |
| dot_recall@5 |
0.5635 |
| dot_recall@10 |
0.6267 |
| dot_ndcg@10 |
0.5724 |
| dot_mrr@10 |
0.5952 |
| dot_map@100 |
0.4714 |
| query_active_dims |
52.0533 |
| query_sparsity_ratio |
0.9983 |
| corpus_active_dims |
573.7408 |
| corpus_sparsity_ratio |
0.9812 |
Training Details
Training Dataset
Unnamed Dataset
Evaluation Dataset
Unnamed Dataset
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: steps
per_device_train_batch_size: 16
per_device_eval_batch_size: 16
learning_rate: 2e-05
num_train_epochs: 1
warmup_ratio: 0.1
fp16: True
batch_sampler: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir: False
do_predict: False
eval_strategy: steps
prediction_loss_only: True
per_device_train_batch_size: 16
per_device_eval_batch_size: 16
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: 42
data_seed: None
jit_mode_eval: False
use_ipex: False
bf16: False
fp16: True
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
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: no_duplicates
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
Training Logs
| Epoch |
Step |
Training Loss |
Validation Loss |
NanoMSMARCO_dot_ndcg@10 |
NanoNFCorpus_dot_ndcg@10 |
NanoNQ_dot_ndcg@10 |
NanoBEIR_mean_dot_ndcg@10 |
| -1 |
-1 |
- |
- |
0.6592 |
0.3737 |
0.6949 |
0.5759 |
| 0.0162 |
100 |
0.5304 |
- |
- |
- |
- |
- |
| 0.0323 |
200 |
0.4704 |
- |
- |
- |
- |
- |
| 0.0485 |
300 |
0.516 |
- |
- |
- |
- |
- |
| 0.0646 |
400 |
0.462 |
- |
- |
- |
- |
- |
| 0.0808 |
500 |
0.5311 |
0.5003 |
0.6586 |
0.3597 |
0.7063 |
0.5749 |
| 0.0970 |
600 |
0.5254 |
- |
- |
- |
- |
- |
| 0.1131 |
700 |
0.5476 |
- |
- |
- |
- |
- |
| 0.1293 |
800 |
0.5316 |
- |
- |
- |
- |
- |
| 0.1454 |
900 |
0.5691 |
- |
- |
- |
- |
- |
| 0.1616 |
1000 |
0.573 |
0.5246 |
0.6721 |
0.3488 |
0.6984 |
0.5731 |
| 0.1778 |
1100 |
0.5744 |
- |
- |
- |
- |
- |
| 0.1939 |
1200 |
0.5241 |
- |
- |
- |
- |
- |
| 0.2101 |
1300 |
0.5625 |
- |
- |
- |
- |
- |
| 0.2262 |
1400 |
0.5586 |
- |
- |
- |
- |
- |
| 0.2424 |
1500 |
0.548 |
0.5440 |
0.6709 |
0.3470 |
0.6945 |
0.5708 |
| 0.2586 |
1600 |
0.5765 |
- |
- |
- |
- |
- |
| 0.2747 |
1700 |
0.5324 |
- |
- |
- |
- |
- |
| 0.2909 |
1800 |
0.5751 |
- |
- |
- |
- |
- |
| 0.3070 |
1900 |
0.5612 |
- |
- |
- |
- |
- |
| 0.3232 |
2000 |
0.5056 |
0.5179 |
0.6785 |
0.3605 |
0.6882 |
0.5757 |
| 0.3394 |
2100 |
0.559 |
- |
- |
- |
- |
- |
| 0.3555 |
2200 |
0.5247 |
- |
- |
- |
- |
- |
| 0.3717 |
2300 |
0.5248 |
- |
- |
- |
- |
- |
| 0.3878 |
2400 |
0.5025 |
- |
- |
- |
- |
- |
| 0.4040 |
2500 |
0.5469 |
0.5251 |
0.6981 |
0.3575 |
0.7008 |
0.5855 |
| 0.4202 |
2600 |
0.5467 |
- |
- |
- |
- |
- |
| 0.4363 |
2700 |
0.5039 |
- |
- |
- |
- |
- |
| 0.4525 |
2800 |
0.5484 |
- |
- |
- |
- |
- |
| 0.4686 |
2900 |
0.5004 |
- |
- |
- |
- |
- |
| 0.4848 |
3000 |
0.4987 |
0.5011 |
0.6710 |
0.3578 |
0.6970 |
0.5753 |
| 0.5010 |
3100 |
0.4981 |
- |
- |
- |
- |
- |
| 0.5171 |
3200 |
0.4859 |
- |
- |
- |
- |
- |
| 0.5333 |
3300 |
0.496 |
- |
- |
- |
- |
- |
| 0.5495 |
3400 |
0.4926 |
- |
- |
- |
- |
- |
| 0.5656 |
3500 |
0.5231 |
0.4793 |
0.7063 |
0.3626 |
0.6875 |
0.5855 |
| 0.5818 |
3600 |
0.4681 |
- |
- |
- |
- |
- |
| 0.5979 |
3700 |
0.4892 |
- |
- |
- |
- |
- |
| 0.6141 |
3800 |
0.4765 |
- |
- |
- |
- |
- |
| 0.6303 |
3900 |
0.4622 |
- |
- |
- |
- |
- |
| 0.6464 |
4000 |
0.4893 |
0.4840 |
0.7026 |
0.3620 |
0.6879 |
0.5842 |
| 0.6626 |
4100 |
0.4902 |
- |
- |
- |
- |
- |
| 0.6787 |
4200 |
0.4777 |
- |
- |
- |
- |
- |
| 0.6949 |
4300 |
0.4819 |
- |
- |
- |
- |
- |
| 0.7111 |
4400 |
0.4678 |
- |
- |
- |
- |
- |
| 0.7272 |
4500 |
0.4751 |
0.4619 |
0.6915 |
0.3523 |
0.6919 |
0.5786 |
| 0.7434 |
4600 |
0.4796 |
- |
- |
- |
- |
- |
| 0.7595 |
4700 |
0.4492 |
- |
- |
- |
- |
- |
| 0.7757 |
4800 |
0.4547 |
- |
- |
- |
- |
- |
| 0.7919 |
4900 |
0.4538 |
- |
- |
- |
- |
- |
| 0.8080 |
5000 |
0.4418 |
0.4440 |
0.6851 |
0.3566 |
0.6955 |
0.5791 |
| 0.8242 |
5100 |
0.4634 |
- |
- |
- |
- |
- |
| 0.8403 |
5200 |
0.445 |
- |
- |
- |
- |
- |
| 0.8565 |
5300 |
0.4832 |
- |
- |
- |
- |
- |
| 0.8727 |
5400 |
0.4617 |
- |
- |
- |
- |
- |
| 0.8888 |
5500 |
0.4279 |
0.4578 |
0.6793 |
0.3579 |
0.6941 |
0.5771 |
| 0.9050 |
5600 |
0.4515 |
- |
- |
- |
- |
- |
| 0.9211 |
5700 |
0.4579 |
- |
- |
- |
- |
- |
| 0.9373 |
5800 |
0.4834 |
- |
- |
- |
- |
- |
| 0.9535 |
5900 |
0.4676 |
- |
- |
- |
- |
- |
| 0.9696 |
6000 |
0.4482 |
0.4371 |
0.6809 |
0.3525 |
0.6874 |
0.5736 |
| 0.9858 |
6100 |
0.4829 |
- |
- |
- |
- |
- |
| -1 |
-1 |
- |
- |
0.6789 |
0.3503 |
0.6881 |
0.5724 |
Environmental Impact
Carbon emissions were measured using CodeCarbon.
- Energy Consumed: 0.191 kWh
- Carbon Emitted: 0.074 kg of CO2
- Hours Used: 0.538 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: 4.2.0.dev0
- Transformers: 4.52.4
- PyTorch: 2.7.1+cu126
- Accelerate: 1.5.1
- Datasets: 2.21.0
- Tokenizers: 0.21.1
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",
}
SpladeLoss
@misc{formal2022distillationhardnegativesampling,
title={From Distillation to Hard Negative Sampling: Making Sparse Neural IR Models More Effective},
author={Thibault Formal and Carlos Lassance and Benjamin Piwowarski and Stéphane Clinchant},
year={2022},
eprint={2205.04733},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2205.04733},
}
FlopsLoss
@article{paria2020minimizing,
title={Minimizing flops to learn efficient sparse representations},
author={Paria, Biswajit and Yeh, Chih-Kuan and Yen, Ian EH and Xu, Ning and Ravikumar, Pradeep and P{'o}czos, Barnab{'a}s},
journal={arXiv preprint arXiv:2004.05665},
year={2020}
}