File size: 7,106 Bytes
78bae81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---

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](https://www.sbert.net/docs/sparse_encoder/usage/usage.html) model created by a 50/50 linear merge of [SPLADE-v3](https://huggingface.co/naver/splade-v3) and [SPLADE CoCondenser SelfDistil](https://huggingface.co/naver/splade-cocondenser-selfdistil), using the [`SparseEncoder.merge`](https://www.sbert.net/docs/package_reference/sparse_encoder/model.html#sentence_transformers.sparse_encoder.model.SparseEncoder.merge) method from the [sentence-transformers](https://www.SBERT.net) 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](#model-creation) for the full generation script.

## Model Details

### Model Description

- **Model Type:** Sparse Encoder
- **Base models:** [SPLADE-v3](https://huggingface.co/naver/splade-v3) and [SPLADE CoCondenser SelfDistil](https://huggingface.co/naver/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

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Sparse Encoder Documentation](https://www.sbert.net/docs/sparse_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Parent model:** [SPLADE-v3](https://huggingface.co/naver/splade-v3)
- **Parent model:** [SPLADE CoCondenser SelfDistil](https://huggingface.co/naver/splade-cocondenser-selfdistil)

### 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:

```bash

pip install -U sentence-transformers

```

Then you can load this model and run inference.

```python

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](https://huggingface.co/datasets/sentence-transformers/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 | <u>0.700087</u> | 0.659201 |
| nq | <u>0.731771</u> | 0.727694 | 0.694880 |
| fiqa2018 | <u>0.518832</u> | 0.514431 | 0.515037 |
| nfcorpus | 0.373541 | <u>0.386574</u> | 0.373691 |
| scidocs | <u>0.363320</u> | 0.362581 | 0.345038 |
| arguana | 0.476651 | <u>0.488462</u> | 0.452402 |
| dbpedia | 0.680222 | <u>0.687173</u> | 0.680651 |
| quoraretrieval | <u>0.964132</u> | 0.907928 | 0.954648 |
| touche2020 | <u>0.625124</u> | 0.612912 | 0.583962 |
| climatefever | 0.326903 | 0.310448 | <u>0.346635</u> |
| fever | <u>0.938595</u> | 0.913058 | 0.927825 |
| hotpotqa | <u>0.842994</u> | 0.828082 | 0.838331 |
| scifact | <u>0.804576</u> | 0.797861 | 0.778772 |
| **mean** | **<u>0.640094</u>** | **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:

```python

# 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

```bibtex

@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",

}

```