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

AI & ML · Const

Supervised Learning

Supervised fine-tuning adapts a supported model using examples of prompts and correct responses. It is intended for tasks such as classification, nuanced translation, fixed-format generation, and instruction-following correction.

How it works

Supervised fine-tuning adapts a supported base model by showing it examples of prompts paired with desired responses. The model learns this demonstrated behavior, making it useful when prompting alone does not reliably produce the required classification, format, translation style, or instruction-following behavior.

Syntax

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

Parameters

NameTypeDescription
training_filestringIdentifier of the uploaded training dataset containing prompt-and-target examples.
modelstringSupported base model to adapt, such as gpt-4.1-mini-2025-04-14.

Returns

A fine-tuning job object representing the submitted supervised fine-tuning operation.

Key points

  • SFT is the documentation’s abbreviation for supervised fine-tuning.
  • Training consists of showing the model prompt-and-answer examples that represent the desired behavior.
  • Use SFT when outputs must consistently follow a particular structure or format.
  • SFT can target recurring cases where the base model does not follow instructions correctly.

Common mistakes

  • The training examples need correct target responses; incorrect demonstrations can teach the model undesirable behavior.
  • Human-authored ground-truth answers are a common source of training targets, so consistency and quality matter.

Example: Create a supervised fine-tuning job

from openai import OpenAI

client = OpenAI()

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

Creates a supervised fine-tuning job using a prepared training file.

When to use it

Classification

Assigning inputs to a defined set of labels.

Nuanced translation

Producing translations that preserve subtle distinctions or a required style.

Format-constrained generation

Returning content that follows a consistent schema or presentation format.

Instruction-following correction

Improving recurring cases where a model misses explicit instructions.

Interview questions

QWhat is supervised fine-tuning, and when is it useful?

Supervised fine-tuning trains a model with examples that pair prompts with desired outputs. It is suited to tasks such as classification, nuanced translation, fixed-format generation, and correcting instruction-following failures.

Follow-up: When would you prefer prompting instead? Prefer prompting when the task can be reliably specified without changing the model’s learned behavior or output tendencies.

QWhat kind of data does supervised fine-tuning use?

The dataset supplies correct responses for prompts, giving the model direct demonstrations of the intended behavior. This differs from preference-based methods, which provide relative preferences rather than one target response.

Follow-up: What makes a training example valuable? It should represent the production task and contain a reliable target response that exemplifies the desired behavior.

QWhich problems are good candidates for supervised fine-tuning?

Supervised fine-tuning is particularly useful for classification, nuanced translation, constrained content formats, and instruction-following problems. These are cases where repeated examples can make the desired response pattern more dependable.

Follow-up: What should be evaluated after tuning? Compare tuned-model outputs with held-out evaluation examples to verify that the intended behavior improved.

  • Vision fine-tuning
  • Direct preference optimization
  • Reinforcement fine-tuning
  • Evaluations

Source: Model optimization | OpenAI API. Checked 2026-10-15.