Run this model with HF Jobs
Run minishlab/shimmer on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/minishlab/shimmer. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/minishlab/shimmer on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use minishlab/shimmer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Model2Vec
How to use minishlab/shimmer with Model2Vec:
from model2vec import StaticModel model = StaticModel.from_pretrained("minishlab/shimmer") embeddings = model.encode(["It's dangerous to go alone!", "It's a secret to everybody."]) print(embeddings.shape) - Notebooks
- Google Colab
- Kaggle
File size: 12,185 Bytes
d47213c 68dfbba d47213c d71abd6 d47213c a619109 9be5e62 f6362c2 9be5e62 a619109 d47213c d71abd6 d47213c d71abd6 d47213c d71abd6 7b8c1f2 d47213c d71abd6 d47213c 68dfbba d47213c d71abd6 d47213c d71abd6 d47213c 64277d4 228af1f 64277d4 d71abd6 d47213c 228af1f 9be5e62 d71abd6 7b8c1f2 d71abd6 f6362c2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 f6362c2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d47213c d71abd6 d47213c 9be5e62 d71abd6 7b8c1f2 d47213c d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 7b8c1f2 d71abd6 9be5e62 d71abd6 7b8c1f2 d71abd6 d47213c d71abd6 d47213c d71abd6 | 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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | ---
language:
- en
library_name: model2vec
license: mit
model_name: shimmer
tags:
- embeddings
- static-embeddings
- sparse
- retrieval
- information-retrieval
base_model: minishlab/blink-8M
---
<div align="center">
<img src="figures/shimmer-logo.svg" alt="shimmer logo" width="482">
</div>
shimmer is a sparse retrieval model built from the static embeddings of [minishlab/blink-8M](https://huggingface.co/minishlab/blink-8M), meant to replace BM25.
Documents are indexed with a tokenizer and a sparse lookup, which runs at hundreds of thousands of documents per second.
Queries are weighted with a per-token constant, which means that querying is encoding-free.
All weights are part of the model's own 30,000-token vocabulary, so they can be stored as impacts in any inverted index, but require no corpus or index to function; a document's representation only depends on the document text, nothing else.
The entire model is 76k parameters, and is only 851KB on disk. The whole repo, including the tokenizer and README, is about 1.5MB.
shimmer is a drop-in replacement for BM25. Without using any external corpus statistics, it outperforms BM25 on the majority of benchmarks. This makes it useful in situations where you want good retrieval performance but the corpus distribution changes a lot, or where semantic overlap matters more than exact matches.
## Usage
Install model2vec with the `sparse` extra:
```bash
pip install "model2vec[sparse]>=0.12.1"
```
Load the model with `SparseStaticModel`:
```python
from model2vec.sparse import SparseStaticModel
model = SparseStaticModel.from_pretrained("minishlab/shimmer")
documents = model.encode_document(["Example document", "Another document"])
queries = model.encode_query(["Example query"])
scores = queries @ documents.T
```
`encode_document` and `encode_query` return `scipy.sparse` matrices over the 30,000 tokens of the vocabulary.
This model can also be loaded as a [Sentence Transformers](https://github.com/huggingface/sentence-transformers) `SparseEncoder`, which requires `model2vec[sparse]` to be installed:
```python
from sentence_transformers import SparseEncoder
model = SparseEncoder("minishlab/shimmer", trust_remote_code=True)
queries = model.encode_query(["Example query"])
documents = model.encode_document(["Example document"])
scores = model.similarity(queries, documents)
```
## Results

All scores are ×100.
- **blink-8M** is the dense static model shimmer is built from: mean pooling with cosine similarity.
- **BM25** is bm25s Lucene BM25 with k1 = 0.9 and b = 0.4, over stemmed English words without stopwords, which are Pyserini's defaults.
### Main results
| Dataset | Metric | blink-8M | BM25 | shimmer |
|---|---|---:|---:|---:|
| BEIR-15 | nDCG@10 | 37.7 | 41.3 | **43.0** |
| Decon-BEIR | nDCG@10 | 45.0 | 48.5 | **50.8** |
| RTEB(eng, beta) | nDCG@10 | 30.8 | 32.2 | **39.6** |
How the suites are built:
- **BEIR-15** is BEIR with CQADupStack (the mean over its 12 subforums) and MS MARCO dev.
- **Decon-BEIR** is LightOn's decontaminated BEIR.
- **RTEB** is the main RTEB set.
### Other benchmarks
| Benchmark | Metric | blink-8M | BM25 | shimmer |
|---|---|---:|---:|---:|
| MTEB(eng, v2) retrieval | nDCG@10 | 38.9 | 43.2 | **44.7** |
| BRIGHT | nDCG@10 | 10.5 | 14.2 | **17.2** |
| BrowseComp-Plus (evidence) | nDCG@10 | 2.1 | 1.7 | **8.3** |
| MIRACL-en | nDCG@10 | 25.1 | 34.6 | **36.2** |
| MIRACL-en | R@100 | 69.3 | 81.2 | **81.4** |
MIRACL-en (full corpus) is the dev set of 799 queries over all 32.9M English passages.
### Compared to learned sparse and dense models
These are the numbers of Table 2 of the SparseUP paper, next to shimmer. Note that those models are 150M-parameter transformers trained on retrieval data, while shimmer runs no model at all during inference.
| Dataset | Metric | DenseOn | LateOn | SlideOn | SparseUP | SparseUP-v2 | shimmer |
|---|---|---:|---:|---:|---:|---:|---:|
| BEIR-15 | nDCG@10 | 56.2 | 57.2 | 56.7 | 54.5 | **57.2** | 43.0 |
| Decon-BEIR | nDCG@10 | 57.9 | 59.1 | 58.4 | 57.5 | **59.5** | 50.8 |
| CURE-en | nDCG@10 | 56.5 | 61.3 | 60.8 | 56.0 | **62.1** | 41.6 |
| LegalPinCite-par | nDCG@10 | 46.3 | 54.7 | 48.2 | **55.2** | 52.3 | 51.5 |
| Finance | nDCG@10 | 59.8 | 59.2 | 62.6 | 63.4 | **66.7** | 64.8 |
| ChemTEB | nDCG@10 | 76.4 | 75.1 | **76.8** | 70.8 | 72.5 | 60.9 |
| BRIGHT-Pro | nDCG@10 | 29.6 | 36.1 | 47.4 | 34.5 | **49.4** | 39.1 |
| LoTTE Forum | S@5 | **82.7** | 81.5 | 78.0 | 75.5 | 80.6 | 52.0 |
| LoTTE Search | S@5 | 83.4 | **83.9** | 81.1 | 78.2 | 82.1 | 54.1 |
| FreshStack | α-nDCG@10 | 19.6 | **24.5** | 15.6 | 23.3 | 22.8 | 23.2 |
| MIRACL-en | nDCG@10 | 55.4 | **64.3** | 60.9 | 56.7 | 60.7 | 36.2 |
| MLDR-en | nDCG@10 | 41.7 | **71.6** | 58.7 | 57.9 | 61.9 | 31.1 |
| LIMIT | R@2 | 0.8 | 74.2 | 12.2 | 8.1 | 28.2 | **80.8** |
shimmer scores above DenseOn on LegalPinCite, Finance, BRIGHT-Pro, FreshStack and LIMIT, and above SparseUP on Finance, BRIGHT-Pro and LIMIT.
<details>
<summary><b>BEIR-15 (shimmer 43.03)</b></summary>
nDCG@10. The original BeIR datasets, with graded relevance and identical ids dropped.
| Dataset | blink-8M | BM25 | shimmer |
|---|---:|---:|---:|
| ArguAna | **44.81** | 40.96 | 42.30 |
| Climate-FEVER | **21.95** | 16.25 | 19.71 |
| CQADupStack | 27.00 | 30.04 | **31.57** |
| DBPedia | 26.92 | 32.04 | **32.87** |
| FEVER | 46.81 | **63.79** | 63.64 |
| FiQA-2018 | 20.89 | 23.85 | **25.16** |
| HotpotQA | 49.88 | **62.91** | 61.06 |
| MS MARCO (dev) | 19.87 | 22.80 | **25.30** |
| NFCorpus | 31.14 | 31.79 | **33.74** |
| NQ | 30.37 | 30.47 | **33.92** |
| Quora | **82.11** | 78.75 | 80.17 |
| SCIDOCS | **15.88** | 15.05 | 15.22 |
| SciFact | 65.59 | 67.62 | **68.84** |
| TREC-COVID | 62.43 | 58.89 | **68.42** |
| Touché-2020 | 20.25 | **44.24** | 43.53 |
| **Mean (15)** | 37.73 | 41.30 | **43.03** |
</details>
<details>
<summary><b>Decontaminated BEIR (shimmer 50.84)</b></summary>
nDCG@10 on LightOn's decontaminated BEIR (`lightonai/<dataset>-decontaminated`): binary relevance, identical ids kept, and MS MARCO as TREC DL19.
| Dataset | blink-8M | BM25 | shimmer |
|---|---:|---:|---:|
| ArguAna | **33.19** | 30.65 | 31.85 |
| Climate-FEVER | **22.70** | 16.74 | 19.86 |
| DBPedia | 25.87 | 32.62 | **35.27** |
| FEVER | 47.30 | **64.47** | 64.01 |
| FiQA-2018 | **31.58** | 29.72 | 30.36 |
| HotpotQA | 52.67 | **64.41** | 63.45 |
| MS MARCO (DL19) | 51.75 | 59.46 | **60.32** |
| NFCorpus | 21.13 | 19.06 | **21.50** |
| NQ | 67.40 | 72.34 | **80.41** |
| Quora | **85.59** | 81.84 | 83.02 |
| SCIDOCS | **17.66** | 16.18 | 16.15 |
| SciFact | 83.39 | 75.36 | **84.41** |
| TREC-COVID | 68.17 | 65.29 | **73.52** |
| Touché-2020 | 22.07 | **50.51** | 47.64 |
| **Mean (14)** | 45.03 | 48.48 | **50.84** |
</details>
<details>
<summary><b>MTEB(eng, v2) retrieval (shimmer 44.72)</b></summary>
nDCG@10.
| Task | blink-8M | BM25 | shimmer |
|---|---:|---:|---:|
| ArguAna | **44.69** | 40.80 | 42.30 |
| CQADupstackGamingRetrieval | 44.53 | 47.95 | **49.50** |
| CQADupstackUnixRetrieval | 25.87 | 26.99 | **29.51** |
| ClimateFEVERHardNegatives | **23.61** | 14.28 | 20.54 |
| FEVERHardNegatives | 49.47 | **65.25** | 64.06 |
| FiQA2018 | 20.89 | 23.85 | **25.16** |
| HotpotQAHardNegatives | 53.01 | **63.23** | 61.53 |
| SCIDOCS | **15.88** | 15.05 | 15.22 |
| TRECCOVID | 62.50 | 58.87 | **68.42** |
| Touche2020Retrieval.v3 | 48.27 | **75.95** | 70.92 |
| **Mean** | 38.87 | 43.22 | **44.72** |
</details>
<details>
<summary><b>RTEB (shimmer 39.61)</b></summary>
nDCG@10 on the 15 public English tasks of RTEB(eng, beta).
| Task | Domain | blink-8M | BM25 | shimmer |
|---|---|---:|---:|---:|
| AILACasedocs | Legal | 26.81 | 21.91 | **33.75** |
| AILAStatutes | Legal | **25.10** | 18.32 | 21.65 |
| LegalSummarization | Legal | **58.55** | 56.27 | 58.45 |
| FinanceBenchRetrieval | Finance | 34.76 | 43.74 | **55.72** |
| HC3FinanceRetrieval | Finance | **33.21** | 25.20 | 27.04 |
| FinQARetrieval | Finance | 50.80 | 72.46 | **73.90** |
| AppsRetrieval | Code | 3.58 | 4.35 | **5.03** |
| DS1000Retrieval | Code | 23.93 | 39.42 | **39.89** |
| HumanEvalRetrieval | Code | 45.66 | 37.83 | **52.11** |
| MBPPRetrieval | Code | 37.26 | 11.65 | **56.05** |
| WikiSQLRetrieval | Code | 37.29 | 51.27 | **56.48** |
| FreshStackRetrieval | Code | 22.72 | 25.62 | **27.62** |
| SWEbenchCodeRetrieval | Code | 4.57 | **7.10** | 5.67 |
| ChatDoctorRetrieval | Healthcare | 25.12 | 29.45 | **39.32** |
| CUREv1 | Healthcare | 33.18 | 39.06 | **41.45** |
| **Mean** | | 30.84 | 32.24 | **39.61** |
</details>
<details>
<summary><b>BRIGHT (shimmer 17.19)</b></summary>
nDCG@10 with the original queries.
| Task | blink-8M | BM25 | shimmer |
|---|---:|---:|---:|
| Biology | 14.68 | 17.73 | **26.23** |
| Earth Science | 25.58 | 29.24 | **42.25** |
| Economics | 11.29 | 15.52 | **15.93** |
| Psychology | 11.93 | 14.38 | **19.38** |
| Robotics | 7.26 | 12.28 | **12.99** |
| Stack Overflow | 12.94 | 18.18 | **19.88** |
| Sustainable Living | 7.55 | 15.80 | **16.36** |
| LeetCode | 15.94 | **26.06** | 25.32 |
| Pony | 3.52 | 4.97 | **6.84** |
| AoPS | 5.78 | 6.13 | **8.47** |
| TheoremQA (questions) | 7.11 | 8.02 | **9.09** |
| TheoremQA (theorems) | 2.59 | 1.67 | **3.49** |
| **Mean** | 10.51 | 14.16 | **17.19** |
Recall@100:
| Task | blink-8M | BM25 | shimmer |
|---|---:|---:|---:|
| Biology | 50.99 | 43.61 | **57.65** |
| Earth Science | 58.10 | 59.79 | **69.89** |
| Economics | 40.14 | 40.76 | **42.84** |
| Psychology | 40.42 | 43.29 | **47.14** |
| Robotics | 31.66 | 42.55 | **45.86** |
| Stack Overflow | 40.20 | 48.12 | **53.07** |
| Sustainable Living | 45.27 | 41.57 | **48.56** |
| LeetCode | 38.73 | 46.84 | **55.26** |
| Pony | 17.03 | **20.84** | 14.07 |
| AoPS | 20.24 | 19.12 | **25.04** |
| TheoremQA (questions) | 16.28 | 15.35 | **21.54** |
| TheoremQA (theorems) | 7.68 | 9.65 | **15.02** |
</details>
<details>
<summary><b>FreshStack (shimmer 23.15)</b></summary>
| Topic | blink-8M α-nDCG@10 | BM25 α-nDCG@10 | shimmer α-nDCG@10 | blink-8M C@20 | BM25 C@20 | shimmer C@20 | blink-8M R@50 | BM25 R@50 | shimmer R@50 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| Angular | 16.88 | **28.00** | 21.97 | 36.59 | **57.50** | 53.35 | 21.45 | **34.55** | 32.47 |
| Godot | 12.60 | 14.46 | **19.17** | 30.24 | 32.31 | **38.11** | 25.41 | 23.14 | **32.27** |
| LangChain | 15.47 | **25.38** | 23.62 | 38.87 | 49.65 | **52.46** | 21.15 | **29.34** | 28.56 |
| Laravel | 21.26 | 31.21 | **34.34** | 49.69 | 62.25 | **65.18** | 36.71 | 44.19 | **48.31** |
| YOLO | 12.36 | 16.08 | **16.66** | 28.83 | 39.80 | **41.61** | 22.28 | 32.64 | **35.71** |
| **Mean** | 15.71 | 23.03 | **23.15** | 36.84 | 48.30 | **50.14** | 25.40 | 32.77 | **35.46** |
</details>
<details>
<summary><b>BrowseComp-Plus (shimmer 8.30)</b></summary>
| Qrels | Metric | blink-8M | BM25 | shimmer |
|---|---|---:|---:|---:|
| Evidence | nDCG@10 | 2.12 | 1.71 | **8.30** |
| | Recall@5 | 1.44 | 1.35 | **6.07** |
| | Recall@100 | 9.30 | 4.92 | **20.32** |
| | Recall@1000 | 32.31 | 14.02 | **41.69** |
| Gold | nDCG@10 | 1.77 | 1.69 | **7.52** |
| | Recall@5 | 1.77 | 1.56 | **7.31** |
| | Recall@100 | 10.16 | 6.70 | **22.73** |
| | Recall@1000 | 34.65 | 17.85 | **45.34** |
BrowseComp-Plus documents are long. BM25 with k1 = 16 and b = 1 reaches 10.71 evidence nDCG@10.
</details>
## Library Authors
Model2Vec was developed by the [Minish Lab](https://github.com/MinishLab) team consisting of [Stephan Tulkens](https://github.com/stephantul) and [Thomas van Dongen](https://github.com/Pringled).
## Citation
Please cite the [Model2Vec repository](https://github.com/MinishLab/model2vec) if you use this model in your work.
```bibtex
@software{minishlab2024model2vec,
author = {Stephan Tulkens and {van Dongen}, Thomas},
title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
year = {2024},
publisher = {Zenodo},
doi = {10.5281/zenodo.17270888},
url = {https://github.com/MinishLab/model2vec},
license = {MIT}
}
```
|