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 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
0
  • 'Sad Story of My Google Workspace Account Suspension [source: Hacker News] [topic: engineering]'
  • '“CEO said a thing!” [source: marcus-on-ai] [topic: Leadership / Corporate Culture]'
  • 'How to Be Silicon Valley [source: Paul Graham: Essays] [topic: startup]'
1
  • 'Organizing in Hard Times: Lessons from Read This When Things Fall Apart [source: bluesky links] [topic: leadership

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("Code Is an Afterthought [source: Hacker News] [topic: engineering]")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 6 12.5652 27
Label Training Sample Count
0 87
1 74

Training Hyperparameters

  • batch_size: (16, 16)
  • num_epochs: (1, 1)
  • 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
  • evaluation_strategy: epoch
  • eval_max_steps: -1
  • load_best_model_at_end: True

Training Results

Epoch Step Training Loss Validation Loss
0.0025 1 0.4129 -
0.1241 50 0.2716 -
0.2481 100 0.2432 -
0.3722 150 0.2218 -
0.4963 200 0.1869 -
0.6203 250 0.1302 -
0.7444 300 0.0617 -
0.8685 350 0.0343 -
0.9926 400 0.022 -
1.0 403 - 0.2546

Framework Versions

  • Python: 3.13.9
  • SetFit: 1.1.3
  • Sentence Transformers: 5.4.0
  • Transformers: 4.50.3
  • PyTorch: 2.11.0
  • Datasets: 4.8.4
  • Tokenizers: 0.21.4

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
17
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

Model tree for stephen-standd/feed-classifier

Finetuned
(816)
this model

Paper for stephen-standd/feed-classifier