---
title: "Outperform OpenAI GPT-3 with SetFit for text-classification"
url: https://daily.dev/posts/outperform-openai-gpt-3-with-setfit-for-text-classification-e1hsdw4wg
source_url: https://www.philschmid.de/getting-started-setfit
type: article
source: "Philipp Schmid"
published: 2026-05-31T07:41:12.581Z
updated: 2026-05-31T08:09:00.092Z
tags: ["machine-learning", "python"]
reading_time: 4
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Outperform OpenAI GPT-3 with SetFit for text-classification

**[Philipp Schmid](https://daily.dev/sources/philschmid)** · 4 min read · 0 upvotes · 0 comments

## Summary

SetFit is a few-shot learning approach from Intel Labs, UKP Lab, and Hugging Face that outperforms GPT-3 on 7 out of 11 text-classification tasks while being 1600x smaller. This tutorial walks through building a text-classification model using only 32 labeled samples (8 per class) on the AG News dataset. It covers environment setup, dataset creation, fine-tuning a Sentence Transformer with contrastive training via SetFitTrainer, and using hyperparameter search with Optuna to reach ~87.3% accuracy. The result: 375x less data with only ~7% accuracy loss compared to a fully supervised model, trainable in under an hour on a single NVIDIA T4 GPU for under $1.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.philschmid.de/getting-started-setfit>

---

Tags: [#machine-learning](https://daily.dev/tags/machine-learning), [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/outperform-openai-gpt-3-with-setfit-for-text-classification-e1hsdw4wg)
