How to use from the
Use from the
sentence-transformers library
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("capemox/splade-ettin-encoder-17m-gooaq")

sentences = [
    "The weather is lovely today.",
    "It's so sunny outside!",
    "He drove to the stadium."
]
embeddings = model.encode(sentences)

similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

splade-ettin-encoder-17m trained on GooAQ

This is a SPLADE Sparse Encoder model finetuned from jhu-clsp/ettin-encoder-17m on the gooaq dataset using the sentence-transformers library. It maps sentences & paragraphs to a 50368-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: jhu-clsp/ettin-encoder-17m
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 50368 dimensions
  • Similarity Function: Dot Product
  • Supported Modality: Text
  • Training Dataset:
  • Language: en
  • License: mit

Model Sources

Full Model Architecture

SparseEncoder(
  (0): Transformer({'transformer_task': 'fill-mask', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'token_embeddings', 'architecture': 'ModernBertForMaskedLM'})
  (1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', 'embedding_dimension': 50368})
)

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

# Download from the 🤗 Hub
model = SparseEncoder("capemox/splade-ettin-encoder-17m-gooaq")
# Run inference
sentences = [
    'how close is the closest star?',
    'The two main stars are Alpha Centauri A and Alpha Centauri B, which form a binary pair. They are an average of 4.3 light-years from Earth. The third star is Proxima Centauri. It is about 4.22 light-years from Earth and is the closest star other than the sun.',
    'One gallon can of paint will cover up to 400 square feet, which is enough to cover a small room like a bathroom. Two gallon cans of paint cover up to 800 square feet, which is enough to cover an average size room. This is the most common amount needed, especially when considering second coat coverage.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 50368]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[144.9772, 158.3885, 140.6785],
#         [158.3885, 496.0056, 344.2902],
#         [140.6785, 344.2902, 528.3322]])

Evaluation

Metrics

Sparse Information Retrieval

  • Datasets: NanoMSMARCO_256, NanoNFCorpus_256, NanoNQ_256, NanoClimateFEVER_256, NanoDBPedia_256, NanoFEVER_256, NanoFiQA2018_256, NanoHotpotQA_256, NanoMSMARCO_256, NanoNFCorpus_256, NanoNQ_256, NanoQuoraRetrieval_256, NanoSCIDOCS_256, NanoArguAna_256, NanoSciFact_256 and NanoTouche2020_256
  • Evaluated with SparseInformationRetrievalEvaluator with these parameters:
    {
        "max_active_dims": 256
    }
    
Metric NanoMSMARCO_256 NanoNFCorpus_256 NanoNQ_256 NanoClimateFEVER_256 NanoDBPedia_256 NanoFEVER_256 NanoFiQA2018_256 NanoHotpotQA_256 NanoQuoraRetrieval_256 NanoSCIDOCS_256 NanoArguAna_256 NanoSciFact_256 NanoTouche2020_256
dot_accuracy@1 0.2 0.22 0.1 0.2 0.4 0.34 0.18 0.58 0.16 0.34 0.04 0.3 0.4898
dot_accuracy@3 0.34 0.34 0.28 0.38 0.66 0.7 0.3 0.7 0.38 0.5 0.32 0.44 0.7755
dot_accuracy@5 0.42 0.38 0.4 0.42 0.74 0.78 0.4 0.78 0.4 0.58 0.42 0.64 0.8776
dot_accuracy@10 0.6 0.52 0.54 0.48 0.84 0.92 0.44 0.84 0.46 0.72 0.48 0.7 0.9796
dot_precision@1 0.2 0.22 0.1 0.2 0.4 0.34 0.18 0.58 0.16 0.34 0.04 0.3 0.4898
dot_precision@3 0.1133 0.1933 0.0933 0.1267 0.3733 0.2333 0.14 0.32 0.1267 0.22 0.1067 0.1533 0.4218
dot_precision@5 0.084 0.18 0.08 0.092 0.348 0.156 0.124 0.216 0.08 0.18 0.084 0.14 0.4
dot_precision@10 0.06 0.14 0.058 0.066 0.324 0.094 0.074 0.126 0.048 0.138 0.048 0.078 0.3469
dot_recall@1 0.2 0.0069 0.09 0.085 0.0438 0.3067 0.0822 0.29 0.16 0.0727 0.04 0.275 0.034
dot_recall@3 0.34 0.0187 0.25 0.1783 0.0853 0.6567 0.1734 0.48 0.354 0.1377 0.32 0.42 0.0824
dot_recall@5 0.42 0.0306 0.36 0.2 0.1356 0.7367 0.2406 0.54 0.374 0.1857 0.42 0.61 0.1281
dot_recall@10 0.6 0.0458 0.52 0.26 0.2097 0.8767 0.2906 0.63 0.444 0.2837 0.48 0.68 0.2193
dot_ndcg@10 0.3714 0.1571 0.2925 0.2151 0.3792 0.5965 0.2237 0.5601 0.3147 0.2673 0.2567 0.4731 0.389
dot_mrr@10 0.302 0.2964 0.2323 0.2989 0.5519 0.5313 0.2532 0.6587 0.277 0.4424 0.1845 0.4177 0.6561
dot_map@100 0.3209 0.0466 0.2305 0.1742 0.2587 0.4997 0.1863 0.494 0.2826 0.1904 0.1898 0.4079 0.27
query_active_dims 252.1 255.62 256.0 256.0 253.96 256.0 240.22 256.0 229.0 256.0 256.0 256.0 216.8571
query_sparsity_ratio 0.995 0.9949 0.9949 0.9949 0.995 0.9949 0.9952 0.9949 0.9955 0.9949 0.9949 0.9949 0.9957
corpus_active_dims 256.0 256.0 256.0 256.0 256.0 256.0 256.0 256.0 234.9956 256.0 256.0 256.0 255.9241
corpus_sparsity_ratio 0.9949 0.9949 0.9949 0.9949 0.9949 0.9949 0.9949 0.9949 0.9953 0.9949 0.9949 0.9949 0.9949
avg_flops 104.6667 101.2659 114.127 129.3998 108.9664 120.7999 116.0173 114.6017 119.7198 123.3701 150.7188 129.6654 86.4117

Sparse Nano BEIR

  • Dataset: NanoBEIR_mean_256
  • Evaluated with SparseNanoBEIREvaluator with these parameters:
    {
        "dataset_names": [
            "msmarco",
            "nfcorpus",
            "nq"
        ],
        "dataset_id": "sentence-transformers/NanoBEIR-en",
        "max_active_dims": 256
    }
    
Metric Value
dot_accuracy@1 0.18
dot_accuracy@3 0.3267
dot_accuracy@5 0.42
dot_accuracy@10 0.54
dot_precision@1 0.18
dot_precision@3 0.1356
dot_precision@5 0.1173
dot_precision@10 0.0867
dot_recall@1 0.0991
dot_recall@3 0.2158
dot_recall@5 0.2848
dot_recall@10 0.379
dot_ndcg@10 0.273
dot_mrr@10 0.2783
dot_map@100 0.1991
query_active_dims 254.54
query_sparsity_ratio 0.9949
corpus_active_dims 256.0
corpus_sparsity_ratio 0.9949
avg_flops 105.0486

Sparse Nano BEIR

  • Dataset: NanoBEIR_mean_256
  • Evaluated with SparseNanoBEIREvaluator with these parameters:
    {
        "dataset_names": [
            "climatefever",
            "dbpedia",
            "fever",
            "fiqa2018",
            "hotpotqa",
            "msmarco",
            "nfcorpus",
            "nq",
            "quoraretrieval",
            "scidocs",
            "arguana",
            "scifact",
            "touche2020"
        ],
        "dataset_id": "sentence-transformers/NanoBEIR-en",
        "max_active_dims": 256
    }
    
Metric Value
dot_accuracy@1 0.2731
dot_accuracy@3 0.4704
dot_accuracy@5 0.5567
dot_accuracy@10 0.6554
dot_precision@1 0.2731
dot_precision@3 0.2017
dot_precision@5 0.1665
dot_precision@10 0.1231
dot_recall@1 0.1297
dot_recall@3 0.269
dot_recall@5 0.337
dot_recall@10 0.4261
dot_ndcg@10 0.3459
dot_mrr@10 0.3925
dot_map@100 0.2732
query_active_dims 249.2619
query_sparsity_ratio 0.9951
corpus_active_dims 254.1114
corpus_sparsity_ratio 0.995
avg_flops 109.026

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: 8 tokens
    • mean: 11.93 tokens
    • max: 21 tokens
    • min: 15 tokens
    • mean: 58.27 tokens
    • max: 137 tokens
  • 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: SpladeLoss with these parameters:
    {
        "loss": "SparseMultipleNegativesRankingLoss(scale=1.0, similarity_fct='dot_score', gather_across_devices=False, directions=('query_to_doc',), partition_mode='joint', hardness_mode=None, hardness_strength=0.0)",
        "document_regularizer_weight": 3e-05,
        "query_regularizer_weight": 5e-05
    }
    

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: 8 tokens
    • mean: 12.05 tokens
    • max: 23 tokens
    • min: 15 tokens
    • mean: 58.98 tokens
    • max: 186 tokens
  • 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: SpladeLoss with these parameters:
    {
        "loss": "SparseMultipleNegativesRankingLoss(scale=1.0, similarity_fct='dot_score', gather_across_devices=False, directions=('query_to_doc',), partition_mode='joint', hardness_mode=None, hardness_strength=0.0)",
        "document_regularizer_weight": 3e-05,
        "query_regularizer_weight": 5e-05
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • num_train_epochs: 1
  • learning_rate: 2e-05
  • bf16: True
  • per_device_eval_batch_size: 32
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 32
  • num_train_epochs: 1
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 1
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: True
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: trackio
  • per_device_eval_batch_size: 32
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: []
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • 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_256_dot_ndcg@10 NanoNFCorpus_256_dot_ndcg@10 NanoNQ_256_dot_ndcg@10 NanoBEIR_mean_256_dot_ndcg@10 NanoClimateFEVER_256_dot_ndcg@10 NanoDBPedia_256_dot_ndcg@10 NanoFEVER_256_dot_ndcg@10 NanoFiQA2018_256_dot_ndcg@10 NanoHotpotQA_256_dot_ndcg@10 NanoQuoraRetrieval_256_dot_ndcg@10 NanoSCIDOCS_256_dot_ndcg@10 NanoArguAna_256_dot_ndcg@10 NanoSciFact_256_dot_ndcg@10 NanoTouche2020_256_dot_ndcg@10
0.0323 100 954.7106 - - - - - - - - - - - - - - -
0.0646 200 17.8241 - - - - - - - - - - - - - - -
0.0970 300 4.5136 - - - - - - - - - - - - - - -
0.1293 400 2.5427 - - - - - - - - - - - - - - -
0.1616 500 1.4733 - - - - - - - - - - - - - - -
0.1939 600 1.0940 - - - - - - - - - - - - - - -
0.1972 610 - 0.8522 0.1440 0.0453 0.0771 0.0888 - - - - - - - - - -
0.2262 700 0.7541 - - - - - - - - - - - - - - -
0.2586 800 0.7425 - - - - - - - - - - - - - - -
0.2909 900 0.5966 - - - - - - - - - - - - - - -
0.3232 1000 0.5606 - - - - - - - - - - - - - - -
0.3555 1100 0.5440 - - - - - - - - - - - - - - -
0.3878 1200 0.4032 - - - - - - - - - - - - - - -
0.3943 1220 - 0.4165 0.2494 0.0613 0.2065 0.1724 - - - - - - - - - -
0.4202 1300 0.3995 - - - - - - - - - - - - - - -
0.4525 1400 0.2976 - - - - - - - - - - - - - - -
0.4848 1500 0.2971 - - - - - - - - - - - - - - -
0.5171 1600 0.2716 - - - - - - - - - - - - - - -
0.5495 1700 0.2577 - - - - - - - - - - - - - - -
0.5818 1800 0.2370 - - - - - - - - - - - - - - -
0.5915 1830 - 0.2104 0.3406 0.1173 0.2414 0.2331 - - - - - - - - - -
0.6141 1900 0.2360 - - - - - - - - - - - - - - -
0.6464 2000 0.2238 - - - - - - - - - - - - - - -
0.6787 2100 0.2237 - - - - - - - - - - - - - - -
0.7111 2200 0.2162 - - - - - - - - - - - - - - -
0.7434 2300 0.2044 - - - - - - - - - - - - - - -
0.7757 2400 0.2202 - - - - - - - - - - - - - - -
0.7886 2440 - 0.1736 0.3932 0.1545 0.2717 0.2731 - - - - - - - - - -
0.8080 2500 0.1672 - - - - - - - - - - - - - - -
0.8403 2600 0.2122 - - - - - - - - - - - - - - -
0.8727 2700 0.1704 - - - - - - - - - - - - - - -
0.9050 2800 0.1870 - - - - - - - - - - - - - - -
0.9373 2900 0.1671 - - - - - - - - - - - - - - -
0.9696 3000 0.1386 - - - - - - - - - - - - - - -
0.9858 3050 - 0.17 0.3714 0.1571 0.2925 0.2737 - - - - - - - - - -
1.0 3094 - 0.1706 0.3675 0.1624 0.2892 0.2730 - - - - - - - - - -
-1 -1 - - 0.3714 0.1571 0.2925 0.3459 0.2151 0.3792 0.5965 0.2237 0.5601 0.3147 0.2673 0.2567 0.4731 0.3890
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 7.7 minutes
  • Evaluation: 2.0 minutes
  • Total: 9.7 minutes

Framework Versions

  • Python: 3.12.3
  • Sentence Transformers: 5.4.1
  • Transformers: 5.5.4
  • PyTorch: 2.11.0+cu130
  • Accelerate: 1.13.0
  • Datasets: 4.8.4
  • Tokenizers: 0.22.2

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},
}

SparseMultipleNegativesRankingLoss

@misc{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}

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}
}
Downloads last month
20
Safetensors
Model size
16.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for capemox/splade-ettin-encoder-17m-gooaq

Finetuned
(27)
this model

Dataset used to train capemox/splade-ettin-encoder-17m-gooaq

Papers for capemox/splade-ettin-encoder-17m-gooaq

Evaluation results