← All posts
5 min read

Fine-Tuning: Changing a Model's Learned Behavior

#technology#generative-ai#fine-tuning#machine-learning
📑 On this page

Prompting supplies instructions for the current request. Retrieval supplies information for the current request. Fine-tuning changes the model itself.

Fine-tuning continues training a model on curated examples so its weights better produce a desired task behavior, format, style, or decision pattern.

It is powerful when the desired behavior is stable and demonstrated repeatedly. It is usually a poor database for facts that change every week.

A concrete example: stable output formatting

A company must convert thousands of support notes into a fixed taxonomy and JSON schema.

After building a strong prompt baseline, it collects reviewed examples covering ordinary and difficult cases. A fine-tuned model learns to produce the schema consistently with a shorter instruction.

Current product policies still come from retrieval, because those facts change independently of the formatting behavior.

What training changes

Fine-tuning adjusts model parameters based on examples. The model learns statistical patterns connecting inputs to preferred outputs.

It does not simply store a visible list of rules. Results depend on:

  • the base model,
  • training objective,
  • data quality,
  • example distribution,
  • hyperparameters,
  • and deployment settings.

The tuned model can still make mistakes outside the demonstrated distribution.

Begin with a baseline

Before tuning:

  1. define the task and metrics,
  2. test a capable base model,
  3. improve prompt and context,
  4. verify retrieval and tools,
  5. and identify recurring failures.

Fine-tuning cannot repair missing source data, broken permissions, or an undefined product objective. A baseline also proves whether tuning produces enough improvement to justify its cost and lifecycle.

Good use cases

Fine-tuning can help with:

  • consistent classification,
  • specialized terminology,
  • stable output structures,
  • brand or editorial style,
  • domain-specific transformations,
  • and repeated instruction following.

It may also let a smaller model approach the task performance of a larger general model, improving latency or cost.

Weak use cases

Fine-tuning is less suitable for:

  • frequently changing facts,
  • exact account state,
  • private records that must be deleted quickly,
  • calculations,
  • one-off instructions,
  • and hard authorization rules.

Use retrieval for current knowledge, databases for exact state, code for deterministic logic, and permission systems for access decisions.

Curate training data

Training examples should be:

  • correct,
  • representative,
  • diverse,
  • consistently formatted,
  • legally and ethically usable,
  • and aligned with production policy.

Remove duplicates, contradictions, secrets, accidental personal data, and low-quality model-generated answers. A model will learn systematic annotation mistakes with impressive consistency.

Cover difficult boundaries

Do not fill the dataset only with easy positive examples.

Include:

  • ambiguous inputs,
  • missing information,
  • out-of-scope requests,
  • valid refusals,
  • rare categories,
  • long inputs,
  • and similar cases with different correct outputs.

Boundary examples teach distinctions that broad descriptions may not convey.

Separate data correctly

Keep training, validation, and test sets independent. Split by user, document, time, or source when near-duplicates could leak across random rows.

Use validation to select training settings and stop conditions. Preserve the test set for final comparison with the baseline.

Full and parameter-efficient tuning

Full fine-tuning updates many or all model weights and can demand substantial computation and storage.

Parameter-efficient methods update or add a smaller set of parameters, reducing training and deployment cost. The right method depends on platform support, task complexity, data volume, and operational needs.

Regardless of method, evaluation and governance remain necessary.

Avoid catastrophic behavior changes

Tuning for one behavior can weaken another. A model trained heavily on terse structured output may become less helpful on explanations. Narrow examples may increase refusal or overconfidence.

Run broad regression tests for:

  • general instruction following,
  • safety,
  • factual support,
  • multilingual behavior,
  • output diversity,
  • and important unrelated routes sharing the model.

Evaluate against the base model

Compare on the same held-out cases:

  • task accuracy,
  • schema validity,
  • safety,
  • calibration or abstention,
  • subgroup performance,
  • latency,
  • token use,
  • and cost.

Use blinded human review where quality is subjective. Report uncertainty and failure categories, not only an average score.

Fine-tuning and RAG together

The two techniques solve different problems.

Fine-tuning can teach:

  • how to classify a request,
  • how to use retrieved passages,
  • how to cite,
  • and how to format the answer.

RAG supplies:

  • the current policy,
  • private product documentation,
  • or a user's authorized records.

A system can use both when evaluation supports the added complexity.

Versioning and lineage

Record:

  • base model version,
  • dataset snapshot and provenance,
  • preprocessing code,
  • training settings,
  • evaluation results,
  • safety review,
  • model artifact,
  • and deployment history.

This enables reproduction, comparison, audit, and rollback.

Privacy and deletion

Training on personal or confidential data creates additional risk because removing one source record from model weights is not as straightforward as deleting a database row.

Minimize sensitive data, establish a valid purpose, apply retention policy, and prefer retrieval when access control and deletion are central requirements.

Deployment and monitoring

Roll out gradually. Monitor task quality, refusals, malformed outputs, drift, latency, cost, and user corrections.

Keep the base or previous tuned model available for comparison and rollback. Retraining should follow new evidence, not an arbitrary schedule.

Knowledge check

  1. How does fine-tuning differ from prompting and retrieval?
  2. Which kinds of tasks are good candidates?
  3. Why should tuning begin with a strong baseline?
  4. What data belongs in boundary examples?
  5. How can fine-tuning and RAG complement each other?

The one idea to remember

Fine-tuning changes learned model behavior through curated examples. Use it for stable, repeated patterns after establishing a baseline; use retrieval for changing facts, code for exact rules, and rigorous evaluation, lineage, privacy, rollout, and monitoring around the tuned model.