File size: 15,582 Bytes
29d8025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: I was charged twice for the same service on my last billing cycle. Can you
    help me confirm this?
- text: Can you tell me if the ATM is available 24/7 at this location?
- text: Can you explain how my account balance affects the service fees I’m being
    charged?
- text: I need to know the outstanding amount on my education loan.
- text: Can you break down how interest rates affect my monthly payments for a home
    equity loan?
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
datasets:
- rbojja/labelled_bank_support_dataset
base_model: BAAI/bge-small-en-v1.5
model-index:
- name: SetFit with BAAI/bge-small-en-v1.5
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: rbojja/labelled_bank_support_dataset
      type: rbojja/labelled_bank_support_dataset
      split: test
    metrics:
    - type: accuracy
      value: 0.8640988372093024
      name: Accuracy
---

# SetFit with BAAI/bge-small-en-v1.5

This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [rbojja/labelled_bank_support_dataset](https://huggingface.co/datasets/rbojja/labelled_bank_support_dataset) dataset that can be used for Text Classification. This SetFit model uses [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.

The model has been trained using an efficient few-shot learning technique that involves:

1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
2. Training a classification head with features from the fine-tuned Sentence Transformer.

## Model Details

### Model Description
- **Model Type:** SetFit
- **Sentence Transformer body:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 512 tokens
- **Number of Classes:** 10 classes
- **Training Dataset:** [rbojja/labelled_bank_support_dataset](https://huggingface.co/datasets/rbojja/labelled_bank_support_dataset)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)

### Model Labels
| Label | Examples                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1     | <ul><li>'Can you explain the differences between fixed and variable interest rates for personal loans?'</li><li>'Can you clarify why I was charged a fee for my account this month?'</li><li>'How can I access your customer service features if I need assistance?'</li></ul>                                                                                                                                                                                                   |
| 2     | <ul><li>'Could you please verify that my deposit cancellation has been completed?'</li><li>"I've noticed a discrepancy in my balance after my latest deposit. Can you confirm if it was processed correctly?"</li><li>'Could you verify that my recent payment has been reversed successfully?'</li></ul>                                                                                                                                                                        |
| 3     | <ul><li>"How do changes in the central bank's interest rates affect the interest I earn on my savings account?"</li><li>'Can I share my success story about earning rewards for referring friends? The incentives really helped me and I think others should know!'</li><li>'After my recent loan denial, how can I strengthen my reapplication to improve my approval odds?'</li></ul>                                                                                          |
| 10    | <ul><li>"I just made a payment, but I'm not sure if it's been processed yet. Can you check for me?"</li><li>'I think there might be an error with my account balance; can you show me my most recent transactions?'</li><li>'I expected my payment to be completed by now, can you check the status for me?'</li></ul>                                                                                                                                                           |
| 9     | <ul><li>'Can you please pass on my thanks to the customer service representative who helped me with my account security concerns? Their support made all the difference!'</li><li>'I just wanted to say thank you for the quick help with my issue!'</li><li>'I want to express my appreciation for the security alerts I received. It’s nice to know my account is being protected so well!'</li></ul>                                                                          |
| 4     | <ul><li>"I'm ending my account with you; can you provide a summary of my final transaction?"</li></ul>                                                                                                                                                                                                                                                                                                                                                                           |
| 7     | <ul><li>'Can I leave a review about my downgrade process? I have some suggestions for improvement.'</li><li>'Can you send me a notification of all my completed payments for this month?'</li><li>'Can you tell me how I can benefit from any investment opportunities with your bank?'</li></ul>                                                                                                                                                                                |
| 6     | <ul><li>'I just checked my banking statement and I don’t recognize this last charge. How can I contest that?'</li><li>"I believe I've been incorrectly charged for a subscription service. What steps do I take?"</li><li>'I appreciate the service you provide, but the support response time during the outage was unacceptable.'</li></ul>                                                                                                                                    |
| 0     | <ul><li>'I’m sorry, but I need to check on a transaction that was denied because of insufficient funds. Can you help me resolve this situation?'</li><li>"I'm really sorry, but I still can't access my account even after resetting my password. What should I do next?"</li><li>"I've been mistakenly locked out of my account and I feel bad about it. Can you assist me in regaining access?"</li></ul>                                                                      |
| 8     | <ul><li>'I recently used your services and I’m really satisfied. Is there a way to share my thoughts on my overall banking experience?'</li><li>'I think it would be great if final account statements could be sent out at the beginning of the month instead of the end. It allows for better planning and review.'</li><li>'I wanted to share that I found the loan application submission very straightforward. When can I expect to hear back about my approval?'</li></ul> |

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.8641   |

## Uses

### Direct Use for Inference

First install the SetFit library:

```bash
pip install setfit
```

Then you can load this model and run inference.

```python
from setfit import SetFitModel

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("rbojja/ft-intent-bank")
# Run inference
preds = model("I need to know the outstanding amount on my education loan.")
```

<!--
### Downstream Use

*List how someone could finetune this model on their own dataset.*
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Set Metrics
| Training set | Min | Median | Max |
|:-------------|:----|:-------|:----|
| Word count   | 7   | 15.322 | 31  |

| Label | Training Sample Count |
|:------|:----------------------|
| 0     | 7                     |
| 1     | 797                   |
| 2     | 29                    |
| 3     | 18                    |
| 4     | 1                     |
| 6     | 15                    |
| 7     | 7                     |
| 8     | 6                     |
| 9     | 63                    |
| 10    | 57                    |

### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (1, 16)
- max_steps: 3450
- sampling_strategy: oversampling
- body_learning_rate: (2e-05, 1e-05)
- head_learning_rate: 0.01
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0003 | 1    | 0.2179        | -               |
| 0.0145 | 50   | 0.2598        | -               |
| 0.0290 | 100  | 0.2349        | -               |
| 0.0435 | 150  | 0.2019        | -               |
| 0.0580 | 200  | 0.1686        | -               |
| 0.0725 | 250  | 0.1375        | -               |
| 0.0870 | 300  | 0.1265        | -               |
| 0.1014 | 350  | 0.0954        | -               |
| 0.1159 | 400  | 0.0794        | -               |
| 0.1304 | 450  | 0.065         | -               |
| 0.1449 | 500  | 0.0731        | -               |
| 0.1594 | 550  | 0.0547        | -               |
| 0.1739 | 600  | 0.043         | -               |
| 0.1884 | 650  | 0.0327        | -               |
| 0.2029 | 700  | 0.027         | -               |
| 0.2174 | 750  | 0.0285        | -               |
| 0.2319 | 800  | 0.0201        | -               |
| 0.2464 | 850  | 0.0151        | -               |
| 0.2609 | 900  | 0.0131        | -               |
| 0.2754 | 950  | 0.0076        | -               |
| 0.2899 | 1000 | 0.0147        | -               |
| 0.3043 | 1050 | 0.0122        | -               |
| 0.3188 | 1100 | 0.0109        | -               |
| 0.3333 | 1150 | 0.0126        | -               |
| 0.3478 | 1200 | 0.0108        | -               |
| 0.3623 | 1250 | 0.009         | -               |
| 0.3768 | 1300 | 0.0072        | -               |
| 0.3913 | 1350 | 0.0051        | -               |
| 0.4058 | 1400 | 0.0057        | -               |
| 0.4203 | 1450 | 0.0056        | -               |
| 0.4348 | 1500 | 0.0079        | -               |
| 0.4493 | 1550 | 0.0076        | -               |
| 0.4638 | 1600 | 0.0029        | -               |
| 0.4783 | 1650 | 0.0039        | -               |
| 0.4928 | 1700 | 0.003         | -               |
| 0.5072 | 1750 | 0.0037        | -               |
| 0.5217 | 1800 | 0.0022        | -               |
| 0.5362 | 1850 | 0.0032        | -               |
| 0.5507 | 1900 | 0.0034        | -               |
| 0.5652 | 1950 | 0.006         | -               |
| 0.5797 | 2000 | 0.0046        | -               |
| 0.5942 | 2050 | 0.0026        | -               |
| 0.6087 | 2100 | 0.0031        | -               |
| 0.6232 | 2150 | 0.0041        | -               |
| 0.6377 | 2200 | 0.0049        | -               |
| 0.6522 | 2250 | 0.0015        | -               |
| 0.6667 | 2300 | 0.0053        | -               |
| 0.6812 | 2350 | 0.0033        | -               |
| 0.6957 | 2400 | 0.0055        | -               |
| 0.7101 | 2450 | 0.0044        | -               |
| 0.7246 | 2500 | 0.0036        | -               |
| 0.7391 | 2550 | 0.0038        | -               |
| 0.7536 | 2600 | 0.0038        | -               |
| 0.7681 | 2650 | 0.0027        | -               |
| 0.7826 | 2700 | 0.0028        | -               |
| 0.7971 | 2750 | 0.0038        | -               |
| 0.8116 | 2800 | 0.0033        | -               |
| 0.8261 | 2850 | 0.0035        | -               |
| 0.8406 | 2900 | 0.002         | -               |
| 0.8551 | 2950 | 0.0034        | -               |
| 0.8696 | 3000 | 0.0053        | -               |
| 0.8841 | 3050 | 0.0035        | -               |
| 0.8986 | 3100 | 0.0016        | -               |
| 0.9130 | 3150 | 0.0021        | -               |
| 0.9275 | 3200 | 0.0021        | -               |
| 0.9420 | 3250 | 0.005         | -               |
| 0.9565 | 3300 | 0.0031        | -               |
| 0.9710 | 3350 | 0.0038        | -               |
| 0.9855 | 3400 | 0.0029        | -               |
| 1.0    | 3450 | 0.0019        | -               |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.1.1
- Sentence Transformers: 3.3.1
- Transformers: 4.47.1
- PyTorch: 2.5.1+cu124
- Datasets: 3.2.0
- Tokenizers: 0.21.0

## Citation

### BibTeX
```bibtex
@article{https://doi.org/10.48550/arxiv.2209.11055,
    doi = {10.48550/ARXIV.2209.11055},
    url = {https://arxiv.org/abs/2209.11055},
    author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
    keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
    title = {Efficient Few-Shot Learning Without Prompts},
    publisher = {arXiv},
    year = {2022},
    copyright = {Creative Commons Attribution 4.0 International}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->