tjohn327 commited on
Commit
24f7e6a
·
verified ·
1 Parent(s): 8a01780

Fine-tuned all-mpnet-base-v2 for SCION RAG retrieval

Browse files
Files changed (3) hide show
  1. README.md +24 -242
  2. config.json +1 -1
  3. model.safetensors +1 -1
README.md CHANGED
@@ -1,258 +1,40 @@
1
  ---
 
 
2
  tags:
3
  - sentence-transformers
4
- - sentence-similarity
5
- - feature-extraction
6
- - generated_from_trainer
7
- - dataset_size:22349
8
- - loss:MultipleNegativesRankingLoss
9
- base_model: sentence-transformers/all-MiniLM-L6-v2
10
-
11
- pipeline_tag: sentence-similarity
12
- library_name: sentence-transformers
13
  metrics:
14
- - cosine_accuracy@1
15
- - cosine_accuracy@3
16
- - cosine_accuracy@5
17
- - cosine_accuracy@10
18
- - cosine_precision@1
19
- - cosine_precision@3
20
- - cosine_precision@5
21
- - cosine_precision@10
22
- - cosine_recall@1
23
- - cosine_recall@3
24
- - cosine_recall@5
25
- - cosine_recall@10
26
- - cosine_ndcg@10
27
- - cosine_mrr@10
28
- - cosine_map@100
29
- model-index:
30
- - name: SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
31
- results:
32
- - task:
33
- type: information-retrieval
34
- name: Information Retrieval
35
- dataset:
36
- name: val ir eval
37
- type: val-ir-eval
38
- metrics:
39
- - type: cosine_accuracy@1
40
- value: 0.6766146993318486
41
- name: Cosine Accuracy@1
42
- - type: cosine_accuracy@3
43
- value: 0.8712694877505568
44
- name: Cosine Accuracy@3
45
- - type: cosine_accuracy@5
46
- value: 0.9131403118040089
47
- name: Cosine Accuracy@5
48
- - type: cosine_accuracy@10
49
- value: 0.9532293986636972
50
- name: Cosine Accuracy@10
51
- - type: cosine_precision@1
52
- value: 0.6766146993318486
53
- name: Cosine Precision@1
54
- - type: cosine_precision@3
55
- value: 0.29042316258351886
56
- name: Cosine Precision@3
57
- - type: cosine_precision@5
58
- value: 0.18271714922048995
59
- name: Cosine Precision@5
60
- - type: cosine_precision@10
61
- value: 0.09536748329621379
62
- name: Cosine Precision@10
63
- - type: cosine_recall@1
64
- value: 0.6766146993318486
65
- name: Cosine Recall@1
66
- - type: cosine_recall@3
67
- value: 0.8710467706013363
68
- name: Cosine Recall@3
69
- - type: cosine_recall@5
70
- value: 0.9131403118040089
71
- name: Cosine Recall@5
72
- - type: cosine_recall@10
73
- value: 0.9532293986636972
74
- name: Cosine Recall@10
75
- - type: cosine_ndcg@10
76
- value: 0.8214443655056687
77
- name: Cosine Ndcg@10
78
- - type: cosine_mrr@10
79
- value: 0.778392194294197
80
- name: Cosine Mrr@10
81
- - type: cosine_map@100
82
- value: 0.7806624678050911
83
- name: Cosine Map@100
84
  ---
85
 
86
- # SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
87
-
88
- This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) on a dataset of questions about [SCION](https://scion-architecture.net/) Internet Architecture paired with relevant passages from related research papers and documentation. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
89
-
90
- ## Model Details
91
-
92
- ### Model Description
93
- - **Model Type:** Sentence Transformer
94
- - **Base model:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) <!-- at revision fa97f6e7cb1a59073dff9e6b13e2715cf7475ac9 -->
95
- - **Maximum Sequence Length:** 256 tokens
96
- - **Output Dimensionality:** 384 dimensions
97
- - **Similarity Function:** Cosine Similarity
98
- <!-- - **Training Dataset:** Unknown -->
99
- <!-- - **Language:** Unknown -->
100
- <!-- - **License:** Unknown -->
101
-
102
- ### Model Sources
103
-
104
- - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
105
- - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
106
- - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
107
-
108
- ### Full Model Architecture
109
-
110
- ```
111
- SentenceTransformer(
112
- (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
113
- (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
114
- (2): Normalize()
115
- )
116
- ```
117
-
118
- ## Usage
119
-
120
- ### Direct Usage (Sentence Transformers)
121
-
122
- First install the Sentence Transformers library:
123
-
124
- ```bash
125
- pip install -U sentence-transformers
126
- ```
127
-
128
- Then you can load this model and run inference.
129
- ```python
130
- from sentence_transformers import SentenceTransformer
131
-
132
- # Download from the 🤗 Hub
133
- model = SentenceTransformer("tjohn327/scion-minilm-l6-v2")
134
- # Run inference
135
- sentences = [
136
- ""
137
- ]
138
- embeddings = model.encode(sentences)
139
- print(embeddings.shape)
140
- # [3, 384]
141
-
142
- # Get the similarity scores for the embeddings
143
- similarities = model.similarity(embeddings, embeddings)
144
- print(similarities.shape)
145
- # [3, 3]
146
- ```
147
-
148
- <!--
149
- ### Direct Usage (Transformers)
150
-
151
- <details><summary>Click to see the direct usage in Transformers</summary>
152
-
153
- </details>
154
- -->
155
-
156
- <!--
157
- ### Downstream Usage (Sentence Transformers)
158
-
159
- You can finetune this model on your own dataset.
160
-
161
- <details><summary>Click to expand</summary>
162
-
163
- </details>
164
- -->
165
-
166
- <!--
167
- ### Out-of-Scope Use
168
-
169
- *List how the model may foreseeably be misused and address what users ought not to do with the model.*
170
- -->
171
-
172
- ## Evaluation
173
-
174
- ### Metrics
175
-
176
- #### Information Retrieval
177
-
178
- * Dataset: `val-ir-eval`
179
- * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
180
-
181
- | Metric | Value |
182
- |:--------------------|:-----------|
183
- | cosine_accuracy@1 | 0.6766 |
184
- | cosine_accuracy@3 | 0.8713 |
185
- | cosine_accuracy@5 | 0.9131 |
186
- | cosine_accuracy@10 | 0.9532 |
187
- | cosine_precision@1 | 0.6766 |
188
- | cosine_precision@3 | 0.2904 |
189
- | cosine_precision@5 | 0.1827 |
190
- | cosine_precision@10 | 0.0954 |
191
- | cosine_recall@1 | 0.6766 |
192
- | cosine_recall@3 | 0.871 |
193
- | cosine_recall@5 | 0.9131 |
194
- | cosine_recall@10 | 0.9532 |
195
- | **cosine_ndcg@10** | **0.8214** |
196
- | cosine_mrr@10 | 0.7784 |
197
- | cosine_map@100 | 0.7807 |
198
-
199
- <!--
200
- ## Bias, Risks and Limitations
201
-
202
- *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
203
- -->
204
-
205
- <!--
206
- ### Recommendations
207
-
208
- *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
209
- -->
210
-
211
-
212
 
213
- ## Citation
214
 
215
- ### BibTeX
216
 
217
- #### Sentence Transformers
218
- ```bibtex
219
- @inproceedings{reimers-2019-sentence-bert,
220
- title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
221
- author = "Reimers, Nils and Gurevych, Iryna",
222
- booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
223
- month = "11",
224
- year = "2019",
225
- publisher = "Association for Computational Linguistics",
226
- url = "https://arxiv.org/abs/1908.10084",
227
- }
228
- ```
229
 
230
- #### MultipleNegativesRankingLoss
231
- ```bibtex
232
- @misc{henderson2017efficient,
233
- title={Efficient Natural Language Response Suggestion for Smart Reply},
234
- author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
235
- year={2017},
236
- eprint={1705.00652},
237
- archivePrefix={arXiv},
238
- primaryClass={cs.CL}
239
- }
240
- ```
241
 
242
- <!--
243
- ## Glossary
244
 
245
- *Clearly define terms in order to be accessible across audiences.*
246
- -->
247
 
248
- <!--
249
- ## Model Card Authors
250
 
251
- *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
252
- -->
253
 
254
- <!--
255
- ## Model Card Contact
256
 
257
- *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
258
- -->
 
 
 
 
 
 
1
  ---
2
+ language: en
3
+ license: apache-2.0
4
  tags:
5
  - sentence-transformers
6
+ - text-embedding
7
+ - rag
8
+ - scion-architecture
9
+ datasets:
10
+ - custom
 
 
 
 
11
  metrics:
12
+ - retrieval
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ---
14
 
15
+ # SCION Questions Embedding Model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ This model is fine-tuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) on a dataset of questions about SCION internet architecture paired with relevant document passages.
18
 
19
+ ## Model description
20
 
21
+ The model was fine-tuned to optimize for retrieval performance in RAG applications related to SCION internet architecture.
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ ## Intended uses & limitations
 
 
 
 
 
 
 
 
 
 
24
 
25
+ This model is specifically trained for retrieving relevant passages from a corpus of SCION Internet Architecture related documentation, specifications and research papers.
 
26
 
27
+ ## Training procedure
 
28
 
29
+ The model was trained using sentence-transformers with MultipleNegativesRankingLoss on query-document pairs.
 
30
 
 
 
31
 
32
+ ## Performance
 
33
 
34
+ | Metric | Base Model | Fine-tuned | Improvement |
35
+ |--------|------------|------------|-------------|
36
+ | ndcg@10 | 0.6009 | 0.7928 | +31.92% |
37
+ | mrr | 0.5476 | 0.7475 | +36.52% |
38
+ | hits@1 | 0.4395 | 0.6457 | +46.94% |
39
+ | hits@3 | 0.6211 | 0.8327 | +34.08% |
40
+ | hits@10 | 0.7686 | 0.9323 | +21.30% |
config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "_name_or_path": "./scion-minilm-l6-v2",
3
  "architectures": [
4
  "BertModel"
5
  ],
 
1
  {
2
+ "_name_or_path": "./scion-minilm",
3
  "architectures": [
4
  "BertModel"
5
  ],
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:386d3d2094d30f14f2341e38fb8b54d57a869dc2bd0c1ad9e6fe0baeb19b365a
3
  size 90864192
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fae86901ed3c73648f0d768f6a3c6587ec960c43533d2a89296d03cbb96e657b
3
  size 90864192