SetFit with sentence-transformers/paraphrase-mpnet-base-v2
This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/paraphrase-mpnet-base-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
- Fine-tuning a Sentence Transformer with contrastive learning.
- Training a classification head with features from the fine-tuned Sentence Transformer.
Model Details
Model Description
Model Sources
Model Labels
| Label |
Examples |
| list_documents |
- 'Quels sont les documents disponibles dans la base?'
- 'Peux-tu me lister tous les fichiers présents?'
- 'Montre-moi tous les documents que tu as'
|
| get_section |
- 'Peux-tu extraire la section 3 du document X?'
- "J'ai besoin du chapitre 2 du fichier Y"
- "Donne-moi la partie sur l'introduction du document Z"
|
| translate_summarize |
- 'Traduis cette section en anglais'
- 'Peux-tu résumer ce passage en français?'
- 'Fais-moi une traduction en allemand de cette partie'
|
| modify_data |
- 'Ajoute cette information à la base de données'
- "Modifie l'entrée pour qu'elle inclue cette donnée"
- "Peux-tu mettre à jour l'enregistrement existant?"
|
| send_email |
- 'Envoie cet email à Paul'
- 'Peux-tu rédiger un email pour moi?'
- 'Transmets ce message à mon collègue'
|
| generate_document |
- 'Crée un document Word avec cette réponse'
- 'Génère un fichier PDF avec ces informations'
- 'Peux-tu produire un PowerPoint avec ce contenu?'
|
| book_ticket |
- 'Réserve-moi un billet de train pour Paris'
- "Je veux acheter un billet d'avion pour Berlin"
- 'Peux-tu réserver une place pour le bus de demain?'
|
| out_of_scope |
- "Quelle est la météo aujourd'hui?"
- 'Combien coûte un iPhone 14?'
- 'Qui a gagné la coupe du monde 2018?'
|
Uses
Direct Use for Inference
First install the SetFit library:
pip install setfit
Then you can load this model and run inference.
from setfit import SetFitModel
model = SetFitModel.from_pretrained("weksteineyal/setfit-model")
preds = model("Qui a gagné la coupe du monde 2018?")
Training Details
Training Set Metrics
| Training set |
Min |
Median |
Max |
| Word count |
4 |
6.8077 |
9 |
| Label |
Training Sample Count |
| book_ticket |
3 |
| generate_document |
3 |
| get_section |
3 |
| list_documents |
3 |
| modify_data |
3 |
| out_of_scope |
5 |
| send_email |
3 |
| translate_summarize |
3 |
Training Hyperparameters
- batch_size: (8, 8)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- 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.0077 |
1 |
0.2123 |
- |
| 0.3846 |
50 |
0.1423 |
- |
| 0.7692 |
100 |
0.0488 |
- |
Framework Versions
- Python: 3.11.7
- SetFit: 1.1.1
- Sentence Transformers: 3.4.1
- Transformers: 4.49.0
- PyTorch: 2.6.0+cpu
- Datasets: 3.3.2
- Tokenizers: 0.21.0
Citation
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}
}