deep · 6 min
Fine-tuning
Training an existing model further on your own examples, so its weights change. Good for format and narrow decisions, bad for facts.
updated 29 Sept 2026
"Can we fine-tune the model on our docs, so it knows our product?"
That's the request that comes up first, almost every time. It sounds reasonable. The model doesn't know your product, training is how models learn things, so train it on the product. Let's see why that mostly doesn't work, and what fine-tuning is actually good at.
What fine-tuning does
Fine-tuning means taking a model that already works and training it a bit more on your own examples, so its weights change. It's the same thing model makers do in post-training, when they turn a raw text predictor into an assistant by training it on example answers. You're doing that step again, on your data, for your job.
The usual kind is supervised fine-tuning, SFT for short. Each training example is a pair: a prompt and the answer you want.
{"prompt": [{"role": "user", "content": "What's 2 + 2?"}],
"completion": [{"role": "assistant", "content": "small"}]}
Training works the way the model learned language in the first place, through next-token prediction. The model reads the prompt, predicts the answer one token at a time, and gets penalized for how unlikely it thought each right token was. The weights shift a little so the right tokens come out more likely next time. Then the next example, thousands of times over.
One detail: the penalty is usually counted only on the answer, not the prompt. We want the model to learn what to reply, not how to write questions. The common open-source trainer does this by default.
You can change every weight in the model (full fine-tuning), or freeze them and train a small add-on instead. The add-on route, mostly LoRA, is much cheaper, and lots of add-ons can share one copy of the base model.
So, the docs
Back to the request. If we train on our docs, does the model learn the facts in them?
Not reliably. When people compared the two ways of giving a model knowledge, training it on the text or fetching the text at question time with retrieval, retrieval won every time. That held for facts the model had already half seen in pretraining, and for facts that were brand new to it. Models had a hard time learning a new fact from fine-tuning at all, unless they saw the same fact said many different ways.
What the model does pick up from your docs is their style. So you can end up with a model that sounds exactly like your product manual and gets the details wrong with full confidence. That's a fast road to hallucination.
Facts belong in the prompt. Fine-tuning is for something else.
What it does teach: the shape of the answer
A team at Anyscale tried fine-tuning a 13-billion-parameter open model on three jobs, back in 2023. Two of them were about format. One was turning a sentence about a video game into a fixed structured record, with the attributes in a set order. The other was writing SQL. The third was grade-school math.
The format jobs went really well. On the structured records, accuracy jumped from 58% to 98%, and on SQL the small fine-tuned models beat both a much bigger chat model and GPT-4. The math barely moved by comparison.
Why the difference? The model already knew what a video game is and what SQL looks like. All it needed was your exact format, and example pairs teach that well. The math needed reasoning the small model didn't have. Its 8,000 training problems weren't enough to put it there, and even a second round on a bigger, noisier set of math problems only got it to 47%.
That's the rule people use: fine-tuning is for form, not facts. Format, a fixed set of labels, a tone, a narrow decision. If the problem is "the model knows enough but won't answer the way we need", fine-tuning might be the answer.
Where it really pays
Let's take a task that fits. Say we want a router. For each incoming question, decide whether a small cheap model can handle it or it needs the big one. The answer is one word.
We could tell a model how to decide in a system prompt. We could show it a few labeled questions with few-shot prompting, and pay for those examples on every call. Or we could collect thousands of labeled questions and train a small model on them, so the prompt shrinks to just the question.
That third option has been built. A small open model was fine-tuned as a classifier that sends each question either to a mid-sized open model or to GPT-4. The labels came from GPT-4 grading the smaller model's answers on a 1 to 5 scale (an LLM-as-judge setup), about 109,000 of them. Routers like it kept the same answer quality at up to 70% lower cost on one benchmark. How routing works in general has its own article.
Another team trained 310 small fine-tunes, 31 narrow tasks on 10 open models, all with cheap LoRA add-ons. On average they beat their own base models by 34 points and GPT-4 by 10. And 25 of them ran on one GPU, because they share a single copy of the base model.
See the pattern? A small fixed set of possible answers. Enough labeled examples, or a way to make them. And a small trained model doing the job a big general one used to do, which is where the savings come from.
Here's roughly how the choice goes, if we put it together:
Retrieval and fine-tuning also stack. A fine-tuned model can still read retrieved documents. Training teaches it how to answer; retrieval tells it what's true today.
A few things that catch people
Those comparisons are old. Most of the "small fine-tune beats GPT-4" results are from 2023 and 2024, against GPT-4 as it was then. The pattern has held up (narrow tasks, small models, form over facts). The margins won't carry over to today's models. Compare against the best prompted model you'd actually use, on your own evals, with a test set the model never trained on.
Reasoning doesn't come cheap. The math result is the warning. If the task needs the model to think, a few thousand right answers may not teach it. Training a small model on a big model's worked solutions is a different recipe, distillation.
Your fine-tune is tied to one base model. When a better base model comes out, you train again. So the thing worth keeping is the dataset and the training script, more than the weights.
Where you can do it now
This changed in 2026. OpenAI is shutting its fine-tuning service down in steps. Since 2026-05-07, organizations that had never fine-tuned can't start. From 2027-01-06 nobody can create new jobs, though existing fine-tuned models keep serving until their base model is retired. On the Anthropic side, the only Claude model you can fine-tune is Claude 3 Haiku, through Amazon Bedrock (as of 2026-09).
So in practice, fine-tuning today means an open-weights model and an open library. Hugging Face's TRL runs the training loop and PEFT adds LoRA. Their own quick start is about this long:
from datasets import load_dataset
from trl import SFTTrainer
from peft import LoraConfig
trainer = SFTTrainer(
"Qwen/Qwen3-0.6B",
train_dataset=load_dataset("trl-lib/Capybara", split="train"),
peft_config=LoraConfig(),
)
trainer.train()
Swap in your own prompt and answer pairs. Add a quantization_config and
the add-on trains on top of a squeezed-down base model, which is QLoRA
(see quantization). The result runs wherever open models run,
including on your own machine.
Which leaves a question we skipped near the start, about that cheap add-on: does LoRA lose anything compared with training every weight? People argued about that for years, and the answer moved in 2025. That's the next article, LoRA.
Further reading
- Fine-Tuning Llama-2: A Comprehensive Case Study for Tailoring Models to Unique Applications, Kourosh Hakhamaneshi and Rehaan Ahmad (Anyscale), 2023. The three tasks with before and after numbers, and where "form, not facts" comes from. Start here.
- Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs, Ovadia, Brief, Mishaeli and Elisha (Microsoft), 2023. Read this before anyone fine-tunes on the docs.
- LoRA Land: 310 Fine-tuned LLMs that Rival GPT-4, Justin Zhao et al. (Predibase), 2024. Hundreds of narrow fine-tunes, and 25 of them sharing one GPU.
- Building an LLM Router for High-Quality and Cost-Effective Responses, Amjad Almahairi (Anyscale), 2024. The router built start to finish, with judge-made labels. Good if you want to try one.
- SFT Trainer, Hugging Face TRL docs. The trainer you'll probably use. Data formats, the loss, and LoRA through PEFT.
- Deprecations, OpenAI, 2026. The dates of the fine-tuning shutdown, if you're planning around a hosted option.
- Customize a model with fine-tuning in Amazon Bedrock, AWS docs. Which models Bedrock can fine-tune, the one Claude model included.