SetFit with sentence-transformers/all-MiniLM-L6-v2

This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/all-MiniLM-L6-v2 as the Sentence Transformer embedding model. A OneVsRestClassifier 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 with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

Model Sources

Evaluation

Metrics

Label Accuracy
all 0.6441

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

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("amplyfi/all-MiniLM-L6-v2_multiclass_multilabel")
# Run inference
preds = model("Ofgem’s response to DECC energy policy announcement")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 4 9.9729 30

Training Hyperparameters

  • batch_size: (16, 2)
  • num_epochs: (10, 10)
  • 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.0005 1 0.4684 -
0.0226 50 0.3194 -
0.0452 100 0.2968 -
0.0678 150 0.2868 -
0.0904 200 0.2423 -
0.1130 250 0.2277 -
0.1356 300 0.2117 -
0.1582 350 0.2058 -
0.1808 400 0.2099 -
0.2033 450 0.2022 -
0.2259 500 0.1849 -
0.2485 550 0.1815 -
0.2711 600 0.1617 -
0.2937 650 0.1606 -
0.3163 700 0.1465 -
0.3389 750 0.1425 -
0.3615 800 0.138 -
0.3841 850 0.132 -
0.4067 900 0.1212 -
0.4293 950 0.128 -
0.4519 1000 0.1129 -
0.4745 1050 0.1093 -
0.4971 1100 0.1155 -
0.5197 1150 0.1066 -
0.5423 1200 0.0984 -
0.5648 1250 0.0926 -
0.5874 1300 0.0915 -
0.6100 1350 0.0844 -
0.6326 1400 0.0904 -
0.6552 1450 0.0772 -
0.6778 1500 0.0751 -
0.7004 1550 0.0786 -
0.7230 1600 0.0659 -
0.7456 1650 0.0602 -
0.7682 1700 0.0661 -
0.7908 1750 0.0758 -
0.8134 1800 0.0698 -
0.8360 1850 0.0621 -
0.8586 1900 0.0631 -
0.8812 1950 0.0621 -
0.9038 2000 0.055 -
0.9263 2050 0.0453 -
0.9489 2100 0.0509 -
0.9715 2150 0.0515 -
0.9941 2200 0.0558 -
1.0167 2250 0.0449 -
1.0393 2300 0.0456 -
1.0619 2350 0.0391 -
1.0845 2400 0.0431 -
1.1071 2450 0.0454 -
1.1297 2500 0.0342 -
1.1523 2550 0.0414 -
1.1749 2600 0.0325 -
1.1975 2650 0.039 -
1.2201 2700 0.0376 -
1.2427 2750 0.0303 -
1.2653 2800 0.0289 -
1.2878 2850 0.0307 -
1.3104 2900 0.0359 -
1.3330 2950 0.0333 -
1.3556 3000 0.0364 -
1.3782 3050 0.028 -
1.4008 3100 0.0403 -
1.4234 3150 0.0318 -
1.4460 3200 0.0281 -
1.4686 3250 0.025 -
1.4912 3300 0.0228 -
1.5138 3350 0.0265 -
1.5364 3400 0.0248 -
1.5590 3450 0.025 -
1.5816 3500 0.0181 -
1.6042 3550 0.0214 -
1.6268 3600 0.0208 -
1.6493 3650 0.028 -
1.6719 3700 0.0169 -
1.6945 3750 0.0238 -
1.7171 3800 0.0237 -
1.7397 3850 0.0208 -
1.7623 3900 0.0186 -
1.7849 3950 0.0168 -
1.8075 4000 0.0217 -
1.8301 4050 0.0215 -
1.8527 4100 0.0246 -
1.8753 4150 0.0208 -
1.8979 4200 0.0229 -
1.9205 4250 0.0233 -
1.9431 4300 0.0174 -
1.9657 4350 0.0158 -
1.9883 4400 0.0177 -
2.0108 4450 0.0182 -
2.0334 4500 0.0215 -
2.0560 4550 0.0151 -
2.0786 4600 0.0128 -
2.1012 4650 0.0144 -
2.1238 4700 0.0176 -
2.1464 4750 0.0161 -
2.1690 4800 0.0179 -
2.1916 4850 0.0151 -
2.2142 4900 0.0119 -
2.2368 4950 0.0143 -
2.2594 5000 0.0126 -
2.2820 5050 0.0151 -
2.3046 5100 0.0183 -
2.3272 5150 0.0189 -
2.3498 5200 0.0155 -
2.3723 5250 0.0166 -
2.3949 5300 0.0167 -
2.4175 5350 0.0171 -
2.4401 5400 0.0177 -
2.4627 5450 0.014 -
2.4853 5500 0.0143 -
2.5079 5550 0.0127 -
2.5305 5600 0.0133 -
2.5531 5650 0.0125 -
2.5757 5700 0.0116 -
2.5983 5750 0.0141 -
2.6209 5800 0.0119 -
2.6435 5850 0.0149 -
2.6661 5900 0.011 -
2.6887 5950 0.0192 -
2.7113 6000 0.0137 -
2.7338 6050 0.01 -
2.7564 6100 0.0113 -
2.7790 6150 0.0127 -
2.8016 6200 0.0129 -
2.8242 6250 0.0121 -
2.8468 6300 0.0156 -
2.8694 6350 0.0136 -
2.8920 6400 0.0142 -
2.9146 6450 0.0119 -
2.9372 6500 0.0125 -
2.9598 6550 0.0075 -
2.9824 6600 0.0134 -
3.0050 6650 0.0138 -
3.0276 6700 0.0095 -
3.0502 6750 0.0102 -
3.0728 6800 0.0108 -
3.0953 6850 0.0115 -
3.1179 6900 0.0125 -
3.1405 6950 0.0104 -
3.1631 7000 0.011 -
3.1857 7050 0.0102 -
3.2083 7100 0.0135 -
3.2309 7150 0.0092 -
3.2535 7200 0.0106 -
3.2761 7250 0.0112 -
3.2987 7300 0.0094 -
3.3213 7350 0.0084 -
3.3439 7400 0.0115 -
3.3665 7450 0.008 -
3.3891 7500 0.0155 -
3.4117 7550 0.0125 -
3.4343 7600 0.0094 -
3.4568 7650 0.0098 -
3.4794 7700 0.0121 -
3.5020 7750 0.0136 -
3.5246 7800 0.0103 -
3.5472 7850 0.0095 -
3.5698 7900 0.012 -
3.5924 7950 0.0115 -
3.6150 8000 0.0119 -
3.6376 8050 0.0096 -
3.6602 8100 0.009 -
3.6828 8150 0.0089 -
3.7054 8200 0.0141 -
3.7280 8250 0.0096 -
3.7506 8300 0.0095 -
3.7732 8350 0.0092 -
3.7958 8400 0.0114 -
3.8183 8450 0.009 -
3.8409 8500 0.0107 -
3.8635 8550 0.0116 -
3.8861 8600 0.0068 -
3.9087 8650 0.0107 -
3.9313 8700 0.0143 -
3.9539 8750 0.0094 -
3.9765 8800 0.0105 -
3.9991 8850 0.0092 -
4.0217 8900 0.0086 -
4.0443 8950 0.0082 -
4.0669 9000 0.0125 -
4.0895 9050 0.0084 -
4.1121 9100 0.009 -
4.1347 9150 0.0107 -
4.1573 9200 0.0091 -
4.1798 9250 0.0112 -
4.2024 9300 0.0098 -
4.2250 9350 0.0106 -
4.2476 9400 0.0096 -
4.2702 9450 0.0073 -
4.2928 9500 0.0084 -
4.3154 9550 0.0091 -
4.3380 9600 0.0073 -
4.3606 9650 0.0116 -
4.3832 9700 0.01 -
4.4058 9750 0.0086 -
4.4284 9800 0.0079 -
4.4510 9850 0.0105 -
4.4736 9900 0.0107 -
4.4962 9950 0.0076 -
4.5188 10000 0.0074 -
4.5413 10050 0.0062 -
4.5639 10100 0.0103 -
4.5865 10150 0.0065 -
4.6091 10200 0.0093 -
4.6317 10250 0.0085 -
4.6543 10300 0.0085 -
4.6769 10350 0.0088 -
4.6995 10400 0.0098 -
4.7221 10450 0.0067 -
4.7447 10500 0.009 -
4.7673 10550 0.0109 -
4.7899 10600 0.0083 -
4.8125 10650 0.0082 -
4.8351 10700 0.008 -
4.8577 10750 0.0098 -
4.8803 10800 0.0078 -
4.9028 10850 0.0097 -
4.9254 10900 0.0078 -
4.9480 10950 0.0076 -
4.9706 11000 0.0078 -
4.9932 11050 0.0076 -
5.0158 11100 0.0091 -
5.0384 11150 0.007 -
5.0610 11200 0.0081 -
5.0836 11250 0.0085 -
5.1062 11300 0.0076 -
5.1288 11350 0.0063 -
5.1514 11400 0.0086 -
5.1740 11450 0.0077 -
5.1966 11500 0.0081 -
5.2192 11550 0.008 -
5.2418 11600 0.0076 -
5.2643 11650 0.0072 -
5.2869 11700 0.0086 -
5.3095 11750 0.0077 -
5.3321 11800 0.0073 -
5.3547 11850 0.0064 -
5.3773 11900 0.0073 -
5.3999 11950 0.0068 -
5.4225 12000 0.0066 -
5.4451 12050 0.0077 -
5.4677 12100 0.0063 -
5.4903 12150 0.0087 -
5.5129 12200 0.0061 -
5.5355 12250 0.0086 -
5.5581 12300 0.0096 -
5.5807 12350 0.0091 -
5.6033 12400 0.0069 -
5.6258 12450 0.0071 -
5.6484 12500 0.0067 -
5.6710 12550 0.0095 -
5.6936 12600 0.0089 -
5.7162 12650 0.009 -
5.7388 12700 0.0087 -
5.7614 12750 0.0078 -
5.7840 12800 0.0066 -
5.8066 12850 0.0091 -
5.8292 12900 0.0084 -
5.8518 12950 0.0078 -
5.8744 13000 0.0088 -
5.8970 13050 0.008 -
5.9196 13100 0.0079 -
5.9422 13150 0.0083 -
5.9648 13200 0.0083 -
5.9873 13250 0.0086 -
6.0099 13300 0.0089 -
6.0325 13350 0.0055 -
6.0551 13400 0.0072 -
6.0777 13450 0.005 -
6.1003 13500 0.0066 -
6.1229 13550 0.0065 -
6.1455 13600 0.0083 -
6.1681 13650 0.0066 -
6.1907 13700 0.006 -
6.2133 13750 0.0064 -
6.2359 13800 0.0078 -
6.2585 13850 0.0105 -
6.2811 13900 0.009 -
6.3037 13950 0.0062 -
6.3263 14000 0.0077 -
6.3488 14050 0.0082 -
6.3714 14100 0.0066 -
6.3940 14150 0.0075 -
6.4166 14200 0.0089 -
6.4392 14250 0.0062 -
6.4618 14300 0.0072 -
6.4844 14350 0.0068 -
6.5070 14400 0.0066 -
6.5296 14450 0.0062 -
6.5522 14500 0.0078 -
6.5748 14550 0.0087 -
6.5974 14600 0.0068 -
6.6200 14650 0.0058 -
6.6426 14700 0.0069 -
6.6652 14750 0.0087 -
6.6878 14800 0.0067 -
6.7103 14850 0.0084 -
6.7329 14900 0.0078 -
6.7555 14950 0.0079 -
6.7781 15000 0.0062 -
6.8007 15050 0.0073 -
6.8233 15100 0.0061 -
6.8459 15150 0.0064 -
6.8685 15200 0.0062 -
6.8911 15250 0.0067 -
6.9137 15300 0.0074 -
6.9363 15350 0.0065 -
6.9589 15400 0.0081 -
6.9815 15450 0.0073 -
7.0041 15500 0.0081 -
7.0267 15550 0.0057 -
7.0493 15600 0.0061 -
7.0718 15650 0.006 -
7.0944 15700 0.0067 -
7.1170 15750 0.0061 -
7.1396 15800 0.0069 -
7.1622 15850 0.0079 -
7.1848 15900 0.0075 -
7.2074 15950 0.0068 -
7.2300 16000 0.0082 -
7.2526 16050 0.0061 -
7.2752 16100 0.0066 -
7.2978 16150 0.0067 -
7.3204 16200 0.0056 -
7.3430 16250 0.0067 -
7.3656 16300 0.0078 -
7.3882 16350 0.0075 -
7.4108 16400 0.0075 -
7.4333 16450 0.0068 -
7.4559 16500 0.0065 -
7.4785 16550 0.0069 -
7.5011 16600 0.0063 -
7.5237 16650 0.006 -
7.5463 16700 0.0071 -
7.5689 16750 0.0065 -
7.5915 16800 0.0069 -
7.6141 16850 0.0067 -
7.6367 16900 0.0051 -
7.6593 16950 0.0052 -
7.6819 17000 0.0064 -
7.7045 17050 0.0056 -
7.7271 17100 0.0054 -
7.7497 17150 0.0083 -
7.7723 17200 0.0082 -
7.7948 17250 0.0066 -
7.8174 17300 0.0071 -
7.8400 17350 0.0066 -
7.8626 17400 0.0086 -
7.8852 17450 0.0082 -
7.9078 17500 0.0072 -
7.9304 17550 0.0071 -
7.9530 17600 0.0066 -
7.9756 17650 0.0055 -
7.9982 17700 0.0048 -
8.0208 17750 0.0071 -
8.0434 17800 0.0065 -
8.0660 17850 0.006 -
8.0886 17900 0.006 -
8.1112 17950 0.0067 -
8.1338 18000 0.0064 -
8.1563 18050 0.0066 -
8.1789 18100 0.0063 -
8.2015 18150 0.0056 -
8.2241 18200 0.0053 -
8.2467 18250 0.0061 -
8.2693 18300 0.0061 -
8.2919 18350 0.006 -
8.3145 18400 0.0071 -
8.3371 18450 0.0064 -
8.3597 18500 0.006 -
8.3823 18550 0.0059 -
8.4049 18600 0.0065 -
8.4275 18650 0.0075 -
8.4501 18700 0.007 -
8.4727 18750 0.0052 -
8.4953 18800 0.0056 -
8.5178 18850 0.0056 -
8.5404 18900 0.0068 -
8.5630 18950 0.0063 -
8.5856 19000 0.0056 -
8.6082 19050 0.0071 -
8.6308 19100 0.0065 -
8.6534 19150 0.0049 -
8.6760 19200 0.009 -
8.6986 19250 0.0081 -
8.7212 19300 0.0076 -
8.7438 19350 0.0083 -
8.7664 19400 0.0063 -
8.7890 19450 0.0068 -
8.8116 19500 0.0048 -
8.8342 19550 0.0056 -
8.8568 19600 0.005 -
8.8793 19650 0.0069 -
8.9019 19700 0.005 -
8.9245 19750 0.0066 -
8.9471 19800 0.0064 -
8.9697 19850 0.0073 -
8.9923 19900 0.0048 -
9.0149 19950 0.0066 -
9.0375 20000 0.006 -
9.0601 20050 0.006 -
9.0827 20100 0.005 -
9.1053 20150 0.0064 -
9.1279 20200 0.0066 -
9.1505 20250 0.0062 -
9.1731 20300 0.0058 -
9.1957 20350 0.0065 -
9.2183 20400 0.0065 -
9.2408 20450 0.0049 -
9.2634 20500 0.0071 -
9.2860 20550 0.0075 -
9.3086 20600 0.006 -
9.3312 20650 0.0061 -
9.3538 20700 0.006 -
9.3764 20750 0.0049 -
9.3990 20800 0.0061 -
9.4216 20850 0.0064 -
9.4442 20900 0.0053 -
9.4668 20950 0.0062 -
9.4894 21000 0.0065 -
9.5120 21050 0.0063 -
9.5346 21100 0.0068 -
9.5572 21150 0.0053 -
9.5798 21200 0.0058 -
9.6023 21250 0.0063 -
9.6249 21300 0.0049 -
9.6475 21350 0.0058 -
9.6701 21400 0.0057 -
9.6927 21450 0.0041 -
9.7153 21500 0.0068 -
9.7379 21550 0.0069 -
9.7605 21600 0.0077 -
9.7831 21650 0.0072 -
9.8057 21700 0.0066 -
9.8283 21750 0.0058 -
9.8509 21800 0.0066 -
9.8735 21850 0.0061 -
9.8961 21900 0.0068 -
9.9187 21950 0.0061 -
9.9413 22000 0.0057 -
9.9638 22050 0.0061 -
9.9864 22100 0.0054 -

Framework Versions

  • Python: 3.12.8
  • SetFit: 1.1.0
  • Sentence Transformers: 3.3.1
  • Transformers: 4.45.2
  • PyTorch: 2.5.1+cu124
  • Datasets: 3.2.0
  • Tokenizers: 0.20.3

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}
}
Downloads last month
2
Safetensors
Model size
22.7M params
Tensor type
F32
·
Inference Examples
Inference API (serverless) has been turned off for this model.

Model tree for amplyfi/all-MiniLM-L6-v2_multiclass_multilabel

Finetuned
(186)
this model

Evaluation results