Favicon of SetFit

SetFit

An open-source text classification framework that fine-tunes Sentence Transformers with little labeled data, without handcrafted prompts. Apache 2.0.

Screenshot of SetFit website

SetFit is a framework for developers and NLP practitioners who need to train text classifiers with a small amount of labeled data. It adapts pretrained Sentence Transformers to a classification task without requiring handcrafted prompts or words that stand in for class labels. Sentiment analysis is one supported use case.

Its main appeal is the combination of limited training data and smaller models. SetFit generates text embeddings from labeled examples rather than relying on large language models such as Llama or GPT-4. The approach reduces training and inference time compared with methods that depend on those larger models. In a Customer Reviews sentiment benchmark, SetFit achieved results competitive with RoBERTa Large while using substantially fewer labeled examples.

Model choice is flexible: SetFit works with any Sentence Transformer on the Hugging Face Hub, including multilingual checkpoints for classification across languages. Its classifiers pair a pretrained Sentence Transformer with either a scikit-learn classification head or a trainable PyTorch head. That gives developers a choice of classifier while retaining the same text embedding approach.

SetFit is open source under Apache 2.0 and integrates with the Hugging Face Hub. It supports training, saving and loading classifiers, as well as running them to predict labels for text.

Similar to SetFit