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

Evaluation

Metrics

Label Accuracy
all 0.9992

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-4-large")
# Run inference
preds = model("add me for gifts")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 1 4.5954 81
Label Training Sample Count
not toxic 8589
toxic 4455

Training Hyperparameters

  • batch_size: (128, 128)
  • num_epochs: (1, 1)
  • max_steps: -1
  • sampling_strategy: num_iterations
  • num_iterations: 8
  • 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.0006 1 0.3232 -
0.0307 50 0.2699 -
0.0613 100 0.2104 -
0.0920 150 0.113 -
0.1226 200 0.0829 -
0.1533 250 0.0521 -
0.1839 300 0.0439 -
0.2146 350 0.0314 -
0.2452 400 0.0292 -
0.2759 450 0.0215 -
0.3066 500 0.018 -
0.3372 550 0.0172 -
0.3679 600 0.0119 -
0.3985 650 0.0113 -
0.4292 700 0.0082 -
0.4598 750 0.0098 -
0.4905 800 0.0075 -
0.5212 850 0.0073 -
0.5518 900 0.0061 -
0.5825 950 0.0052 -
0.6131 1000 0.0044 -
0.6438 1050 0.0058 -
0.6744 1100 0.0055 -
0.7051 1150 0.0054 -
0.7357 1200 0.0041 -
0.7664 1250 0.0049 -
0.7971 1300 0.0057 -
0.8277 1350 0.004 -
0.8584 1400 0.004 -
0.8890 1450 0.0039 -
0.9197 1500 0.0036 -
0.9503 1550 0.0038 -
0.9810 1600 0.0037 -
1.0 1631 - 0.0021

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-4-large

Finetuned
(40)
this model

Paper for johnpaulbin/toxicity-setfit-4-large

Evaluation results