Chapter 19 · the last tool to reach for
Tuning teaches behavior, not facts. RAG is for facts.
{"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.
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.
The honest arc: mostly data, with a pull to skip tuning.
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.
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.