SetFit with intfloat/multilingual-e5-base

This is a SetFit model that can be used for Text Classification. This SetFit model uses intfloat/multilingual-e5-base 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:

  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

Model Labels

Label Examples
toxic
  • 'slanteye'
  • 'lets meet in real life cutie ;)'
  • 'youre dead to me and soon irl'
not toxic
  • 'wanna make a snowman?'
  • 'word'
  • 'boost'

Evaluation

Metrics

Label Accuracy
all 0.9985

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("johnpaulbin/toxicity-setfit-7-norm")
# Run inference
preds = model("cooked him")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 1 4.6068 81
Label Training Sample Count
not toxic 8689
toxic 4512

Training Hyperparameters

  • batch_size: (128, 128)
  • num_epochs: (1, 1)
  • max_steps: -1
  • sampling_strategy: num_iterations
  • num_iterations: 12
  • 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: True
  • warmup_proportion: 0.1
  • 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.0004 1 0.3528 -
0.0202 50 0.3183 -
0.0404 100 0.2297 -
0.0606 150 0.1218 -
0.0808 200 0.0752 -
0.1010 250 0.0624 -
0.1212 300 0.049 -
0.1414 350 0.0389 -
0.1616 400 0.0334 -
0.1817 450 0.0244 -
0.2019 500 0.0248 -
0.2221 550 0.0212 -
0.2423 600 0.0196 -
0.2625 650 0.0177 -
0.2827 700 0.018 -
0.3029 750 0.0137 -
0.3231 800 0.0154 -
0.3433 850 0.014 -
0.3635 900 0.0134 -
0.3837 950 0.0103 -
0.4039 1000 0.0128 -
0.4241 1050 0.0124 -
0.4443 1100 0.0115 -
0.4645 1150 0.0111 -
0.4847 1200 0.0124 -
0.5048 1250 0.0118 -
0.5250 1300 0.0109 -
0.5452 1350 0.0104 -
0.5654 1400 0.0105 -
0.5856 1450 0.0103 -
0.6058 1500 0.0097 -
0.6260 1550 0.0096 -
0.6462 1600 0.0098 -
0.6664 1650 0.008 -
0.6866 1700 0.0082 -
0.7068 1750 0.0084 -
0.7270 1800 0.0065 -
0.7472 1850 0.0069 -
0.7674 1900 0.0088 -
0.7876 1950 0.0075 -
0.8078 2000 0.0058 -
0.8279 2050 0.0077 -
0.8481 2100 0.0055 -
0.8683 2150 0.0053 -
0.8885 2200 0.0072 -
0.9087 2250 0.0079 -
0.9289 2300 0.0074 -
0.9491 2350 0.0065 -
0.9693 2400 0.0072 -
0.9895 2450 0.0061 -
1.0 2476 - 0.0028

Framework Versions

  • Python: 3.12.12
  • SetFit: 1.2.0.dev0
  • Sentence Transformers: 5.2.0
  • Transformers: 4.57.3
  • PyTorch: 2.9.0+cu126
  • Datasets: 4.0.0
  • Tokenizers: 0.22.2

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
12
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for johnpaulbin/toxicity-setfit-7-norm

Finetuned
(109)
this model

Paper for johnpaulbin/toxicity-setfit-7-norm

Evaluation results