CoolFace
Modelpublic

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

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes91downloads
Model Card

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 <!-- at revision 987607455c61e7a5bbc85f7758e0512ea6d0ae4c -->
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 50368 dimensions
  • Similarity Function: Dot Product
  • Supported Modality: Text
  • Training Dataset:
  • gooaq
  • 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:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
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]])

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

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 <code>SparseInformationRetrievalEvaluator</code> with these parameters:
json
  {
      "max_active_dims": 256
  }
MetricNanoMSMARCO_256NanoNFCorpus_256NanoNQ_256NanoClimateFEVER_256NanoDBPedia_256NanoFEVER_256NanoFiQA2018_256NanoHotpotQA_256NanoQuoraRetrieval_256NanoSCIDOCS_256NanoArguAna_256NanoSciFact_256NanoTouche2020_256
dot_accuracy@10.20.220.10.20.40.340.180.580.160.340.040.30.4898
dot_accuracy@30.340.340.280.380.660.70.30.70.380.50.320.440.7755
dot_accuracy@50.420.380.40.420.740.780.40.780.40.580.420.640.8776
dot_accuracy@100.60.520.540.480.840.920.440.840.460.720.480.70.9796
dot_precision@10.20.220.10.20.40.340.180.580.160.340.040.30.4898
dot_precision@30.11330.19330.09330.12670.37330.23330.140.320.12670.220.10670.15330.4218
dot_precision@50.0840.180.080.0920.3480.1560.1240.2160.080.180.0840.140.4
dot_precision@100.060.140.0580.0660.3240.0940.0740.1260.0480.1380.0480.0780.3469
dot_recall@10.20.00690.090.0850.04380.30670.08220.290.160.07270.040.2750.034
dot_recall@30.340.01870.250.17830.08530.65670.17340.480.3540.13770.320.420.0824
dot_recall@50.420.03060.360.20.13560.73670.24060.540.3740.18570.420.610.1281
dot_recall@100.60.04580.520.260.20970.87670.29060.630.4440.28370.480.680.2193
dot_ndcg@100.37140.15710.29250.21510.37920.59650.22370.56010.31470.26730.25670.47310.389
dot_mrr@100.3020.29640.23230.29890.55190.53130.25320.65870.2770.44240.18450.41770.6561
dot_map@1000.32090.04660.23050.17420.25870.49970.18630.4940.28260.19040.18980.40790.27
queryactivedims252.1255.62256.0256.0253.96256.0240.22256.0229.0256.0256.0256.0216.8571
querysparsityratio0.9950.99490.99490.99490.9950.99490.99520.99490.99550.99490.99490.99490.9957
corpusactivedims256.0256.0256.0256.0256.0256.0256.0256.0234.9956256.0256.0256.0255.9241
corpussparsityratio0.99490.99490.99490.99490.99490.99490.99490.99490.99530.99490.99490.99490.9949
avg_flops104.6667101.2659114.127129.3998108.9664120.7999116.0173114.6017119.7198123.3701150.7188129.665486.4117
Sparse Nano BEIR
json
  {
      "dataset_names": [
          "msmarco",
          "nfcorpus",
          "nq"
      ],
      "dataset_id": "sentence-transformers/NanoBEIR-en",
      "max_active_dims": 256
  }
MetricValue
dot_accuracy@10.18
dot_accuracy@30.3267
dot_accuracy@50.42
dot_accuracy@100.54
dot_precision@10.18
dot_precision@30.1356
dot_precision@50.1173
dot_precision@100.0867
dot_recall@10.0991
dot_recall@30.2158
dot_recall@50.2848
dot_recall@100.379
dot_ndcg@100.273
dot_mrr@100.2783
dot_map@1000.1991
queryactivedims254.54
querysparsityratio0.9949
corpusactivedims256.0
corpussparsityratio0.9949
avg_flops105.0486
Sparse Nano BEIR
json
  {
      "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
  }
MetricValue
dot_accuracy@10.2731
dot_accuracy@30.4704
dot_accuracy@50.5567
dot_accuracy@100.6554
dot_precision@10.2731
dot_precision@30.2017
dot_precision@50.1665
dot_precision@100.1231
dot_recall@10.1297
dot_recall@30.269
dot_recall@50.337
dot_recall@100.4261
dot_ndcg@100.3459
dot_mrr@100.3925
dot_map@1000.2732
queryactivedims249.2619
querysparsityratio0.9951
corpusactivedims254.1114
corpussparsityratio0.995
avg_flops109.026

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

gooaq
  • Dataset: gooaq at b089f72
  • Size: 99,000 training samples
  • Columns: <code>question</code> and <code>answer</code>
  • Approximate statistics based on the first 1000 samples: | | question | answer | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 11.93 tokens</li><li>max: 21 tokens</li></ul> | <ul><li>min: 15 tokens</li><li>mean: 58.27 tokens</li><li>max: 137 tokens</li></ul> |
  • Samples: | question | answer | |:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>what are the 5 characteristics of a star?</code> | <code>Key Concept: Characteristics used to classify stars include color, temperature, size, composition, and brightness.</code> | | <code>are copic markers alcohol ink?</code> | <code>Copic Ink is alcohol-based and flammable. Keep away from direct sunlight and extreme temperatures.</code> | | <code>what is the difference between appellate term and appellate division?</code> | <code>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.</code> |
  • Loss: <code>SpladeLoss</code> with these parameters:
json
  {
      "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: <code>question</code> and <code>answer</code>
  • Approximate statistics based on the first 1000 samples: | | question | answer | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 12.05 tokens</li><li>max: 23 tokens</li></ul> | <ul><li>min: 15 tokens</li><li>mean: 58.98 tokens</li><li>max: 186 tokens</li></ul> |
  • Samples: | question | answer | |:-----------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>should you take ibuprofen with high blood pressure?</code> | <code>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.</code> | | <code>how old do you have to be to work in sc?</code> | <code>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.</code> | | <code>how to write a topic proposal for a research paper?</code> | <code>['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.']</code> |
  • Loss: <code>SpladeLoss</code> with these parameters:
json
  {
      "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

<details><summary>Click to expand</summary>

  • 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: adamwtorchfused
  • 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: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_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: {}

</details>

Training Logs

EpochStepTraining LossValidation LossNanoMSMARCO_256_dot_ndcg@10NanoNFCorpus_256_dot_ndcg@10NanoNQ_256_dot_ndcg@10NanoBEIR_mean_256_dot_ndcg@10NanoClimateFEVER_256_dot_ndcg@10NanoDBPedia_256_dot_ndcg@10NanoFEVER_256_dot_ndcg@10NanoFiQA2018_256_dot_ndcg@10NanoHotpotQA_256_dot_ndcg@10NanoQuoraRetrieval_256_dot_ndcg@10NanoSCIDOCS_256_dot_ndcg@10NanoArguAna_256_dot_ndcg@10NanoSciFact_256_dot_ndcg@10NanoTouche2020_256_dot_ndcg@10
0.0323100954.7106---------------
0.064620017.8241---------------
0.09703004.5136---------------
0.12934002.5427---------------
0.16165001.4733---------------
0.19396001.0940---------------
0.1972610-0.85220.14400.04530.07710.0888----------
0.22627000.7541---------------
0.25868000.7425---------------
0.29099000.5966---------------
0.323210000.5606---------------
0.355511000.5440---------------
0.387812000.4032---------------
0.39431220-0.41650.24940.06130.20650.1724----------
0.420213000.3995---------------
0.452514000.2976---------------
0.484815000.2971---------------
0.517116000.2716---------------
0.549517000.2577---------------
0.581818000.2370---------------
0.59151830-0.21040.34060.11730.24140.2331----------
0.614119000.2360---------------
0.646420000.2238---------------
0.678721000.2237---------------
0.711122000.2162---------------
0.743423000.2044---------------
0.775724000.2202---------------
0.78862440-0.17360.39320.15450.27170.2731----------
0.808025000.1672---------------
0.840326000.2122---------------
0.872727000.1704---------------
0.905028000.1870---------------
0.937329000.1671---------------
0.969630000.1386---------------
0.98583050-0.170.37140.15710.29250.2737----------
1.03094-0.17060.36750.16240.28920.2730----------
-1-1--0.37140.15710.29250.34590.21510.37920.59650.22370.56010.31470.26730.25670.47310.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
bibtex
@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
bibtex
@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
bibtex
@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
bibtex
@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}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->