This guide covers fine-tuning OpenAI models, including data preparation, job management, and deployment for improved performance.
OpenAI fine-tuning lets you customize base models to your domain, improve response quality, and optimize for latency. In this guide, we’ll walk through preparing data, launching jobs, monitoring progress, and deploying your fine-tuned model.
Each JSONL line contains a prompt and a completion. Example:
Copy
Ask AI
{"prompt":"Paris, as if everyone doesn't know that already.","completion":""}{"prompt":"Oh, just some guy named William Shakespeare. Ever heard of him?","completion":""}{"prompt":"Around 384,400 kilometers. Give or take a few, like that really matters.","completion":""}
Ensure each completion begins with a space or newline if you want the model to include that prefix.
Fine-tuning can teach the model to invoke your functions. Example payload:
Copy
Ask AI
{ "messages":[ {"role":"user","content":"What is the weather in San Francisco?"}, {"role":"assistant","function_call":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, USA\"}"}}, {"role":"function","name":"get_current_weather","content":"{\"temperature\":21,\"unit\":\"celsius\"}"}, {"role":"assistant","content":"It is 21 degrees celsius in San Francisco."} ], "functions":[ { "name":"get_current_weather", "description":"Get the current weather.", "parameters":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]} } ]}