What Is SFT in AI? Supervised Fine-Tuning Explained

What is SFT in AI? A plain-English guide to supervised fine-tuning: how it trains LLMs on prompt-response examples, what the data looks like, how much you need, and SFT vs RLHF vs DPO.

Get a summary in:
Headline What Is SFT in AI? Supervised fine-tuning, explained simply, beside three prompt-and-response example cards feeding into a model block
Follow Teck Hustlers on Google
Add Teck Hustlers as a preferred source to see more of our stories in Google Top Stories.
Add as preferred source on Google

SFT (supervised fine-tuning) is the training step that teaches a pretrained large language model to follow instructions: you show it thousands of labeled prompt–response examples and update its weights so it learns to produce responses like the ones in your data. It usually comes right after pretraining and before optional preference methods such as RLHF or DPO. OpenAI’s InstructGPT paper, the research behind the first ChatGPT-style models, used exactly that order: supervised fine-tuning on human-written demonstrations first, then reinforcement learning from human feedback.

This guide explains what SFT means in plain English, how it works, what the training data looks like, how much of it you need, and how SFT compares with instruction tuning, RLHF, DPO and pretraining. If you want the wider picture of all the ways to adapt a model, start with our guide to fine-tuning in AI; this page zooms in on the supervised kind.

SFT in one sentence

SFT is learning by example. You give a model pairs of “here is the request” and “here is a good answer,” and train it to reproduce the good answer when it sees the request. The “supervised” part means every training example comes with the correct output attached, the way a teacher hands a student worked solutions instead of just a textbook.

In the AI world the acronym almost always refers to large language models. When people say a model was “SFT’d,” they mean it went through this round of example-based training, usually to make it behave like a helpful assistant or to specialize it for one job.

Why base models need SFT

A large language model starts life as a base model. During pretraining it reads a huge amount of text and learns one skill: predict the next word (strictly, the next token). That makes it knowledgeable, but not helpful. Ask a raw base model “How do I reset my router?” and it may continue with three more questions, because on the internet a question is often followed by more questions.

The InstructGPT authors put the problem neatly: the pretraining objective, predicting the next token on web pages, “is different from the objective ‘follow the user’s instructions helpfully and safely'”. SFT closes that gap by showing the model what a good reply to an instruction looks like, over and over, until that pattern becomes its default.

The payoff can be large. In OpenAI’s human evaluations, outputs from the 1.3-billion-parameter InstructGPT model were preferred to outputs from the 175-billion-parameter GPT-3, despite having 100 times fewer parameters. That final model also went through RLHF, but SFT was the foundation it was built on.

How supervised fine-tuning works

Under the hood, SFT uses the same next-token prediction the model already knows. The difference is what it reads and what it is graded on.

1. Collect prompt–response examples

The training set is a list of conversations or prompt–completion pairs written or approved by people (or, increasingly, generated by a stronger model and filtered). Each example shows the input and the exact output you want. Quality matters far more than you might expect, which we come back to below.

2. Train only on the answer

The model reads the prompt and the response together, and for each token in the response it is scored on how well it predicted that token. Hugging Face’s TRL library, one of the most common SFT tools, describes the loss as token-level cross-entropy: the model is penalized whenever it assigns low probability to the correct next token.

A key detail is that the prompt itself is usually not graded. Meta’s Llama 2 team describes zeroing out the loss on the user’s prompt “so as a result, we backpropagate only on answer tokens”. TRL does the same by default for prompt–completion data, computing the loss on the completion tokens only, and offers an option to train only on the assistant’s turns in chat data. The model learns how to answer, not how to write user questions.

3. Repeat for a few passes and keep the best checkpoint

The model makes a few passes (epochs) over the data, and small weight updates nudge it toward the demonstrated answers. Recipes vary: Llama 2’s SFT ran for 2 epochs, while InstructGPT trained for 16 epochs. Interestingly, the InstructGPT team saw its SFT models overfit on validation loss after one epoch, yet found that more epochs still improved human preference ratings. The lesson is to judge an SFT run by testing the model’s actual answers, not just by a loss curve. (Our explainer on overfitting covers why that curve can mislead.)

4. Update all the weights, or just an adapter

Classic SFT updates every weight in the model (full fine-tuning). Today it is just as common to run SFT through a parameter-efficient method such as LoRA, which freezes the base model and trains small adapter matrices, or QLoRA, which does the same on a 4-bit compressed model. TRL supports this directly through its PEFT integration. The objective is still SFT; LoRA only changes which weights get updated.

Where SFT fits in the training pipeline

Modern chat models are typically built in stages. The DPO paper summarizes the standard RLHF recipe as three phases: supervised fine-tuning, then preference sampling and reward learning, then RL optimization. SFT sits between the expensive pretraining run and the preference stage.

Infographic of the LLM training pipeline: pretraining on huge amounts of raw text creates a base model; supervised fine-tuning on labeled prompt-response examples creates an instruction-following model; optional preference tuning with RLHF or DPO uses ranked or paired answers to create the final assistant model.
Where SFT fits: pretraining builds knowledge, supervised fine-tuning teaches the model to follow instructions, and optional RLHF or DPO polishes its answers using human preferences. Based on the InstructGPT and DPO papers.

Two things make this order sensible. First, preference methods need a model that already produces reasonable answers to compare; in RLHF, the reward model and the policy both start from the SFT model, and DPO uses the SFT model as its reference point. Second, SFT is cheap relative to pretraining. InstructGPT’s 175B SFT model took 4.9 petaflops/s-days of compute, versus 3,640 for training GPT-3 itself, and 60 for the full RLHF (PPO-ptx) model.

Not every project needs the later stage. Plenty of fine-tuned models in the wild are “SFT only,” because for a narrow task, good examples are enough.

What SFT training data looks like

Most tools expect each example as a short conversation. TRL accepts plain text, prompt–completion pairs or chat messages, and gives this as its conversational example:

{"messages": [{"role": "user", "content": "What color is the sky?"},
              {"role": "assistant", "content": "It is blue."}]}

OpenAI’s fine-tuning API used the same idea, with one JSON object per line in a JSONL file in chat format. A real dataset for, say, a customer-support bot would contain hundreds or thousands of these, each showing a realistic customer message and the ideal reply in your brand’s tone and format. You can also include a system prompt in each example if the model will run with one in production.

How much SFT data do you need?

Less than most people assume, as long as it is good. Published numbers span a wide range:

  • OpenAI’s guidance: a minimum of 10 examples, with improvements typically seen from 50 to 100, and a recommendation to start with 50 well-crafted demonstrations and evaluate.
  • InstructGPT: about 13,000 training prompts with demonstrations written by a team of about 40 contractors.
  • Llama 2: Meta stopped after 27,540 SFT annotations, reporting that “tens of thousands” was enough for a high-quality result. It also noted that different annotation vendors produced markedly different model quality.
  • LIMA: Meta and university researchers fine-tuned a 65B LLaMa model on just 1,000 carefully curated prompts and responses, with no reinforcement learning, and its responses were rated equivalent to or better than GPT-4’s in 43% of cases in their human study.

For a single business task, AWS’s Nova documentation suggests planning for thousands to tens of thousands of demonstrations, adding that quality, consistency and diversity matter more than raw volume. The common thread across all of these: a small set of clean, consistent examples beats a large, messy one.

SFT vs instruction tuning: are they the same?

Mostly, yes. Instruction tuning is SFT where the examples are instructions and their ideal responses. Stanford’s Speech and Language Processing textbook says instruction tuning is called supervised fine-tuning (SFT) because each instruction in the data comes with a correct answer, even though the model is still trained with ordinary next-token prediction.

The term became popular with Google’s FLAN paper, which fine-tuned a 137B model on more than 60 NLP datasets phrased as natural-language instructions and found it beat zero-shot 175B GPT-3 on 20 of the 25 datasets tested. In practice:

  • SFT is the umbrella term for training on labeled input-output pairs. The data can be anything: support tickets, SQL queries, product descriptions, classification labels.
  • Instruction tuning is the specific use of SFT to make a general model better at following instructions across many tasks. Most “Instruct” or “Chat” model versions you download went through it.

SFT vs RLHF vs DPO vs pretraining

The quickest way to tell them apart is by the kind of data each one learns from.

PretrainingSFTRLHFDPO
Data it learns fromHuge amounts of raw, unlabeled textPrompts paired with one ideal responseHuman rankings of several model answersPairs of preferred vs rejected answers
What the model learnsLanguage, facts and general patternsTo imitate the demonstrated answersTo produce answers a reward model scores highlyTo favor the preferred answer over the rejected one
Training signalNext-token predictionNext-token prediction on the answerReward model plus reinforcement learning (e.g. PPO)A simple classification-style loss, no reward model
Usual starting pointRandom weightsA pretrained base modelAn SFT modelAn SFT model (used as the reference)
Relative cost and effortBy far the highestLow to moderateHighest of the post-training steps; several models to manageLower than RLHF; one training loop
Best forBuilding a model from scratchTeaching format, style, tasks and instruction followingPolishing helpfulness and safety on fuzzy judgmentsPreference alignment with a simpler setup than RLHF

The DPO authors describe RLHF as “a complex and often unstable procedure” and show their method can optimize the same goal with a simple classification loss. Our explainer on RLHF walks through the reward model and reinforcement steps in more detail.

SFT vs RLHF in one line

SFT shows the model the right answer; RLHF tells the model which of its own answers people liked better. SFT is easier and more predictable, but it can only ever be as good as the examples you write. Preference methods let a model improve on judgments that are hard to write down as a single perfect answer, such as “which of these two explanations is clearer?”

What SFT is good at, and what it can’t do

Where SFT shines

  • Format and structure. Always reply in valid JSON, follow a template, or use a set length. OpenAI lists generating content in a specific format and correcting instruction-following failures among SFT’s best uses.
  • Tone and style. A consistent brand voice, reading level or persona.
  • Narrow tasks. Classification into your own categories, translation with your terminology, or data conversion where each input has one right output.
  • Making a smaller model do a bigger model’s job. Fine-tuning a small model on a specific task can be cheaper to run than prompting a large one, a trade-off the Hugging Face course lists as a reason to consider SFT. Training a small model on a big model’s outputs is closely related to knowledge distillation.

Where SFT falls short

  • It is not a reliable way to add new knowledge. AWS’s documentation is direct: SFT “will not make the model learn new facts, jargon, or recent events”. The LIMA researchers reached a similar conclusion, that almost all of a model’s knowledge is learned in pretraining. If your problem is missing or changing information, RAG is usually the better tool, and teaching a model to sound confident about facts it doesn’t know can make hallucinations worse.
  • It copies your mistakes. The model imitates the data, including errors, inconsistent formatting and bias. Llama 2’s finding that annotation vendors produced markedly different downstream model performance is a reminder to check your data before training.
  • It can narrow the model. Train hard on one task and the model may get worse at things outside it. Mix in general examples and test broadly.
  • It needs a way to measure success. OpenAI’s guide advises setting up evals before fine-tuning, so you can tell whether the tuned model actually beats the base one.

Try prompting first

The Hugging Face course recommends checking whether an existing instruction-tuned model with well-crafted prompts would do the job before investing in SFT. Good prompt engineering, a clear system prompt and a few worked examples in the prompt (few-shot prompting) often get you most of the way, with no training at all. Reach for SFT when you have hit the ceiling of prompting, need the behavior every time, or want to shorten long prompts you send on every request.

How to run SFT yourself

The workflow is the same whether you use a cloud service or your own GPU. OpenAI summarizes it in four parts:

  1. Build your dataset. Realistic prompts and the exact answers you want, in a consistent format.
  2. Upload or load the data into your training tool.
  3. Run the fine-tuning job on a chosen base model.
  4. Evaluate the tuned model against the original on held-out examples.

Your main options in late 2026:

  • Open models with Hugging Face TRL. TRL’s SFTTrainer handles chat templates, answer-only loss and example packing, and can train LoRA adapters through PEFT. Its quick-start example fine-tunes a Qwen3 0.6B model in a few lines of Python. Pair it with QLoRA if your GPU memory is tight.
  • Managed cloud services. Providers such as AWS offer SFT for their hosted models, so you supply data and they run the training.
  • OpenAI’s API (winding down). If you planned to fine-tune GPT models, note that OpenAI says it is winding down its fine-tuning platform: it is closed to new users, and eligible existing customers can create training jobs until January 6, 2027, unless the base model shuts down sooner.

Once trained, an open model or LoRA adapter can be served like any other local model, for example with Ollama. Keep safety in mind too: fine-tuning changes behavior, so re-test the guardrails you rely on after every training run.

Frequently asked questions

What does SFT stand for in AI?

SFT stands for supervised fine-tuning. It means further training a pretrained AI model on labeled examples, where each input comes with the correct or desired output, so the model learns to produce similar outputs.

What is the difference between SFT and RLHF?

SFT trains a model to imitate example answers written or approved by people. RLHF trains it on human rankings of its own answers, using a reward model and reinforcement learning. SFT usually comes first, and RLHF starts from the SFT model.

Is instruction tuning the same as SFT?

Instruction tuning is a type of SFT. It uses supervised fine-tuning on instructions paired with ideal responses, so a general model gets better at following instructions across many tasks. SFT is the broader term and can use any labeled input-output data.

How many examples do you need for supervised fine-tuning?

It depends on the task. OpenAI’s guidance was to start with 50 well-crafted examples, Meta’s LIMA research used 1,000 curated examples, and Llama 2 used 27,540. A small set of clean, consistent examples usually beats a large, messy one.

Does SFT teach a model new facts?

Not reliably. SFT mainly teaches behavior: format, style, tone and how to handle a task. For new or changing information, retrieval-augmented generation (RAG) is usually the better choice, because the model looks up facts instead of memorizing them.

Can you do SFT with LoRA?

Yes. LoRA and QLoRA are ways to run SFT more cheaply by training small adapter weights instead of the whole model. The training objective and data are the same; only the set of weights being updated changes.

The bottom line

SFT is the step that turns a text predictor into a model that answers you. You show it good prompt–response examples, train it to reproduce the answers, and it picks up the format, style and instruction-following habits in your data. It is cheap compared with pretraining, needs less data than you might think if the data is clean, and is the usual foundation for RLHF or DPO. What it won’t do is teach a model new facts. For more on the techniques around it, see our guides to fine-tuning, RLHF and LoRA.

Follow Teck Hustlers on Google
Add Teck Hustlers as a preferred source to see more of our stories in Google Top Stories.
Add as preferred source on Google
About

The Teck Hustlers Editorial Team covers technology, business, finance and gaming news for readers who want the story behind the headline. Every article is researched, written and edited by our in-house team, checked against company announcements, filings and reputable reporting, and updated when new facts emerge. We focus on what each development means for founders, professionals, investors and everyday users. Have a tip or a correction? Reach us through our contact page.

Up next: What Is QLoRA? Quantized LoRA Fine-Tuning Explained