Sentence Similarity
sentence-transformers
Safetensors
English
modernbert
biencoder
text-classification
sentence-pair-classification
semantic-similarity
semantic-search
retrieval
reranking
Generated from Trainer
dataset_size:483820
loss:MultipleNegativesSymmetricRankingLoss
Eval Results
text-embeddings-inference
Add new SentenceTransformer model
Browse files- README.md +90 -115
- model.safetensors +1 -1
README.md
CHANGED
@@ -12,58 +12,42 @@ tags:
|
|
12 |
- retrieval
|
13 |
- reranking
|
14 |
- generated_from_trainer
|
15 |
-
- dataset_size:
|
16 |
-
- loss:
|
17 |
base_model: Alibaba-NLP/gte-modernbert-base
|
18 |
widget:
|
19 |
-
- source_sentence:
|
20 |
-
get a big enough turnout to elect a president .
|
21 |
sentences:
|
22 |
-
-
|
23 |
-
|
24 |
-
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
- source_sentence:
|
29 |
-
accomplish tasks that fulfill the intentions of the user.
|
30 |
sentences:
|
31 |
-
-
|
32 |
-
|
33 |
-
-
|
34 |
-
|
35 |
-
- software programs that work without direct human intervention to carry out specific
|
36 |
-
tasks for an individual user, business process, or software application -siri
|
37 |
-
adapts to your preferences over time
|
38 |
-
- source_sentence: any location in storage can be accessed at any moment in approximately
|
39 |
-
the same amount of time.
|
40 |
sentences:
|
41 |
-
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
- source_sentence: United issued a statement saying it will " work professionally
|
48 |
-
and cooperatively with all its unions . "
|
49 |
sentences:
|
50 |
-
-
|
51 |
-
|
52 |
-
|
53 |
-
-
|
54 |
-
|
55 |
-
|
56 |
-
member states " with a view to taking appropriate action if necessary " on the
|
57 |
-
matter .
|
58 |
sentences:
|
59 |
-
-
|
60 |
-
|
61 |
-
|
62 |
-
- Laos 's second most important export destination - said it was consulting EU member
|
63 |
-
states ' ' with a view to taking appropriate action if necessary ' ' on the matter
|
64 |
-
.
|
65 |
-
- the form data assumes and the possible range of values that the attribute defined
|
66 |
-
as that type of data may express 1. text 2. numerical
|
67 |
datasets:
|
68 |
- redis/langcache-sentencepairs-v1
|
69 |
pipeline_tag: sentence-similarity
|
@@ -88,28 +72,28 @@ model-index:
|
|
88 |
type: val
|
89 |
metrics:
|
90 |
- type: cosine_accuracy
|
91 |
-
value: 0.
|
92 |
name: Cosine Accuracy
|
93 |
- type: cosine_accuracy_threshold
|
94 |
-
value: 0.
|
95 |
name: Cosine Accuracy Threshold
|
96 |
- type: cosine_f1
|
97 |
-
value: 0.
|
98 |
name: Cosine F1
|
99 |
- type: cosine_f1_threshold
|
100 |
-
value: 0.
|
101 |
name: Cosine F1 Threshold
|
102 |
- type: cosine_precision
|
103 |
-
value: 0
|
104 |
name: Cosine Precision
|
105 |
- type: cosine_recall
|
106 |
-
value: 0.
|
107 |
name: Cosine Recall
|
108 |
- type: cosine_ap
|
109 |
-
value: 0.
|
110 |
name: Cosine Ap
|
111 |
- type: cosine_mcc
|
112 |
-
value: 0.
|
113 |
name: Cosine Mcc
|
114 |
- task:
|
115 |
type: binary-classification
|
@@ -119,28 +103,28 @@ model-index:
|
|
119 |
type: test
|
120 |
metrics:
|
121 |
- type: cosine_accuracy
|
122 |
-
value: 0.
|
123 |
name: Cosine Accuracy
|
124 |
- type: cosine_accuracy_threshold
|
125 |
-
value: 0.
|
126 |
name: Cosine Accuracy Threshold
|
127 |
- type: cosine_f1
|
128 |
-
value: 0.
|
129 |
name: Cosine F1
|
130 |
- type: cosine_f1_threshold
|
131 |
-
value: 0.
|
132 |
name: Cosine F1 Threshold
|
133 |
- type: cosine_precision
|
134 |
-
value: 0
|
135 |
name: Cosine Precision
|
136 |
- type: cosine_recall
|
137 |
-
value: 0.
|
138 |
name: Cosine Recall
|
139 |
- type: cosine_ap
|
140 |
-
value: 0
|
141 |
name: Cosine Ap
|
142 |
- type: cosine_mcc
|
143 |
-
value: 0.
|
144 |
name: Cosine Mcc
|
145 |
---
|
146 |
|
@@ -194,9 +178,9 @@ from sentence_transformers import SentenceTransformer
|
|
194 |
model = SentenceTransformer("redis/langcache-embed-v3")
|
195 |
# Run inference
|
196 |
sentences = [
|
197 |
-
'A
|
198 |
-
|
199 |
-
'
|
200 |
]
|
201 |
embeddings = model.encode(sentences)
|
202 |
print(embeddings.shape)
|
@@ -205,9 +189,9 @@ print(embeddings.shape)
|
|
205 |
# Get the similarity scores for the embeddings
|
206 |
similarities = model.similarity(embeddings, embeddings)
|
207 |
print(similarities)
|
208 |
-
# tensor([[1.
|
209 |
-
# [0.
|
210 |
-
# [0.
|
211 |
```
|
212 |
|
213 |
<!--
|
@@ -243,16 +227,16 @@ You can finetune this model on your own dataset.
|
|
243 |
* Datasets: `val` and `test`
|
244 |
* Evaluated with [<code>BinaryClassificationEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.BinaryClassificationEvaluator)
|
245 |
|
246 |
-
| Metric | val
|
247 |
-
|
248 |
-
| cosine_accuracy | 0.
|
249 |
-
| cosine_accuracy_threshold | 0.
|
250 |
-
| cosine_f1 | 0.
|
251 |
-
| cosine_f1_threshold | 0.
|
252 |
-
| cosine_precision | 0
|
253 |
-
| cosine_recall | 0.
|
254 |
-
| **cosine_ap** | **0
|
255 |
-
| cosine_mcc | 0.
|
256 |
|
257 |
<!--
|
258 |
## Bias, Risks and Limitations
|
@@ -273,24 +257,25 @@ You can finetune this model on your own dataset.
|
|
273 |
#### LangCache Sentence Pairs (all)
|
274 |
|
275 |
* Dataset: [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1)
|
276 |
-
* Size:
|
277 |
-
* Columns: <code>sentence1</code
|
278 |
* Approximate statistics based on the first 1000 samples:
|
279 |
-
| | sentence1 | sentence2
|
280 |
-
|
281 |
-
| type | string | string
|
282 |
-
| details | <ul><li>min:
|
283 |
* Samples:
|
284 |
-
| sentence1
|
285 |
-
|
286 |
-
| <code>
|
287 |
-
| <code>
|
288 |
-
| <code>
|
289 |
-
* Loss: [<code>
|
290 |
```json
|
291 |
{
|
292 |
"scale": 20.0,
|
293 |
-
"similarity_fct": "
|
|
|
294 |
}
|
295 |
```
|
296 |
|
@@ -299,31 +284,32 @@ You can finetune this model on your own dataset.
|
|
299 |
#### LangCache Sentence Pairs (all)
|
300 |
|
301 |
* Dataset: [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1)
|
302 |
-
* Size:
|
303 |
-
* Columns: <code>sentence1</code
|
304 |
* Approximate statistics based on the first 1000 samples:
|
305 |
-
| | sentence1 | sentence2
|
306 |
-
|
307 |
-
| type | string | string
|
308 |
-
| details | <ul><li>min:
|
309 |
* Samples:
|
310 |
-
| sentence1
|
311 |
-
|
312 |
-
| <code>
|
313 |
-
| <code>
|
314 |
-
| <code>
|
315 |
-
* Loss: [<code>
|
316 |
```json
|
317 |
{
|
318 |
"scale": 20.0,
|
319 |
-
"similarity_fct": "
|
|
|
320 |
}
|
321 |
```
|
322 |
|
323 |
### Training Logs
|
324 |
| Epoch | Step | val_cosine_ap | test_cosine_ap |
|
325 |
|:-----:|:----:|:-------------:|:--------------:|
|
326 |
-
| -1 | -1 |
|
327 |
|
328 |
|
329 |
### Framework Versions
|
@@ -352,17 +338,6 @@ You can finetune this model on your own dataset.
|
|
352 |
}
|
353 |
```
|
354 |
|
355 |
-
#### CoSENTLoss
|
356 |
-
```bibtex
|
357 |
-
@online{kexuefm-8847,
|
358 |
-
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
|
359 |
-
author={Su Jianlin},
|
360 |
-
year={2022},
|
361 |
-
month={Jan},
|
362 |
-
url={https://kexue.fm/archives/8847},
|
363 |
-
}
|
364 |
-
```
|
365 |
-
|
366 |
<!--
|
367 |
## Glossary
|
368 |
|
|
|
12 |
- retrieval
|
13 |
- reranking
|
14 |
- generated_from_trainer
|
15 |
+
- dataset_size:478600
|
16 |
+
- loss:MultipleNegativesSymmetricRankingLoss
|
17 |
base_model: Alibaba-NLP/gte-modernbert-base
|
18 |
widget:
|
19 |
+
- source_sentence: The brown dog is sniffing the back of a small black dog
|
|
|
20 |
sentences:
|
21 |
+
- Pickens died in Edgefield and was buried on the Willow Brook Cemetery in Edgefield
|
22 |
+
, South Carolina .
|
23 |
+
- It is notable as the oldest Chinatown in Australia , the oldest continuous Chinese
|
24 |
+
settlement in Australia , and the longest continuously running Chinatown outside
|
25 |
+
of Asia .
|
26 |
+
- There is no large brown dog and small grey dog standing on a rocky surface
|
27 |
+
- source_sentence: Is it harmful from security perspectives to use public Wi-Fi?
|
|
|
28 |
sentences:
|
29 |
+
- What is the best way to drive traffic to a website?
|
30 |
+
- What startups have used GitHub?
|
31 |
+
- Is there something wrong with using public Wi-Fi?
|
32 |
+
- source_sentence: How can we make education better?
|
|
|
|
|
|
|
|
|
|
|
33 |
sentences:
|
34 |
+
- What are some things that would make education better today?
|
35 |
+
- Mistery works full-time as a graffiti artist and is also Emcee / Rapper in the
|
36 |
+
Brethren group .
|
37 |
+
- Jammu Airport operates flights to many cities in India such as Delhi , Leh and
|
38 |
+
Srinagar .
|
39 |
+
- source_sentence: So are you.
|
|
|
|
|
40 |
sentences:
|
41 |
+
- 'Brown said afterwards that he was surprised they had not scored five , and Astall
|
42 |
+
wrote in his newspaper column :'
|
43 |
+
- Just like yourself.
|
44 |
+
- How do I actually lose weight?
|
45 |
+
- source_sentence: A group of boys are playing with a ball in front of a large door
|
46 |
+
made of wood
|
|
|
|
|
47 |
sentences:
|
48 |
+
- The children are playing in front of a large door
|
49 |
+
- What is the blind spot?
|
50 |
+
- What are some good techniques for controlling your anger?
|
|
|
|
|
|
|
|
|
|
|
51 |
datasets:
|
52 |
- redis/langcache-sentencepairs-v1
|
53 |
pipeline_tag: sentence-similarity
|
|
|
72 |
type: val
|
73 |
metrics:
|
74 |
- type: cosine_accuracy
|
75 |
+
value: 0.9996860282574568
|
76 |
name: Cosine Accuracy
|
77 |
- type: cosine_accuracy_threshold
|
78 |
+
value: 0.4801735281944275
|
79 |
name: Cosine Accuracy Threshold
|
80 |
- type: cosine_f1
|
81 |
+
value: 0.9998429894802952
|
82 |
name: Cosine F1
|
83 |
- type: cosine_f1_threshold
|
84 |
+
value: 0.4801735281944275
|
85 |
name: Cosine F1 Threshold
|
86 |
- type: cosine_precision
|
87 |
+
value: 1.0
|
88 |
name: Cosine Precision
|
89 |
- type: cosine_recall
|
90 |
+
value: 0.9996860282574568
|
91 |
name: Cosine Recall
|
92 |
- type: cosine_ap
|
93 |
+
value: 0.9999999999999999
|
94 |
name: Cosine Ap
|
95 |
- type: cosine_mcc
|
96 |
+
value: 0.0
|
97 |
name: Cosine Mcc
|
98 |
- task:
|
99 |
type: binary-classification
|
|
|
103 |
type: test
|
104 |
metrics:
|
105 |
- type: cosine_accuracy
|
106 |
+
value: 0.9999627560521416
|
107 |
name: Cosine Accuracy
|
108 |
- type: cosine_accuracy_threshold
|
109 |
+
value: 0.42059871554374695
|
110 |
name: Cosine Accuracy Threshold
|
111 |
- type: cosine_f1
|
112 |
+
value: 0.9999813776792864
|
113 |
name: Cosine F1
|
114 |
- type: cosine_f1_threshold
|
115 |
+
value: 0.42059871554374695
|
116 |
name: Cosine F1 Threshold
|
117 |
- type: cosine_precision
|
118 |
+
value: 1.0
|
119 |
name: Cosine Precision
|
120 |
- type: cosine_recall
|
121 |
+
value: 0.9999627560521416
|
122 |
name: Cosine Recall
|
123 |
- type: cosine_ap
|
124 |
+
value: 1.0
|
125 |
name: Cosine Ap
|
126 |
- type: cosine_mcc
|
127 |
+
value: 0.0
|
128 |
name: Cosine Mcc
|
129 |
---
|
130 |
|
|
|
178 |
model = SentenceTransformer("redis/langcache-embed-v3")
|
179 |
# Run inference
|
180 |
sentences = [
|
181 |
+
'A group of boys are playing with a ball in front of a large door made of wood',
|
182 |
+
'The children are playing in front of a large door',
|
183 |
+
'What are some good techniques for controlling your anger?',
|
184 |
]
|
185 |
embeddings = model.encode(sentences)
|
186 |
print(embeddings.shape)
|
|
|
189 |
# Get the similarity scores for the embeddings
|
190 |
similarities = model.similarity(embeddings, embeddings)
|
191 |
print(similarities)
|
192 |
+
# tensor([[1.0000, 0.8672, 0.4121],
|
193 |
+
# [0.8672, 1.0000, 0.4219],
|
194 |
+
# [0.4121, 0.4219, 1.0000]], dtype=torch.bfloat16)
|
195 |
```
|
196 |
|
197 |
<!--
|
|
|
227 |
* Datasets: `val` and `test`
|
228 |
* Evaluated with [<code>BinaryClassificationEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.BinaryClassificationEvaluator)
|
229 |
|
230 |
+
| Metric | val | test |
|
231 |
+
|:--------------------------|:--------|:--------|
|
232 |
+
| cosine_accuracy | 0.9997 | 1.0 |
|
233 |
+
| cosine_accuracy_threshold | 0.4802 | 0.4206 |
|
234 |
+
| cosine_f1 | 0.9998 | 1.0 |
|
235 |
+
| cosine_f1_threshold | 0.4802 | 0.4206 |
|
236 |
+
| cosine_precision | 1.0 | 1.0 |
|
237 |
+
| cosine_recall | 0.9997 | 1.0 |
|
238 |
+
| **cosine_ap** | **1.0** | **1.0** |
|
239 |
+
| cosine_mcc | 0.0 | 0.0 |
|
240 |
|
241 |
<!--
|
242 |
## Bias, Risks and Limitations
|
|
|
257 |
#### LangCache Sentence Pairs (all)
|
258 |
|
259 |
* Dataset: [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1)
|
260 |
+
* Size: 26,850 training samples
|
261 |
+
* Columns: <code>sentence1</code> and <code>sentence2</code>
|
262 |
* Approximate statistics based on the first 1000 samples:
|
263 |
+
| | sentence1 | sentence2 |
|
264 |
+
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
|
265 |
+
| type | string | string |
|
266 |
+
| details | <ul><li>min: 4 tokens</li><li>mean: 16.76 tokens</li><li>max: 44 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 16.58 tokens</li><li>max: 44 tokens</li></ul> |
|
267 |
* Samples:
|
268 |
+
| sentence1 | sentence2 |
|
269 |
+
|:---------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------|
|
270 |
+
| <code>A chef is preparing a meal</code> | <code>Some food is being prepared by a chef</code> |
|
271 |
+
| <code>The presentation is being watched by a classroom of students</code> | <code>A classroom is full of students</code> |
|
272 |
+
| <code>Garden River , located north of Garden River Airport , Alberta , Canada .</code> | <code>Garden River , , is located north of Garden River Airport , Alberta , Canada .</code> |
|
273 |
+
* Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
|
274 |
```json
|
275 |
{
|
276 |
"scale": 20.0,
|
277 |
+
"similarity_fct": "cos_sim",
|
278 |
+
"gather_across_devices": false
|
279 |
}
|
280 |
```
|
281 |
|
|
|
284 |
#### LangCache Sentence Pairs (all)
|
285 |
|
286 |
* Dataset: [LangCache Sentence Pairs (all)](https://huggingface.co/datasets/redis/langcache-sentencepairs-v1)
|
287 |
+
* Size: 26,850 evaluation samples
|
288 |
+
* Columns: <code>sentence1</code> and <code>sentence2</code>
|
289 |
* Approximate statistics based on the first 1000 samples:
|
290 |
+
| | sentence1 | sentence2 |
|
291 |
+
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
|
292 |
+
| type | string | string |
|
293 |
+
| details | <ul><li>min: 4 tokens</li><li>mean: 16.76 tokens</li><li>max: 44 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 16.58 tokens</li><li>max: 44 tokens</li></ul> |
|
294 |
* Samples:
|
295 |
+
| sentence1 | sentence2 |
|
296 |
+
|:---------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------|
|
297 |
+
| <code>A chef is preparing a meal</code> | <code>Some food is being prepared by a chef</code> |
|
298 |
+
| <code>The presentation is being watched by a classroom of students</code> | <code>A classroom is full of students</code> |
|
299 |
+
| <code>Garden River , located north of Garden River Airport , Alberta , Canada .</code> | <code>Garden River , , is located north of Garden River Airport , Alberta , Canada .</code> |
|
300 |
+
* Loss: [<code>MultipleNegativesSymmetricRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativessymmetricrankingloss) with these parameters:
|
301 |
```json
|
302 |
{
|
303 |
"scale": 20.0,
|
304 |
+
"similarity_fct": "cos_sim",
|
305 |
+
"gather_across_devices": false
|
306 |
}
|
307 |
```
|
308 |
|
309 |
### Training Logs
|
310 |
| Epoch | Step | val_cosine_ap | test_cosine_ap |
|
311 |
|:-----:|:----:|:-------------:|:--------------:|
|
312 |
+
| -1 | -1 | 1.0000 | 1.0 |
|
313 |
|
314 |
|
315 |
### Framework Versions
|
|
|
338 |
}
|
339 |
```
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
<!--
|
342 |
## Glossary
|
343 |
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 298041696
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:95d02211c4cca89113f9f3e93ed91f5176bf50170faa2cb835f7bfea15bb9dd2
|
3 |
size 298041696
|