tomaarsen's picture
tomaarsen HF Staff
Upload 50/50 merged retrieval model and model card
78bae81 verified
|
Raw History Blame Contribute Delete
7.11 kB
metadata
tags:
  - sentence-transformers
  - sparse-encoder
  - sparse
  - splade
pipeline_tag: feature-extraction
library_name: sentence-transformers
language: en
license: cc-by-nc-sa-4.0
base_model:
  - naver/splade-v3
  - naver/splade-cocondenser-selfdistil
base_model_relation: merge

merged-SPLADE-v3-selfdistil

This is a Sparse Encoder model created by a 50/50 linear merge of SPLADE-v3 and SPLADE CoCondenser SelfDistil, using the SparseEncoder.merge method from the sentence-transformers library. It maps inputs to 30,522-dimensional sparse lexical vectors using SPLADE max pooling, for semantic search with learned query and document expansion.

The merged model scores above the average of its two parents on 9 of the 13 NanoBEIR datasets, including 8 where it beats both. It achieves a mean nDCG@10 of 0.6401, compared with 0.6336 for SPLADE-v3 and 0.6270 for SPLADE CoCondenser SelfDistil, using the same inference settings for all three models.

Excluding MS MARCO, the merged model achieves a mean nDCG@10 of 0.6372, compared with 0.6281 for SPLADE-v3.

See Model Creation for the full generation script.

Model Details

Model Description

  • Model Type: Sparse Encoder
  • Base models: SPLADE-v3 and SPLADE CoCondenser SelfDistil
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 30522 dimensions
  • Similarity Function: Dot Product
  • Supported Modality: Text
  • Language: English
  • License: CC-BY-NC-SA-4.0

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': 'BertForMaskedLM'})
  (1): SpladePooling({'pooling_strategy': 'max', 'activation_function': 'relu', '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("sparse-encoder/merged-SPLADE-v3-selfdistil")
queries = ['Which planet is known as the Red Planet?']
documents = [
    "Venus is often called Earth's twin because of its similar size and proximity.",
    'Mars, known for its reddish appearance, is often referred to as the Red Planet.',
    'Saturn, famous for its rings, is sometimes mistaken for the Red Planet.',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# torch.Size([1, 30522]) torch.Size([3, 30522])

similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 9.5819, 23.5003, 21.2222]])

Evaluation

Metrics

NanoBEIR

  • Dataset: NanoBEIR-en
  • Evaluated with SparseNanoBEIREvaluator on all 13 datasets.
  • Maximum input length: 512 tokens. Query and document prompts: empty.
  • Similarity: dot product. SPLADE max pooling with log(1 + ReLU(logits)). FP32 inference with eager attention.
  • Metric: nDCG@10. The mean is unweighted across datasets.

The parent models were evaluated with the same prompts and length limits.

Dataset merged-SPLADE-v3-selfdistil SPLADE-v3 SPLADE CoCondenser SelfDistil
msmarco 0.674565 0.700087 0.659201
nq 0.731771 0.727694 0.694880
fiqa2018 0.518832 0.514431 0.515037
nfcorpus 0.373541 0.386574 0.373691
scidocs 0.363320 0.362581 0.345038
arguana 0.476651 0.488462 0.452402
dbpedia 0.680222 0.687173 0.680651
quoraretrieval 0.964132 0.907928 0.954648
touche2020 0.625124 0.612912 0.583962
climatefever 0.326903 0.310448 0.346635
fever 0.938595 0.913058 0.927825
hotpotqa 0.842994 0.828082 0.838331
scifact 0.804576 0.797861 0.778772
mean 0.640094 0.633638 0.627006

Model Creation

The complete BERT backbone and masked-language-model prediction head were merged in fp32 with equal weights, without any additional training. Both parents use the same 30,522-token vocabulary, SPLADE max pooling, and 512-token input limit.

This is all it took:

# pip install "sentence-transformers[merge]"
from sentence_transformers import SparseEncoder

models = [
    SparseEncoder("naver/splade-v3"),
    SparseEncoder("naver/splade-cocondenser-selfdistil"),
]
model = SparseEncoder.merge(models, method="linear", parameters={"weight": [0.5, 0.5]}, dtype="float32")
model[1].embedding_dimension = model[0].model.config.vocab_size
model.save_pretrained("merged-SPLADE-v3-selfdistil")

Framework Versions

  • Python: 3.12.3
  • Sentence Transformers: 6.2.0
  • Transformers: 5.4.0
  • PyTorch: 2.11.0+cu128
  • Mergekit: 0.1.5
  • Datasets: 4.8.5
  • Tokenizers: 0.22.2

Citation

BibTeX

Mergekit

@inproceedings{goddard-etal-2024-arcees,
    title = "Arcee{'}s {M}erge{K}it: A Toolkit for Merging Large Language Models",
    author = "Goddard, Charles and Siriwardhana, Shamane and Ehghaghi, Malikeh and Meyers, Luke and Karpukhin, Vladimir and Benedict, Brian and McQuade, Mark and Solawetz, Jacob",
    editor = "Dernoncourt, Franck and Preo{\c{t}}iuc-Pietro, Daniel and Shimorina, Anastasia",
    booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track",
    month = nov,
    year = "2024",
    address = "Miami, Florida, US",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.emnlp-industry.36",
    doi = "10.18653/v1/2024.emnlp-industry.36",
    pages = "477--485",
}