SetFit

This is a SetFit model that can be used for Text Classification. A MultiTaskHead 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 Type: SetFit
  • Classification head: a MultiTaskHead instance
  • Maximum Sequence Length: 128 tokens

Model Sources

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("setfit_model_id")
# Run inference
preds = model("how to run | BlChicken")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 2 11.1286 49

Training Hyperparameters

  • batch_size: (32, 32)
  • num_epochs: (10, 10)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 20
  • body_learning_rate: (2e-05, 1e-05)
  • head_learning_rate: 0.001
  • 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.0009 1 0.2817 -
0.0443 50 0.3201 -
0.0887 100 0.2755 -
0.1330 150 0.2357 -
0.1773 200 0.2212 -
0.2216 250 0.2125 -
0.2660 300 0.1982 -
0.3103 350 0.1819 -
0.3546 400 0.1728 -
0.3989 450 0.1686 -
0.4433 500 0.1513 -
0.4876 550 0.1395 -
0.5319 600 0.1312 -
0.5762 650 0.1165 -
0.6206 700 0.1068 -
0.6649 750 0.098 -
0.7092 800 0.0899 -
0.7535 850 0.0767 -
0.7979 900 0.0762 -
0.8422 950 0.0724 -
0.8865 1000 0.0613 -
0.9309 1050 0.0625 -
0.9752 1100 0.0539 -
1.0195 1150 0.0494 -
1.0638 1200 0.046 -
1.1082 1250 0.0387 -
1.1525 1300 0.0414 -
1.1968 1350 0.0324 -
1.2411 1400 0.0284 -
1.2855 1450 0.0338 -
1.3298 1500 0.0277 -
1.3741 1550 0.0261 -
1.4184 1600 0.0238 -
1.4628 1650 0.0241 -
1.5071 1700 0.0217 -
1.5514 1750 0.019 -
1.5957 1800 0.0173 -
1.6401 1850 0.0157 -
1.6844 1900 0.0145 -
1.7287 1950 0.0171 -
1.7730 2000 0.0131 -
1.8174 2050 0.0148 -
1.8617 2100 0.0163 -
1.9060 2150 0.0131 -
1.9504 2200 0.0087 -
1.9947 2250 0.0113 -
2.0390 2300 0.008 -
2.0833 2350 0.0096 -
2.1277 2400 0.0116 -
2.1720 2450 0.0088 -
2.2163 2500 0.0105 -
2.2606 2550 0.0084 -
2.3050 2600 0.0074 -
2.3493 2650 0.0071 -
2.3936 2700 0.0081 -
2.4379 2750 0.0064 -
2.4823 2800 0.0069 -
2.5266 2850 0.0054 -
2.5709 2900 0.0081 -
2.6152 2950 0.0052 -
2.6596 3000 0.008 -
2.7039 3050 0.0073 -
2.7482 3100 0.0066 -
2.7926 3150 0.0054 -
2.8369 3200 0.0066 -
2.8812 3250 0.0048 -
2.9255 3300 0.0063 -
2.9699 3350 0.0045 -
3.0142 3400 0.0056 -
3.0585 3450 0.0031 -
3.1028 3500 0.0042 -
3.1472 3550 0.0029 -
3.1915 3600 0.0048 -
3.2358 3650 0.0044 -
3.2801 3700 0.0034 -
3.3245 3750 0.0041 -
3.3688 3800 0.0046 -
3.4131 3850 0.0031 -
3.4574 3900 0.0033 -
3.5018 3950 0.0041 -
3.5461 4000 0.0038 -
3.5904 4050 0.0028 -
3.6348 4100 0.0032 -
3.6791 4150 0.0035 -
3.7234 4200 0.0025 -
3.7677 4250 0.0049 -
3.8121 4300 0.0033 -
3.8564 4350 0.0028 -
3.9007 4400 0.0029 -
3.9450 4450 0.0027 -
3.9894 4500 0.0032 -
4.0337 4550 0.002 -
4.0780 4600 0.0023 -
4.1223 4650 0.0021 -
4.1667 4700 0.0014 -
4.2110 4750 0.002 -
4.2553 4800 0.0026 -
4.2996 4850 0.002 -
4.3440 4900 0.0025 -
4.3883 4950 0.0019 -
4.4326 5000 0.004 -
4.4770 5050 0.003 -
4.5213 5100 0.0019 -
4.5656 5150 0.0019 -
4.6099 5200 0.0017 -
4.6543 5250 0.0019 -
4.6986 5300 0.0024 -
4.7429 5350 0.0014 -
4.7872 5400 0.002 -
4.8316 5450 0.0023 -
4.8759 5500 0.0019 -
4.9202 5550 0.0035 -
4.9645 5600 0.0021 -
5.0089 5650 0.0024 -
5.0532 5700 0.0015 -
5.0975 5750 0.0017 -
5.1418 5800 0.0022 -
5.1862 5850 0.0015 -
5.2305 5900 0.0014 -
5.2748 5950 0.0014 -
5.3191 6000 0.0016 -
5.3635 6050 0.0017 -
5.4078 6100 0.0018 -
5.4521 6150 0.001 -
5.4965 6200 0.0016 -
5.5408 6250 0.0023 -
5.5851 6300 0.0011 -
5.6294 6350 0.0015 -
5.6738 6400 0.0026 -
5.7181 6450 0.0012 -
5.7624 6500 0.0011 -
5.8067 6550 0.0013 -
5.8511 6600 0.0007 -
5.8954 6650 0.0016 -
5.9397 6700 0.0022 -
5.9840 6750 0.0009 -
6.0284 6800 0.0009 -
6.0727 6850 0.0014 -
6.1170 6900 0.001 -
6.1613 6950 0.001 -
6.2057 7000 0.0007 -
6.25 7050 0.0015 -
6.2943 7100 0.0013 -
6.3387 7150 0.0011 -
6.3830 7200 0.0015 -
6.4273 7250 0.0007 -
6.4716 7300 0.001 -
6.5160 7350 0.0011 -
6.5603 7400 0.0012 -
6.6046 7450 0.0009 -
6.6489 7500 0.0017 -
6.6933 7550 0.0005 -
6.7376 7600 0.0009 -
6.7819 7650 0.0005 -
6.8262 7700 0.0012 -
6.8706 7750 0.0016 -
6.9149 7800 0.0013 -
6.9592 7850 0.001 -
7.0035 7900 0.0009 -
7.0479 7950 0.0011 -
7.0922 8000 0.001 -
7.1365 8050 0.0006 -
7.1809 8100 0.0014 -
7.2252 8150 0.0006 -
7.2695 8200 0.0011 -
7.3138 8250 0.0007 -
7.3582 8300 0.0015 -
7.4025 8350 0.001 -
7.4468 8400 0.0006 -
7.4911 8450 0.0011 -
7.5355 8500 0.0009 -
7.5798 8550 0.0009 -
7.6241 8600 0.001 -
7.6684 8650 0.0011 -
7.7128 8700 0.001 -
7.7571 8750 0.0009 -
7.8014 8800 0.0012 -
7.8457 8850 0.0005 -
7.8901 8900 0.0006 -
7.9344 8950 0.0006 -
7.9787 9000 0.0005 -
8.0230 9050 0.0007 -
8.0674 9100 0.0005 -
8.1117 9150 0.0008 -
8.1560 9200 0.0005 -
8.2004 9250 0.0004 -
8.2447 9300 0.0006 -
8.2890 9350 0.0005 -
8.3333 9400 0.0009 -
8.3777 9450 0.0004 -
8.4220 9500 0.0005 -
8.4663 9550 0.0011 -
8.5106 9600 0.0007 -
8.5550 9650 0.0005 -
8.5993 9700 0.0011 -
8.6436 9750 0.0009 -
8.6879 9800 0.0013 -
8.7323 9850 0.0006 -
8.7766 9900 0.0008 -
8.8209 9950 0.0007 -
8.8652 10000 0.0007 -
8.9096 10050 0.0005 -
8.9539 10100 0.0008 -
8.9982 10150 0.0008 -
9.0426 10200 0.0004 -
9.0869 10250 0.0004 -
9.1312 10300 0.0009 -
9.1755 10350 0.001 -
9.2199 10400 0.0007 -
9.2642 10450 0.0003 -
9.3085 10500 0.0005 -
9.3528 10550 0.0004 -
9.3972 10600 0.0008 -
9.4415 10650 0.0009 -
9.4858 10700 0.0005 -
9.5301 10750 0.0003 -
9.5745 10800 0.0007 -
9.6188 10850 0.0007 -
9.6631 10900 0.0005 -
9.7074 10950 0.0005 -
9.7518 11000 0.0006 -
9.7961 11050 0.0008 -
9.8404 11100 0.0004 -
9.8848 11150 0.0009 -
9.9291 11200 0.0006 -
9.9734 11250 0.0004 -

Framework Versions

  • Python: 3.10.8
  • SetFit: 1.1.2
  • Sentence Transformers: 5.1.0
  • Transformers: 4.56.0
  • PyTorch: 2.8.0+cu128
  • Datasets: 3.6.0
  • Tokenizers: 0.22.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}
}
Downloads last month
9
Safetensors
Model size
22.7M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for ThomBors/NLBSE2026-pharo