SetFit with sentence-transformers/all-mpnet-base-v2
This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/all-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 |
| 1 |
- 'what can your do with your mcp tool db2 schema'
- 'is this normal?\nGC(47) Pause Young 234M->89M 12.5ms'
- 'what units is file_size in? what format is mimetype in'
|
| 0 |
- 'use mongo and postgres mcps to find test data'
- 'browser screenshot the error page'
- 'use the linear mcp to find my high priority issues'
|
| 2 |
- 'java\npublic void process() {\n if (user != null) {\n // stuff\n }\n}\n\nclean this up'
- "Duplicate class: 'ChunkCacheMetricsTest'"
- "python\ndef process(data):\n result = []\n for item in data:\n if item['active']:\n result.append(item['value'])\n return result\n\nuse list comprehension"
|
| 3 |
- 'review security scan then patch critical issues'
- 'analyze failing tests, group them, fix each group'
- '\n47 tests failing\n\ncategorize and fix each category'
|
| 5 |
- 'model architecture not supported, plan alternative approach'
- 'architecture diagram for wml'
- 'before we move on let me ask - can we develop a set of documents that break the implementation down into individual tasks - the first one being a simple core set of function that could deliver a a single starting point. and then add layers of function in subsequent tasks to methodically build out th'
|
| 4 |
- 'yes the linear mcp is finally connected'
- 'Usually we use a custom linter config here, not the standard one'
- 'ok it worked after i restarted the postgres mcp server'
|
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("tmp/best_model")
preds = model("lets fix the issues")
Training Details
Training Set Metrics
| Training set |
Min |
Median |
Max |
| Word count |
1 |
12.0749 |
125 |
| Label |
Training Sample Count |
| 0 |
43 |
| 1 |
80 |
| 2 |
92 |
| 3 |
56 |
| 4 |
70 |
| 5 |
86 |
Training Hyperparameters
- batch_size: (32, 32)
- num_epochs: (2, 2)
- max_steps: -1
- sampling_strategy: undersampling
- num_iterations: 12
- body_learning_rate: (5.430507564500918e-05, 5.430507564500918e-05)
- head_learning_rate: 0.0011800069021089953
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.006100049987809886
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: True
Training Results
| Epoch |
Step |
Training Loss |
Validation Loss |
| 0.0031 |
1 |
0.4098 |
- |
| 0.0156 |
5 |
- |
0.2620 |
| 0.0312 |
10 |
- |
0.2605 |
| 0.0467 |
15 |
- |
0.2279 |
| 0.0623 |
20 |
- |
0.2109 |
| 0.0779 |
25 |
- |
0.2051 |
| 0.0935 |
30 |
- |
0.1956 |
| 0.1090 |
35 |
- |
0.1925 |
| 0.1246 |
40 |
- |
0.1956 |
| 0.1402 |
45 |
- |
0.1915 |
| 0.1558 |
50 |
0.2041 |
0.1821 |
| 0.1713 |
55 |
- |
0.1853 |
| 0.1869 |
60 |
- |
0.1801 |
| 0.2025 |
65 |
- |
0.1736 |
| 0.2181 |
70 |
- |
0.1822 |
| 0.2336 |
75 |
- |
0.1781 |
| 0.2492 |
80 |
- |
0.1690 |
| 0.2648 |
85 |
- |
0.1709 |
| 0.2804 |
90 |
- |
0.1706 |
| 0.2960 |
95 |
- |
0.1708 |
| 0.3115 |
100 |
0.0674 |
0.1713 |
| 0.3271 |
105 |
- |
0.1738 |
Framework Versions
- Python: 3.12.12
- SetFit: 1.1.3
- Sentence Transformers: 3.4.1
- Transformers: 4.51.3
- PyTorch: 2.11.0+cu130
- Datasets: 4.8.4
- Tokenizers: 0.21.4
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}
}