01
Teaching the model itself
Imagine a company that wants an AI to summarize its call center logs. The summaries have to follow the company format: three fields, "Reason / Action / Follow-up", written in the company's own tone and terms. If you just ask an already-trained LLM to summarize, the content is fine, but the format and tone come out a little different every time.
There are three main ways to fix that. You can add a format description and examples to the prompt (prompt engineering), look up the material the model needs and attach it (RAG), or train the model itself a bit more (fine-tuning). In the scene below, switch between the methods and watch what changes.
- What changed
- the model's weights
Task: summarize call center logs in the company format (Reason / Action / Follow-up)
The prompt stays short, but the numbers inside the model have changed. Summarizing in the company format is now built into the model itself.
The first two only change the text you send to the model. The numbers inside the model, its weights, stay the same. Fine-tuning is the opposite: it changes the weights. You start from a model that has already finished pre-training and train it a little more on your data, nudging those numbers. That takes far less data and money than building a model from scratch. It's a lot like hiring someone experienced and only teaching them how your company does things.
If you want to know how models learn and what weights actually are, see the training chapter of How LLMs work.
If a question says… → pick this
- “Adjusts the model's weights”Fine-tuning
- “Further trains a pre-trained model on your own data”Fine-tuning
- “Improves results without modifying the original weights”Prompt engineering · RAG (not fine-tuning)
To change the weights, the model needs something to learn from. What you get out of fine-tuning is decided almost entirely by your training data.
02
Preparing the training data
The most common kind of fine-tuning trains on examples that pair an input with the correct answer. For our company, one example is a single call log plus a well-written summary of it in the company format. You usually prepare these as a file with one example per line, in a format like JSONL.
{"input": "Customer says they were charged twice…", "output": "Reason: double charge / Action: refund filed / Follow-up: confirmation text within 3 days"}
{"input": "Customer wants to change their delivery address…", "output": "Reason: address change / Action: updated before shipping / Follow-up: none"}The model looks at these examples and learns "for this kind of input, answer like this." That also means it copies any mistakes hiding in the examples. In the scene below, try cleaning up the examples you've collected.
- Problem examples
- wrong format, duplicate, personal data, wrong answer
- Split
- Not split yet
One example = a call log (input) + a summary in the company format (the answer)
4 of the 14 examples we collected have problems: one is in the wrong format, one is a duplicate, one has a wrong summary, and one still contains a customer's personal data.
What good training data looks like
- Consistent format: if the answers are formatted differently from example to example, the model learns to be inconsistent too.
- Correct answers: if wrong summaries slip in, the model learns the wrong way as well. Quality matters more than quantity.
- Close to real inputs: the examples should look like the call logs you'll actually get, in length and in kind.
- No duplicates: if the same example shows up several times, the model over-memorizes that one example.
- Sensitive data removed: a model can memorize training data and repeat it to someone else word for word. Remove or mask personal data like names and phone numbers before training.
How much data do you need? It depends on the task, but if you're mainly teaching a format, a few hundred to a few thousand well-made examples are often enough to make a difference. You also hold back part of what you collect and don't train on it. This is the validation set, and you use it to check how training went on examples the model has never seen. You'll see how it's used in the next chapter.
If a question says… → pick this
- “Data that pairs inputs with model answers”Labeled data for instruction tuning
- “A file with one example per line”JSONL format
- “Data held back and not used for training”Validation set
- “Training data contains customers' names and phone numbers”Remove the personal data
Once the data is ready, you run the training. Before you do, you have to set a few values, and if you set them badly, training goes off track.
Pro only
That’s the free part of this guide
The other 5 chapters are open to Pro subscribers. Each one continues with 3D visuals and “if a question says…” tips, and the last chapter lets you check yourself with a short quiz.
- 03Epochs, learning rate and overfitting
- 04PEFT and LoRA
- 05Training methods by goal
- 06Pitfalls
- 07When to fine-tune
Advertisement
PasslyExam
You have read the concept. Now test it on exam questions
PasslyExam offers original practice questions, explanations and full mock exams built around each certification’s exam guide. The explanations cover why the right option is right and why the look-alike options are wrong. Sign up to practice for free every day.