LLM Foundations/Fine-Tuning
★ OverviewIntermediate14 min

When to Fine-Tune

The fine-tuning landscape shifted in 2026: GPT-5.4 supports distillation but not traditional SFT, o4-mini is retired, and open-source models like Gemma 4 now match closed-source quality at a fraction of the cost. This article walks through the decision — whether to fine-tune at all, which approach to use, and how to compute ROI before committing to training.

Quick Reference

  • Fine-tuning teaches HOW to behave (style, format, consistency) — not WHAT to know (use RAG for facts)
  • OpenAI SFT: only on GPT-4.1 family (gpt-4.1, gpt-4.1-mini, gpt-4.1-nano) as of April 2026
  • Distillation: capture GPT-5.4 outputs, train GPT-5.4 mini/nano — the new cost-reduction path on OpenAI
  • Open-source LoRA: Gemma 4 (Apache 2.0), Qwen 3.5, Mistral Small 4 — all support LoRA/QLoRA fine-tuning
  • Break-even math: if training cost < 3 months of inference savings, fine-tuning is worth evaluating
  • Always build your eval set and baseline before spending a dollar on training
  • You need 200–2000 high-quality examples for SFT; fewer but higher-quality for RFT
  • Catastrophic forgetting is real: fine-tuning can degrade general capability outside your target task

Fine-Tuning vs Prompting vs RAG vs Distillation

Before writing a single training example, you need to know which approach solves your actual problem. The four options address fundamentally different bottlenecks — and choosing the wrong one wastes weeks.

ApproachSolvesDoesn't solveTime to value
Prompt engineeringTask specification, output format, reasoning guidance, few-shot examplesTeaching new knowledge at scale, consistent style across thousands of outputsHours
RAG (retrieval)Factual knowledge gaps, keeping info current, citations, large document corporaStyle/tone consistency, improving reasoning, latency reductionDays–weeks
Fine-tuning (SFT/RFT)Consistent style, domain adaptation, format enforcement, cost reduction at volumeAdding new facts (knowledge cutoff still applies), general intelligence, one-off tasksWeeks
DistillationCompressing a large model's behavior into a smaller one — cost + latency reductionNovel task learning, behavior the teacher model doesn't already exhibitDays (if outputs exist)
The core distinction — behavior vs knowledge

Prompt engineering tells the model WHAT to do. RAG gives the model WHAT to know. Fine-tuning teaches the model HOW to consistently behave. Distillation compresses a large model's behavior into a smaller one. If your problem is 'the model doesn't know X,' use RAG. If it's 'the model knows X but won't do it consistently,' fine-tune.

Is the problem missing factsor knowledge the model doesn't have?YesUse RAGretrieval, not trainingNoVolume > 100K requests/monthand recurring, not one-off?NoPrompt Eng+ few-shot examplesYesTarget: GPT-5.4 qualityat lower per-call cost? (OpenAI)YesDistillationGPT-5.4 → mini / nanoNoSFT — OpenAI APIgpt-4.1, gpt-4.1-mini, gpt-4.1-nanoor Claude 3 Haiku (Bedrock)LoRA / QLoRAGemma 4, Qwen 3.5, Mistral Small 4full control, self-hosted

fine-tuning decision flow — April 2026

When NOT to Fine-Tune

Most teams that reach for fine-tuning should stop here. The common fine-tuning mistakes are expensive and slow to discover.

GoalWhy fine-tuning won't helpWhat to do instead
Add factual knowledgeFine-tuning teaches behavior patterns, not facts. Knowledge retention is unreliable and degrades over retrainingUse RAG — retrieve facts at inference time with citations
Improve general reasoningYou can't make a smaller model as capable as a larger one through trainingUse a more capable base model (GPT-5.4, Claude Opus 4.7)
Handle a one-off taskFine-tuning overhead is never justified for tasks you run rarely or experimentallyPrompt engineering with few-shot examples
Fix safety or alignmentFine-tuning on domain data can degrade RLHF alignment — not improve itGuardrails, output filters, system prompts
Process new input modalitiesModel architecture limits what inputs it can processUse a multimodal model or a specialized preprocessing pipeline
Volume < 50K requests/monthTraining cost won't break even at low volume; prompt engineering is cheaperPrompt engineering + few-shot; revisit when volume grows
The knowledge trap — and why it keeps killing projects

A team fine-tunes on 1,000 support tickets mentioning their product features. The model starts generating confident-sounding answers — but they're hallucinated. Fine-tuning taught the model the phrasing and confidence level of support answers, not the actual facts. After two months of effort, they rebuild with RAG in a week. The failure mode: confusing 'the model now sounds more confident about our product' with 'the model now knows our product.'

  • Catastrophic forgetting is real: fine-tuning on a narrow task often degrades performance on tasks outside that distribution. A customer service fine-tune may become worse at general coding or reasoning
  • Fewer than 200 examples: few-shot prompting will almost certainly outperform fine-tuning at this data size
  • Fine-tuning requires ongoing maintenance: when the base model updates, you retrain — or fall behind on improvements
  • Eval contamination is easy: if your training data overlaps your test set, you'll measure memorization, not generalization

When Fine-Tuning Delivers Value

Fine-tuning earns its investment when you have high volume, a clear behavior gap, and a measurable eval metric. The use cases below have strong ROI track records.

  • Consistent style/tone: enforce your company's writing voice across thousands of outputs without a long system prompt that adds latency and cost
  • Domain-specific classification: classify medical records, legal contracts, or financial documents with domain terminology that a general model misroutes
  • Structured extraction: reliably extract specific fields from domain documents (insurance claims, invoices, contracts) where format drift on edge cases is a production bug
  • Format enforcement: always return a specific JSON schema without occasional schema violations that break downstream parsing
  • Latency reduction via distillation: compress GPT-5.4 behavior into GPT-5.4 mini for latency-sensitive paths while maintaining output quality on your specific task
  • Cost reduction at scale: once volume crosses ~500K requests/month, replacing a large model with a fine-tuned smaller one often pays back training cost in weeks
Real project

A legal tech company was running contract clause extraction on GPT-5.4 at $4,250/month (1M docs, 500 in + 200 out tokens). They built 1,500 labeled examples from a paralegal review workflow. After fine-tuning gpt-4.1-mini (SFT, ~$0.40/$1.60 per 1M), monthly inference dropped to $520. Training cost ~$200. Break-even in 2 weeks. One unexpected benefit: the SFT model stopped hallucinating clause numbers on edge-case formats, which the larger model had done 3–5% of the time.

Learn this in → cost-analysis

The Fine-Tuning Landscape in 2026

The landscape shifted significantly in 2025–2026. Knowing which tools actually exist prevents wasted work.

ApproachWhat it isModels (April 2026)When to use
SFT (Supervised Fine-Tuning)Train on labeled input→output pairs to teach style, format, or behaviorOpenAI: gpt-4.1, gpt-4.1-mini, gpt-4.1-nano. Anthropic: Claude 3 Haiku (Bedrock only). Open-source: Gemma 4, Qwen 3.5, Mistral Small 4Consistent behavior, domain adaptation, structured extraction
RFT (Reinforcement Fine-Tuning)Train with a reward signal (human or model) instead of labeled pairs — good for verifiable tasksOpenAI: o4-mini (API-only via fine-tuning endpoint as of April 2026; not available in ChatGPT). Cost: $100/hr wall-clockMath, code generation, reasoning tasks with clear correct/incorrect signal
DistillationCapture outputs from a large model, use them to train a smaller model in the same familyOpenAI: GPT-5.4 → GPT-5.4 mini or GPT-5.4 nano (distillation supported; traditional SFT not available for GPT-5.4 family)Cost reduction while maintaining GPT-5.4-class output quality on your specific task
LoRA / QLoRA (self-hosted)Parameter-efficient fine-tuning: train a small adapter matrix, freeze the base model weightsGemma 4 31B (Apache 2.0), Qwen 3.5, Mistral Small 4 (24B), Llama 3.3 70B. Tools: Unsloth, TRL, AxolotlFull data control, highest volume, regulatory data residency requirements
o4-mini is retired from ChatGPT (Feb 2026)

o4-mini was removed from ChatGPT in February 2026. It remains accessible via the OpenAI fine-tuning API endpoint for RFT, but should not be treated as an active inference target for new projects. The article's earlier claim that 'fine-tuned o4-mini matches GPT-5.4 at 1/6th cost' was wrong on pricing — fine-tuned o4-mini inference cost was $4.00/$16.00 per 1M tokens, not $0.30/$1.20. For cost reduction, use distillation to GPT-5.4 mini/nano, or SFT on GPT-4.1-mini.

Distillation is the new cost-reduction path on OpenAI

If you want GPT-5.4 quality at lower cost and you're on OpenAI, distillation — not SFT — is your tool. Run your prompts through GPT-5.4, capture the outputs you approve of, and use those output pairs to train GPT-5.4 mini or GPT-5.4 nano. This is OpenAI's primary customization path for the GPT-5.4 family. GPT-5.4 itself does not support traditional fine-tuning.

Cost Math: Is Fine-Tuning Worth It?

Fine-tuning has upfront training cost and ongoing inference savings. The break-even depends on volume. Here is the math at 1M requests/month with 500 input + 200 output tokens, using April 2026 pricing.

Monthly cost at 1M requests (500 in + 200 out tokens)GPT-5.4prompt engineering$4,250/moGPT-5.4 minivia Distillation$1,275/moGPT-4.1-miniafter SFT$520/moSelf-hosted LoRAGemma 4 / Qwen 3.5~$800/mo* SFT/LoRA include amortized training + setup costs. Prices from April 2026 — verify before budgeting.

cost comparison at scale — optimization ROI grows with volume

Break-even calculator — run this before committing to fine-tuning
The evaluation-first principle

Never start fine-tuning without a clear evaluation framework. Define your metric (accuracy, F1, format compliance, human preference rating). Build your test set of 50–100 labeled examples. Measure your prompt-engineered baseline. If you can't articulate 'fine-tuning succeeded when metric X moves from Y to Z,' you will not know if training helped — and you will spend weeks finding out.

Prerequisites and Readiness Check

Fine-tuning is ready to start when you can check every box below. Skip any one and you are likely to waste the training investment.

  • A clear, measurable quality metric for your task (accuracy, F1, format compliance, human preference — pick one primary metric)
  • A test set of 50–100 labeled examples that did NOT come from the same process as your training data
  • A prompt-engineered baseline measured on that test set — this is your target to beat
  • 200–2,000 high-quality training examples (quality matters far more than quantity — noisy data trains bad behavior)
  • A clear hypothesis: 'fine-tuning will improve [metric] from [X%] to [Y%] by teaching [specific behavior]'
  • Budget for 2–3 training iterations — the first checkpoint is rarely the final model
Readiness gate — run before writing training examples

How Fine-Tuning Fails

Most fine-tuning projects that fail do so in predictable ways. Knowing the failure modes in advance lets you design against them.

Failure modeHow it manifestsPrevention
Catastrophic forgettingThe model improves on your target task but degrades on adjacent capabilities — it starts failing at things it could do beforeEvaluate on a held-out set of general tasks alongside your target metric; mix general examples into training data
Eval contaminationTraining accuracy looks great but production quality is poor — training examples leaked into the test setBuild your test set before generating training data; use different sources for each
Distribution shiftThe model performs well on training distribution but fails on production inputs that look slightly differentUse real production queries as the source for training examples, not synthetic ones generated by another LLM
The sunk cost trapAfter weeks of data prep, the team pushes forward even when fine-tuning doesn't clearly beat the baselineSet a clear abort criterion before starting: 'if we don't hit [target] by checkpoint 2, we stop and ship prompt engineering'
Overfit to noisy labelsHigh training accuracy, low test accuracy — the model learned label noise as signalReview a random sample of training examples before training; noisy labels compound quickly
Distribution shift is the silent killer

The most common production fine-tuning failure: you generate 1,500 training examples by prompting GPT-5.4 to produce ideal outputs for synthetic inputs. The model fine-tunes cleanly. Then in production, real user queries are phrased differently, are shorter, have typos, or contain edge cases the synthetic data didn't cover. Eval shows 93% on your test set; production shows 71%. The fix: 80% of training examples should come from real production traffic, even if labeling is slower.

Best Practices

Best Practices

Do

  • Build your eval set and baseline before writing a single training example — measurement comes first
  • Fine-tune for behavior (style, format, consistency), not for knowledge — RAG handles facts
  • Use real production queries as the source for training examples, not synthetic LLM-generated inputs
  • Start with distillation on OpenAI (GPT-5.4 → mini/nano) before SFT if cost reduction is your goal
  • Start with the smallest model that meets quality needs — gpt-4.1-nano first, then mini, then the full 4.1
  • Set a clear abort criterion before training: 'if checkpoint 2 doesn't hit target, we ship prompt engineering'
  • Budget for 2–3 training iterations — treat the first checkpoint as a measurement, not a final model
  • Compare fine-tuned model against baseline on the same test set with the same metric — no cherry-picking
  • Evaluate general capabilities alongside your target metric — watch for catastrophic forgetting
  • Run the break-even calculator before committing to training; confirm ROI at your actual volume

Don’t

  • Don't fine-tune as a first resort — exhaust prompt engineering and RAG before training
  • Don't try to fine-tune facts into a model — knowledge from training is unreliable; use retrieval
  • Don't use fewer than 200 training examples — the model will overfit and generalize poorly
  • Don't generate your training data with another LLM and then test on the same distribution — that's overfitting to synthetic data
  • Don't target GPT-5.4 or GPT-5.4 mini for SFT — these models don't support traditional fine-tuning (distillation only)
  • Don't recommend o4-mini as a fine-tuning target — it is retired from ChatGPT and was never cost-effective after accounting for fine-tuned inference pricing
  • Don't skip the abort criterion — the sunk cost trap is the most expensive mistake in fine-tuning projects
  • Don't let training data overlap your test set — that measures memorization, not generalization
  • Don't ignore catastrophic forgetting — always test general capabilities alongside your target task
  • Don't assume fine-tuning is permanent — base model updates require retraining or you fall behind on improvements

Key Takeaways

  • Fine-tuning teaches HOW to behave — style, format, consistency. RAG teaches WHAT to know. These are not interchangeable.
  • GPT-5.4 and GPT-5.4 mini do not support traditional SFT — distillation (capturing outputs from GPT-5.4) is the OpenAI path for cost reduction.
  • OpenAI SFT is available on the GPT-4.1 family (gpt-4.1, gpt-4.1-mini, gpt-4.1-nano); open-source LoRA targets Gemma 4, Qwen 3.5, Mistral Small 4.
  • Most fine-tuning projects fail due to distribution shift (synthetic training data vs. real production inputs) or the sunk cost trap (pushing forward when results are flat).
  • Run the break-even calculator before training — fine-tuning is rarely cost-effective below 100K requests/month.
  • The evaluation-first principle is non-negotiable: if you can't measure improvement before training, you won't know if it helped.

Video on this topic

Should you fine-tune an LLM? (decision framework)

instagram