Basic

The training set

Fine-tuning is supervised: it needs pairs of an input and the output you want. That set is the specification of the job, written as examples instead of as rules, and its quality is what the whole run is made of.

What you will see

A refusal as an expected output, which is what teaches the model to decline rather than invent.

About 1 min of reading

Try It

Write three pairs.

1

A pair

pair = {'in': 'ERR 4021 at 09:12 by user 88', 'out': 'The user hit a timeout while uploading.'} print(pair['in'], '->', pair['out'])

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One input and the exact output wanted. That shape is the whole training unit.
2

A refusal pair

r = {'in': 'how do I reset the flux capacitor', 'out': 'I do not have information about that.'} print(r['out'])

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A refusal as an expected output, which is what teaches the model to decline rather than invent.

Data Flow

Pairs become the specification.
1 Collect real inputs
↓
2 Write the wanted output for each
↓
3 Hold some back for testing
↓
4 Train on the rest
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

pair = {'in': 'ERR 4021 at 09:12 by user 88', 'out': 'The user hit a timeout while uploading.'} sets nothing on screen
print(pair['in'], '->', pair['out']) One input and the exact output wanted. That shape is the whole training unit.
Why this works
Write the refusals

Include inputs the model should decline, with the decline as the expected output. A set with no refusals teaches the model to answer everything, including questions it has no basis for.

Split off a test set

Hold back examples the model never trains on and evaluate on those. Measuring on the training set tells you the model memorised, which is a different and worse outcome.

Examples

Pairs, not text

Each example has the input as a real user would send it and the output exactly as you want it. A set of documents is not a training set, and feeding one produces a model that rambles about them.

Real inputs

Examples gathered from real traffic carry the mess: typos, half questions, extra context. A hand written set is clean, and the model then fails on the real thing.

Cover the range

The set must include the short, the long, the unusual, and the ones that should be refused. A set of fifty near copies of one question teaches one case and nothing else.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← What fine-tuning changes
Previous Lesson
What fine-tuning changes
Next Lesson
Formatting the examples
Formatting the examples →