huggingface/setfit

Efficient few-shot learning with Sentence Transformers

What it solves

SetFit solves the problem of needing large amounts of labeled data or complex, handcrafted prompts to fine-tune language models for text classification. It allows users to achieve high accuracy with very few labeled examples per class (few-shot learning) without requiring the large-scale models typically associated with this approach.

How it works

SetFit is a prompt-free framework that fine-tunes Sentence Transformers to generate rich text embeddings. Instead of relying on verbalizers or prompts, it trains a classification head (either from scikit-learn or a differentiable PyTorch head) on top of these embeddings to perform text classification.

Who it’s for

Developers and data scientists who need to build high-performing text classifiers with minimal labeled data and fast training and inference times.

Highlights

  • Prompt-free: Eliminates the need for handcrafted prompts or verbalizers.
  • Efficient: Significantly faster to train and run inference compared to large-scale few-shot models like GPT-3 or T0.
  • Multilingual: Supports any Sentence Transformer on the Hugging Face Hub, enabling classification across multiple languages.
  • Hugging Face Integration: Fully integrated with the Hugging Face Hub for easy model loading, training, and pushing models.

Related

  • Project
  • Project
  • Project
  • Project