Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI & ML · Const

Fine-tuning

Fine-tuning adapts an OpenAI base model to a specific task using representative input-output examples. The process involves preparing JSONL data, creating a job, and evaluating the resulting model.

How it works

Fine-tuning adapts an OpenAI base model to examples of the inputs and outputs expected by an application. The workflow is to collect representative data, upload it as JSONL, create a training job, and evaluate the resulting model; reinforcement fine-tuning also requires a grader.

Syntax

client.fine_tuning.jobs.create(training_file="file-...", model="...")

Parameters

NameTypeDescription
modelstringThe base model to adapt; it must be one of the supported models.
training_filestringThe identifier of an uploaded JSONL file containing training examples.
validation_filestringOptional identifier of an uploaded JSONL validation file used for periodic validation metrics.

Returns

A fine-tuning job whose eventual result includes the newly created fine-tuned model name.

Key points

  • It specializes an OpenAI base model using examples that represent the inputs and outputs your application expects.
  • Begin by assembling examples that reflect the task and production inputs.
  • Upload the training dataset as a JSONL file.
  • Start training by creating a fine-tuning job through the dashboard or API.
  • Reinforcement fine-tuning additionally uses a grader to assess model behavior.
  • Measure the trained model against representative test data after training.

Common mistakes

  • The platform is being phased out: new users cannot access it, while existing users can create jobs only for a limited period.

Example: Create a fine-tuning job

from openai import OpenAI

client = OpenAI()

job = client.fine_tuning.jobs.create(
    training_file="file-abc123",
    model="gpt-4.1-mini"
)
print(job.id)

Creates a fine-tuning job from an uploaded JSONL training file and prints the job identifier.

When to use it

Specialize task behavior

A task needs consistent behavior that prompting alone does not provide.

Adapt to application examples

A production workload repeats a well-defined input-output pattern.

Optimize with a grader

A reinforcement fine-tuning workflow needs scored behavior.

  • model optimization
  • JSONL
  • training file
  • validation file
  • reinforcement fine-tuning
  • grader
  • evaluation

Source: Model optimization. Checked 2026-10-15.