---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: '"I think this might be the solution."'
- text: '"Oh no, I apologize!"'
- text: Could you repeat that, please?
- text: Oh, this is so disappointing.
- text: Uhh, clear.
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
datasets:
- rbojja/zero-shot-intent-classification
base_model: BAAI/bge-small-en-v1.5
---
# SetFit with BAAI/bge-small-en-v1.5
This is a [SetFit](https://github.com/huggingface/setfit) model trained on the [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification) 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:** 18 classes
- **Training Dataset:** [rbojja/zero-shot-intent-classification](https://huggingface.co/datasets/rbojja/zero-shot-intent-classification)
### 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 |
|:------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
| 7 |
- 'Oh my, this is great!'
- 'Oh, this is fantastic!'
- 'Hmm, I’m so delighted!'
|
| 3 | - "Oh, absolutely, that's it!"
- "Oh, absolutely, that's it!"
- "Yep, that's exactly what I meant."
|
| 15 | - 'Really, no way?'
- 'Oh, that’s quite something!'
- 'Oh, that’s quite something!'
|
| 8 | - "Gotcha... oh, that's clear!"
- 'Hmm, I see... perfect!'
- 'Oh, I see... clear!'
|
| 12 | - 'Uhh, fine.'
- 'Oh, clear.'
- 'Uhh, noted.'
|
| 9 | - 'Uhh, take care!'
- 'Hmm, see you!'
- 'Uhh, see you!'
|
| 17 | - '"Umm, this could be a decent plan."'
- '"I think this might be the solution."'
- '"Maybe this will work out, I suppose."'
|
| 0 | - "Why can't you just work?!"
- 'Seriously, this is a joke!'
- 'Ugh, this is so frustrating!'
|
| 6 | - '"Oh, what if I\'m a dream?"'
- '"Oh, do you speak dolphin?"'
- '"Uhh, do you have a wish?"'
|
| 11 | - "Uh-huh, that's a valid point."
- 'Like, I get it.'
- 'Right, I understand.'
|
| 16 | - 'Thank you!'
- '"Hmmm, thanks, you\'re great!"'
- '"Oh, fantastic, thanks a lot!"'
|
| 4 | - "Sorry, I'm not sure."
- "Well, I'm lost."
- "Hmm, I'm not sure."
|
| 10 | - 'Oh, hi!'
- "Hello! What's new?"
- "Hi! How's life?"
|
| 13 | - 'Oh, gotcha.'
- 'Hmmm, okay.'
- 'Alright, thanks.'
|
| 2 | - 'What’s the context behind that?'
- 'Could you simplify that for me?'
- 'Can you explain that concept?'
|
| 1 | - '"Oh, I didn’t mean to."'
- '"Oops, sorry for the oversight."'
- '"Oops, I’m really sorry."'
|
| 5 | - 'Oh, this is not what I wanted.'
- 'Oh no, this is not right.'
- 'Seriously, this is a failure.'
|
| 14 | - 'Uhh, superb choice!'
- 'Uhh, amazing decision!'
- 'Oh, superb performance!'
|
## 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/intent-classification-small")
# Run inference
preds = model("Uhh, clear.")
```
## Training Details
### Training Set Metrics
| Training set | Min | Median | Max |
|:-------------|:----|:-------|:----|
| Word count | 2 | 4.2224 | 9 |
| Label | Training Sample Count |
|:------|:----------------------|
| 0 | 40 |
| 1 | 40 |
| 2 | 37 |
| 3 | 40 |
| 4 | 41 |
| 5 | 38 |
| 6 | 42 |
| 7 | 38 |
| 8 | 35 |
| 9 | 39 |
| 10 | 42 |
| 11 | 41 |
| 12 | 42 |
| 13 | 44 |
| 14 | 38 |
| 15 | 43 |
| 16 | 47 |
| 17 | 37 |
### Training Hyperparameters
- batch_size: (16, 2)
- num_epochs: (1, 16)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- 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.0006 | 1 | 0.149 | - |
| 0.0276 | 50 | 0.1836 | - |
| 0.0552 | 100 | 0.1408 | - |
| 0.0829 | 150 | 0.0978 | - |
| 0.1105 | 200 | 0.0805 | - |
| 0.1381 | 250 | 0.0684 | - |
| 0.1657 | 300 | 0.0594 | - |
| 0.1934 | 350 | 0.051 | - |
| 0.2210 | 400 | 0.0383 | - |
| 0.2486 | 450 | 0.0379 | - |
| 0.2762 | 500 | 0.035 | - |
| 0.3039 | 550 | 0.0334 | - |
| 0.3315 | 600 | 0.0306 | - |
| 0.3591 | 650 | 0.0266 | - |
| 0.3867 | 700 | 0.0264 | - |
| 0.4144 | 750 | 0.018 | - |
| 0.4420 | 800 | 0.0193 | - |
| 0.4696 | 850 | 0.0166 | - |
| 0.4972 | 900 | 0.0165 | - |
| 0.5249 | 950 | 0.016 | - |
| 0.5525 | 1000 | 0.0177 | - |
| 0.5801 | 1050 | 0.0202 | - |
| 0.6077 | 1100 | 0.0133 | - |
| 0.6354 | 1150 | 0.014 | - |
| 0.6630 | 1200 | 0.013 | - |
| 0.6906 | 1250 | 0.0161 | - |
| 0.7182 | 1300 | 0.0119 | - |
| 0.7459 | 1350 | 0.0132 | - |
| 0.7735 | 1400 | 0.0131 | - |
| 0.8011 | 1450 | 0.0123 | - |
| 0.8287 | 1500 | 0.0115 | - |
| 0.8564 | 1550 | 0.0111 | - |
| 0.8840 | 1600 | 0.011 | - |
| 0.9116 | 1650 | 0.01 | - |
| 0.9392 | 1700 | 0.0098 | - |
| 0.9669 | 1750 | 0.0142 | - |
| 0.9945 | 1800 | 0.0132 | - |
### Framework Versions
- Python: 3.11.11
- SetFit: 1.1.1
- Sentence Transformers: 3.3.1
- Transformers: 4.47.1
- PyTorch: 2.5.1+cu121
- 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}
}
```