AI Folks
  • Courses
  • Web Of AI
  • Pricing
  • Enterprise
Log in
PreviousWhen to fine-tuneNextFine-tuning with Unsloth

Vibe Coder · Unit 19: Fine-Tuning a Model · Lesson 2 of 4

Training data

A fine-tuned model is its dataset. The chat format every trainer expects, how many examples you need, where to get them, and the hold-out set that tells you whether it worked.

Read the short notes and pictures.Do everything inside a blue frame.

The dataset is the product

In fine-tuning you do not write instructions. You show examples, and the model learns whatever pattern they share, including the patterns you did not intend. If half your examples end with an exclamation mark, so will the model. Building the dataset is most of the work and nearly all of the quality.

The format

Trainers expect chat-style examples: a list of messages with roles, ending with the assistant reply you want. They are stored as JSON Lines, a text file with one complete JSON object per line.

A pale ledger, hand-drawn. A file called train.jsonl with two lines, each holding a list of messages with a user turn and an assistant turn.
One example per line, each a short conversation.

One line of train.jsonl

{"messages": [
  {"role": "system", "content": "You write payment reminders for freelancers."},
  {"role": "user", "content": "Client Sam, invoice 42, 9 days late, first reminder."},
  {"role": "assistant", "content": "Hi Sam, a quick note that invoice 42 is now 9 days overdue. Could you let me know when to expect payment? Thanks, Asha"}
]}

What each part is

system: the standing instruction.
  Keep it the same in every example
  and use the same one after training.

user: a real input.

assistant: the exact output you
  want. This is what is learned.
In the real file each example is on a single line. It is shown wrapped here so you can read it.

How many

OpenAI’s guide for its own service set a minimum of ten and recommended starting with about fifty well-made examples, then evaluating before adding more. That is sound advice for any trainer. A narrow task often needs a few hundred. If results are poor, look at the quality of what you have before you add volume.

Where good examples come from

Real inputs

Take them from your product, your inbox or your logs, with personal details removed.

Checked outputs

Have a strong model draft the output, then correct every one by hand. The corrections are the value.

Coverage

Include the hard cases: the angry message, the missing field, the edge of the policy.

Consistency

Two people should agree on every ideal output. If they would not, the task is not defined yet.

Do not train on data you may not use

Remove names, emails, account numbers and anything private before an example goes into a training file. Check that you have the right to use the text at all. A model can reproduce what it was trained on.

Tools can help build the set

Unsloth has a feature called Data Recipes that builds datasets from PDFs, CSVs and DOCX files. Treat anything generated as a draft and review it by hand.

The hold-out set

A pale ledger, hand-drawn. Three boxes: all 100 examples, train on 80, test on 20 the model never saw.
Hold some examples back to test with.

Set aside part of your examples before training and never train on them. After training, run those inputs through the base model and through the tuned model and compare. If you test on examples the model was trained on, it will look excellent and tell you nothing.

  1. 1

    Shuffle, then split

    About eight in ten for training, two in ten held out.

  2. 2

    Check the split covers every kind of case

    Not all the hard ones in one half.

  3. 3

    Freeze the hold-out set

    Do not look at it while you improve the training data.

ActivityYour turnWrite it yourself first, then compare.

You have 60 reminder emails you wrote yourself over two years. Is that a good dataset? Name one strength and two risks.

ActivityBuild stepA model tuned for one job

Build a small dataset

For the task you chose, build at least fifty examples in chat format: real inputs, with outputs you have checked line by line. Remove private details. Split them into a training file and a hold-out file.

Done when

Keep both files. They go into your repository if they contain nothing private.

Keep these

  • Each example is a short conversation ending in the ideal reply.
  • Start with about fifty careful examples from real inputs.
  • Hold some back, and test only on those.
Previous lessonWhen to fine-tuneNext lessonFine-tuning with Unsloth