[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

When & How to Fine-Tune

🎯 Fine-Tuning & Distillation 15 min 300 BASE XP⌨ HANDS-ON LAB

Customizing Model Behavior

Fine-tuning trains an existing OpenAI model on your own dataset to customize its behavior, tone, format, or domain knowledge. It does NOT add new knowledge - it adjusts HOW the model responds.

Decision Framework

Try FirstThen TryLast Resort
Prompt EngineeringRAG (Retrieval)Fine-Tuning
90% of use casesDomain knowledgeBehavior/format changes

Fine-Tuning Workflow

  1. Prepare Data: Create a JSONL file of example conversations
  2. Upload: Upload the training file via the Files API
  3. Train: Create a fine-tuning job specifying the base model
  4. Evaluate: Test the fine-tuned model against your eval set
  5. Deploy: Use your custom model ID in API calls
// Training data format (JSONL):
{"messages": [
  {"role": "system", "content": "You are a concise legal assistant."},
  {"role": "user", "content": "Summarize this contract clause..."},
  {"role": "assistant", "content": "Key terms: ..."}
]}

// Create fine-tuning job:
const job = await openai.fineTuning.jobs.create({
  training_file: "file-abc123",
  model: "o3-mini-mini",
  hyperparameters: { n_epochs: 3 }
});

Best Practices

  • Start with 50-100 high-quality examples - quality over quantity
  • Always create a validation set (20% of data) to detect overfitting
  • Fine-tune the smallest model that meets your needs (Mini > Pro)
  • Use checkpoints to save intermediate states
🎯 Rule: Fine-tuning is for changing behavior/format, NOT for adding knowledge. Use RAG for knowledge injection.
⌨ HANDS-ON LABLaunch a Fine-Tuning Job
⭐ +200 XP

Prompt engineering got you 90% there - the tone is still wrong. Run the full fine-tuning workflow: upload training data, create the job, poll until your custom model exists.

1Upload your JSONL training file to the Files API with purpose fine-tune.
2Create the fine-tuning job pointing at your uploaded file and a base model.
3Poll the job until it succeeds and note the fine_tuned_model ID you'll use in production.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 3 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
What should you try BEFORE fine-tuning?
Nothing - always fine-tune first
Prompt engineering and RAG - they solve 90%+ of use cases without fine-tuning costs
Switching to a different provider
Rebuilding from scratch