← chapter

Fine-tuning and customization

Chapter 19 · the last tool to reach for

The hour

The decision framework

Tuning teaches behavior, not facts. RAG is for facts.

Fine-tune data is JSONL

{"messages": [
  {"role": "system", "content": "You are a pirate translator."},
  {"role": "user", "content": "hello there"},
  {"role": "assistant", "content": "Ahoy there, matey!"}]}

Consistency is everything — sloppy data teaches sloppy behavior.

The job is a footnote

f = client.files.create(file=open("train.jsonl","rb"), purpose="fine-tune")
job = client.fine_tuning.jobs.create(
    training_file=f.id, model="gpt-4o-mini-2024-07-18")
# poll until done → use the model id it produces

Async and billable. The data was the work.

Put it to work — three apps

The honest arc: mostly data, with a pull to skip tuning.

The commitment

A fine-tune pins you to the base model you trained on.

Better base models ship constantly. Re-tuning is the price of keeping up.

Takeaway

Last resort, not first. RAG for knowledge, tuning for behavior. The job is a footnote; the data is the work. Next: put it all together and let the model drive — a single-loop agent.