Short answer
You write example conversations in OpenAI's chat format, each one a system message, a user message and the ideal assistant reply, and save them one per line in a JSONL file. The examples must be correct, consistent and representative of real inputs, and you keep a separate set of cases aside to test the result.
Follow-up question How do you tell whether fine-tuning helped?
OpenAI opened fine-tuning for GPT-3.5 Turbo on August 22. Starting a training job takes a single API call; the real work is preparing the data. A fine-tuned model learns whatever pattern your examples show, including their mistakes.
The good news is that the format is simple. Every training example is a short conversation written exactly the way you want the model to behave.
The chat format, line by line
Each example is a JSON object with one key, messages, holding a list of messages. Each message has a role (system, user or assistant) and its content. During training, OpenAI treats the final assistant message as the answer to learn, and everything before it as the prompt. The examples go into a JSONL file: plain text, one complete JSON object per line, with no commas between lines and no surrounding brackets.
OpenAI's cookbook notes a few limits and tips. Each example can be up to 4,096 tokens; anything longer is cut off. If your app holds multi-turn conversations, include multi-turn examples so the model sees that shape too. And fine-tuning works best on one focused task.
A worked example: repair requests into tickets
Imagine a bicycle shop that receives repair requests by text message and wants each one turned into a one-line ticket with a category, an urgency level and a short summary, always in the same format. Fine-tuning aims to make the format and judgment calls consistent without a long prompt full of rules.
Here is a starter file of ten examples. Notice that the system message is identical on every line, and the assistant replies follow one strict pattern.
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "my front brake squeals and barely stops the bike, can I come saturday?"}, {"role": "assistant", "content": "Brakes | High | Front brake weak and noisy; wants Saturday"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "Flat rear tire again, third time this month"}, {"role": "assistant", "content": "Tires | Medium | Repeated rear flats; check rim tape and tire"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "chain keeps falling off when I shift to the small gear"}, {"role": "assistant", "content": "Drivetrain | Medium | Chain drops on shift to small chainring"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "Just want a spring tune-up before May, no rush"}, {"role": "assistant", "content": "Tune-up | Low | General tune-up before May"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "Crashed yesterday, fork looks bent, is it safe to ride??"}, {"role": "assistant", "content": "Frame/Fork | High | Possible bent fork after crash; do not ride"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "ebike battery dies after 10 km now, used to do 40"}, {"role": "assistant", "content": "Electrical | Medium | E-bike range dropped from 40 km to 10 km"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "clicking noise from the pedals when I climb"}, {"role": "assistant", "content": "Drivetrain | Low | Clicking from pedal area under load"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "Can you install a child seat? Have the seat already"}, {"role": "assistant", "content": "Accessories | Low | Install customer's child seat"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "rear wheel wobbles a lot and rubs the brake pad"}, {"role": "assistant", "content": "Wheels | Medium | Rear wheel out of true, rubbing brake"}]}
{"messages": [{"role": "system", "content": "Turn bike repair requests into tickets."}, {"role": "user", "content": "do you sell helmets for kids?"}, {"role": "assistant", "content": "Not a repair | Low | Question about kids' helmets; pass to sales"}]}
Ten examples show the format, but they are a starting point, not a finished dataset. OpenAI's cookbook suggests beginning with 30 to 50 carefully chosen examples and says results should keep improving as you add more. Build those extra examples from real messages, with names and phone numbers removed, and include the awkward ones: two problems in one message, no clear request, spelling mistakes, a question that is not a repair at all, like the helmet line above.
Checks before you upload
OpenAI's data-preparation notebook runs checks you can copy. Every line must be a dictionary with a messages list. Every message needs a role and content, the roles must be one of the three allowed, the content must be text, and each example needs at least one assistant message. It also counts tokens, warns about examples over the 4,096-token limit, and estimates the cost of training, which by default runs over the data three times (three epochs).
Then read the file as a person. Are the categories spelled the same way everywhere? Do urgency levels follow one rule? A model trained on "Tires" in some lines and "Tyres" in others will use both.
Try it: Write ten example lines for a task you repeat at work, with one fixed system message and one strict output pattern. Then ask a colleague to label five new inputs using only your examples as a guide. Where they hesitate, your examples need to be clearer.
How do you tell whether fine-tuning helped?
Set aside a test set before you train: 20 or more real inputs the model never sees in training, each with the ticket you would accept. Run them through the plain GPT-3.5 Turbo model with your best prompt and score the answers. After training, run the same inputs through the fine-tuned model, called with the same short system message it learned from, and score them the same way.
Compare three things: how many tickets are fully correct, how often the format breaks, and how long your prompt has to be. OpenAI reports that some early testers cut their prompts by up to 90 percent by building the instructions into the model, which saves money and time on every call. If the fine-tuned model is no better on your test set, look at the training data before anything else.
You can also upload an optional validation file, a second set of examples that OpenAI uses during training to check whether the model is simply memorizing the training set rather than learning the pattern. It helps, but only your own test set measures what matters: correct tickets on real messages.
Sources
- GPT-3.5 Turbo fine-tuning and API updates — OpenAI, August 22, 2023
- How to fine-tune chat models — OpenAI Cookbook (GitHub), August 22, 2023
- Data preparation and analysis for chat model fine-tuning — OpenAI Cookbook (GitHub), August 22, 2023