SetFit with jhu-clsp/mmBERT-base

This is a SetFit model that can be used for Text Classification. This SetFit model uses jhu-clsp/mmBERT-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.9970

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-5-large")
# Run inference
preds = model("cooked him")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 1 4.6067 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.3044 -
0.0202 50 0.2803 -
0.0404 100 0.2355 -
0.0606 150 0.1607 -
0.0808 200 0.0911 -
0.1010 250 0.0694 -
0.1212 300 0.0532 -
0.1414 350 0.0391 -
0.1616 400 0.0343 -
0.1817 450 0.0296 -
0.2019 500 0.0264 -
0.2221 550 0.022 -
0.2423 600 0.0201 -
0.2625 650 0.0127 -
0.2827 700 0.0165 -
0.3029 750 0.0097 -
0.3231 800 0.0093 -
0.3433 850 0.0098 -
0.3635 900 0.009 -
0.3837 950 0.0076 -
0.4039 1000 0.0073 -
0.4241 1050 0.0076 -
0.4443 1100 0.0058 -
0.4645 1150 0.0049 -
0.4847 1200 0.0066 -
0.5048 1250 0.0044 -
0.5250 1300 0.0052 -
0.5452 1350 0.0041 -
0.5654 1400 0.0061 -
0.5856 1450 0.0033 -
0.6058 1500 0.0051 -
0.6260 1550 0.0029 -
0.6462 1600 0.0039 -
0.6664 1650 0.0046 -
0.6866 1700 0.0028 -
0.7068 1750 0.0037 -
0.7270 1800 0.0022 -
0.7472 1850 0.0032 -
0.7674 1900 0.0025 -
0.7876 1950 0.0027 -
0.8078 2000 0.0024 -
0.8279 2050 0.0031 -
0.8481 2100 0.0024 -
0.8683 2150 0.0033 -
0.8885 2200 0.0039 -
0.9087 2250 0.0028 -
0.9289 2300 0.0029 -
0.9491 2350 0.0023 -
0.9693 2400 0.0022 -
0.9895 2450 0.0027 -
1.0 2476 - 0.0046

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
10
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-5-large

Finetuned
(54)
this model

Paper for johnpaulbin/toxicity-setfit-5-large

Evaluation results