Sentence Similarity
GGUF
feature-extraction
Cebtenzzre commited on
Commit
0c920dd
·
0 Parent(s):

initial commit

Browse files
Files changed (2) hide show
  1. .gitattributes +36 -0
  2. README.md +264 -0
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ quantized_by: Nomic
3
+ pipeline_tag: sentence-similarity
4
+ base_model: nomic-ai/nomic-embed-text-v2-moe
5
+ base_model_relation: quantized
6
+ tags:
7
+ - sentence-similarity
8
+ - feature-extraction
9
+ license: apache-2.0
10
+ language:
11
+ - en
12
+ - es
13
+ - fr
14
+ - de
15
+ - it
16
+ - pt
17
+ - pl
18
+ - nl
19
+ - tr
20
+ - ja
21
+ - vi
22
+ - ru
23
+ - id
24
+ - ar
25
+ - cs
26
+ - ro
27
+ - sv
28
+ - el
29
+ - uk
30
+ - zh
31
+ - hu
32
+ - da
33
+ - 'no'
34
+ - hi
35
+ - fi
36
+ - bg
37
+ - ko
38
+ - sk
39
+ - th
40
+ - he
41
+ - ca
42
+ - lt
43
+ - fa
44
+ - ms
45
+ - sl
46
+ - lv
47
+ - mr
48
+ - bn
49
+ - sq
50
+ - cy
51
+ - be
52
+ - ml
53
+ - kn
54
+ - mk
55
+ - ur
56
+ - fy
57
+ - te
58
+ - eu
59
+ - sw
60
+ - so
61
+ - sd
62
+ - uz
63
+ - co
64
+ - hr
65
+ - gu
66
+ - ce
67
+ - eo
68
+ - jv
69
+ - la
70
+ - zu
71
+ - mn
72
+ - si
73
+ - ga
74
+ - ky
75
+ - tg
76
+ - my
77
+ - km
78
+ - mg
79
+ - pa
80
+ - sn
81
+ - ha
82
+ - ht
83
+ - su
84
+ - gd
85
+ - ny
86
+ - ps
87
+ - ku
88
+ - am
89
+ - ig
90
+ - lo
91
+ - mi
92
+ - nn
93
+ - sm
94
+ - yi
95
+ - st
96
+ - tl
97
+ - xh
98
+ - yo
99
+ - af
100
+ - ta
101
+ - tn
102
+ - ug
103
+ - az
104
+ - ba
105
+ - bs
106
+ - dv
107
+ - et
108
+ - gl
109
+ - gn
110
+ - gv
111
+ - hy
112
+ ---
113
+
114
+ # Llama.cpp Quantizations of nomic-embed-text-v2-moe: Multilingual Mixture of Experts Text Embeddings
115
+
116
+ [Blog](https://www.nomic.ai/blog/posts/nomic-embed-text-v2) | [Technical Report](https://huggingface.co/papers/2502.07972) | [AWS SageMaker](https://aws.amazon.com/marketplace/seller-profile?id=seller-tpqidcj54zawi) | [Atlas Embedding and Unstructured Data Analytics Platform](https://atlas.nomic.ai)
117
+
118
+ This model was presented in the paper [Training Sparse Mixture Of Experts Text Embedding Models](https://huggingface.co/papers/2502.07972).
119
+
120
+ Using <a href="https://github.com/ggml-org/llama.cpp">llama.cpp</a> commit <a href="https://github.com/ggml-org/llama.cpp/tree/a96786c0b01bc913343c861af8c460a715e68c20">a96786c0b</a> for quantization.
121
+
122
+ Original model: [nomic-embed-text-v2-moe](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe)
123
+
124
+ ## Usage
125
+
126
+ This model can be used with the [llama.cpp server](https://github.com/ggml-org/llama.cpp/blob/master/examples/embedding#post-v1embeddings-openai-compatible-embeddings-api) and other software that supports llama.cpp embedding models.
127
+
128
+ Embedding text with `nomic-embed-text` requires task instruction prefixes at the beginning of each string.
129
+
130
+ For example, the code below shows how to use the `search_query` prefix to embed user questions, e.g. in a RAG application:
131
+
132
+ ```python
133
+ import requests
134
+
135
+ def dot(va, vb):
136
+ return sum(a * b for a, b in zip(va, vb))
137
+
138
+ def embed(texts):
139
+ resp = requests.post('http://localhost:8080/v1/embeddings', json={'input': texts}).json()
140
+ return [d['embedding'] for d in resp['data']]
141
+
142
+ docs = ['嵌入很酷', '骆驼很酷'] # 'embeddings are cool', 'llamas are cool'
143
+ docs_embed = embed(['search_document: ' + d for d in docs])
144
+
145
+ query = '跟我讲讲嵌入' # 'tell me about embeddings'
146
+ query_embed = embed(['search_query: ' + query])[0]
147
+ print(f'query: {query!r}')
148
+ for d, e in zip(docs, docs_embed):
149
+ print(f'similarity {dot(query_embed, e):.2f}: {d!r}')
150
+ ```
151
+
152
+ Output:
153
+ ```
154
+ query: '跟我讲讲嵌入'
155
+ similarity 0.48: '嵌入很酷'
156
+ similarity 0.19: '骆驼很酷'
157
+ ```
158
+
159
+ ## Download a file (not the whole branch) from below:
160
+
161
+ | Filename | Quant Type | File Size | Description |
162
+ | ---- | ---------- | --------: | ----------- |
163
+ | [nomic-embed-text-v2-moe.f32.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.f32.gguf) | f32 | 1820MiB | Full FP32 weights. |
164
+ | [nomic-embed-text-v2-moe.f16.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.f16.gguf) | f16 | 913MiB | Full FP16 weights. |
165
+ | [nomic-embed-text-v2-moe.bf16.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.bf16.gguf) | bf16 | 913MiB | Full BF16 weights. |
166
+ | [nomic-embed-text-v2-moe.Q8\_0.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q8_0.gguf) | Q8\_0 | 488MiB | Extremely high quality, generally unneeded but max available quant. |
167
+ | [nomic-embed-text-v2-moe.Q6\_K.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q6_K.gguf) | Q6\_K | 379MiB | Very high quality, near perfect, *recommended*. |
168
+ | [nomic-embed-text-v2-moe.Q5\_K\_M.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q5_K_M.gguf) | Q5\_K\_M | 354MiB | High quality, *recommended*. |
169
+ | [nomic-embed-text-v2-moe.Q5\_K\_S.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q5_K_S.gguf) | Q5\_K\_S | 343MiB | High quality, *recommended*. |
170
+ | [nomic-embed-text-v2-moe.Q4\_1.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q4_1.gguf) | Q4\_1 | 326MiB | Legacy format, similar performance to Q4\_K\_S but with improved tokens/watt on Apple silicon. |
171
+ | [nomic-embed-text-v2-moe.Q4\_K\_M.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q4_K_M.gguf) | Q4\_K\_M | 328MiB | Good quality, default size for most use cases, *recommended*. |
172
+ | [nomic-embed-text-v2-moe.Q4\_K\_S.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q4_K_S.gguf) | Q4\_K\_S | 310MiB | Slightly lower quality with more space savings, *recommended*. |
173
+ | [nomic-embed-text-v2-moe.Q4\_0.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q4_0.gguf) | Q4\_0 | 309MiB | Legacy format, offers online repacking for ARM and AVX CPU inference. |
174
+ | [nomic-embed-text-v2-moe.Q3\_K\_L.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q3_K_L.gguf) | Q3\_K\_L | 307MiB | Lower quality but usable, good for low RAM availability. |
175
+ | [nomic-embed-text-v2-moe.Q3\_K\_M.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q3_K_M.gguf) | Q3\_K\_M | 294MiB | Low quality. |
176
+ | [nomic-embed-text-v2-moe.Q3\_K\_S.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q3_K_S.gguf) | Q3\_K\_S | 275MiB | Low quality, not recommended. |
177
+ | [nomic-embed-text-v2-moe.Q2\_K.gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe-GGUF/blob/main/nomic-embed-text-v2-moe.Q2_K.gguf) | Q2\_K | 261MiB | Very low quality but surprisingly usable. |
178
+
179
+ ## Model Overview
180
+ `nomic-embed-text-v2-moe` is a SoTA multilingual MoE text embedding model that excels at multilingual retrieval:
181
+
182
+ - **High Performance**: SoTA Multilingual performance compared to ~300M parameter models, competitive with models 2x in size
183
+ - **Multilinguality**: Supports ~100 languages and trained on over 1.6B pairs
184
+ - **Flexible Embedding Dimension**: Trained with [Matryoshka Embeddings](https://arxiv.org/abs/2205.13147) with 3x reductions in storage cost with minimal performance degradations
185
+ - **Fully Open-Source**: Model weights, [code](https://github.com/nomic-ai/contrastors), and training data (see code repo) released
186
+
187
+
188
+ | Model | Params (M) | Emb Dim | BEIR | MIRACL | Pretrain Data | Finetune Data | Code |
189
+ |-------|------------|----------|------|---------|---------------|---------------|------|
190
+ | **Nomic Embed v2** | 305 | 768 | 52.86 | **65.80** | ✅ | ✅ | ✅ |
191
+ | mE5 Base | 278 | 768 | 48.88 | 62.30 | ❌ | ❌ | ❌ |
192
+ | mGTE Base | 305 | 768 | 51.10 | 63.40 | ❌ | ❌ | ❌ |
193
+ | Arctic Embed v2 Base | 305 | 768 | **55.40** | 59.90 | ❌ | ❌ | ❌ |
194
+ | |
195
+ | BGE M3 | 568 | 1024 | 48.80 | **69.20** | ❌ | ✅ | ❌ |
196
+ | Arctic Embed v2 Large | 568 | 1024 | **55.65** | 66.00 | ❌ | ❌ | ❌ |
197
+ | mE5 Large | 560 | 1024 | 51.40 | 66.50 | ❌ | ❌ | ❌ |
198
+
199
+ ## Model Architecture
200
+ - **Total Parameters**: 475M
201
+ - **Active Parameters During Inference**: 305M
202
+ - **Architecture Type**: Mixture of Experts (MoE)
203
+ - **MoE Configuration**: 8 experts with top-2 routing
204
+ - **Embedding Dimensions**: Supports flexible dimension from 768 to 256 through Matryoshka representation learning
205
+ - **Maximum Sequence Length**: 512 tokens
206
+ - **Languages**: Supports dozens of languages (see Performance section)
207
+
208
+ ## Paper Abstract
209
+
210
+ Transformer-based text embedding models have improved their performance on benchmarks like MIRACL and BEIR by increasing their parameter counts. However, this scaling approach introduces significant deployment challenges, including increased inference latency and memory usage. These challenges are particularly severe in retrieval-augmented generation (RAG) applications, where large models' increased memory requirements constrain dataset ingestion capacity, and their higher latency directly impacts query-time performance. While causal language models have addressed similar efficiency challenges using Mixture of Experts (MoE) architectures, this approach hasn't been successfully adapted to the general text embedding setting. In this paper, we introduce Nomic Embed v2, the first general purpose MoE text embedding model. Our model outperforms models in the same parameter class on both monolingual and multilingual benchmarks while also maintaining competitive performance with models twice its size. We open-source all code, models, and evaluation data to ensure full reproducibility of our training pipeline at https://github.com/nomic-ai/contrastors.
211
+
212
+ ## Performance
213
+
214
+ nomic-embed-text-v2-moe performance on BEIR and MIRACL compared to other open-weights embedding models:
215
+
216
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/607997c83a565c15675055b3/xadjrezEIM0Q1jbgmjqO7.png)
217
+
218
+ nomic-embed-text-v2-moe performance on BEIR at 768 dimension and truncated to 256 dimensions:
219
+
220
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/607997c83a565c15675055b3/8hmhWQ_TTmlrviZFIBSxo.png)
221
+
222
+ ## Best Practices
223
+ - Add appropriate prefixes to your text:
224
+ - For queries: "search\_query: "
225
+ - For documents: "search\_document: "
226
+ - Maximum input length is 512 tokens
227
+ - For optimal efficiency, consider using the 256-dimension embeddings if storage/compute is a concern
228
+
229
+ ## Limitations
230
+ - Performance may vary across different languages
231
+ - Resource requirements may be higher than traditional dense models due to MoE architecture
232
+ - Must use `trust_remote_code=True` when loading the model to use our custom architecture implementation
233
+
234
+ ## Training Details
235
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/607997c83a565c15675055b3/F0lyAtV8wXMBmxSbtIgL4.png)
236
+
237
+ - Trained on 1.6 billion high-quality pairs across multiple languages
238
+ - Uses consistency filtering to ensure high-quality training data
239
+ - Incorporates Matryoshka representation learning for dimension flexibility
240
+ - Training includes both weakly-supervised contrastive pretraining and supervised finetuning
241
+
242
+ For more details, please check out the [blog post](https://www.nomic.ai/blog/posts/nomic-embed-text-v2) and [technical report](https://www.arxiv.org/abs/2502.07972).
243
+
244
+
245
+
246
+ ## Join the Nomic Community
247
+ - Nomic: [https://nomic.ai](https://nomic.ai)
248
+ - Discord: [https://discord.gg/myY5YDR8z8](https://discord.gg/myY5YDR8z8)
249
+ - Twitter: [https://twitter.com/nomic\_ai](https://twitter.com/nomic_ai)
250
+
251
+ # Citation
252
+ If you find the model, dataset, or training code useful, please cite our work
253
+
254
+ ```bibtex
255
+ @misc{nussbaum2025trainingsparsemixtureexperts,
256
+ title={Training Sparse Mixture Of Experts Text Embedding Models},
257
+ author={Zach Nussbaum and Brandon Duderstadt},
258
+ year={2025},
259
+ eprint={2502.07972},
260
+ archivePrefix={arXiv},
261
+ primaryClass={cs.CL},
262
+ url={https://arxiv.org/abs/2502.07972},
263
+ }
264
+ ```