Machine Learning

Fine-Tuning

Fine-tuning is the process of continuing to train a pre-trained model on a smaller, task-specific dataset so that it adapts to a company's language, formats, and decisions.

What is fine-tuning?

Fine-tuning is the process of taking a pre-trained model and training it further on a smaller dataset chosen for a specific purpose. The model keeps the general knowledge it gained in pre-training and adjusts its model weights to the vocabulary, formats, and judgments found in the new data. It is the most common form of transfer learning for language models, and the same idea applies to vision and speech models.

The new dataset is usually a few hundred to a few tens of thousands of examples. For a language model, each example is an input and the desired output: a clinician’s note paired with the correct billing codes, or a customer email paired with the reply a senior representative would write. Training runs for one to a few epochs at a low learning rate, so the model shifts toward the new examples without forgetting what it already knew.

How fine-tuning works

There are two broad methods. Full fine-tuning updates every parameter in the model. It gives the most flexibility but needs enough memory to hold the model, its gradients, and the optimizer state, which for a large model means several high-end graphics processing units (GPUs). Parameter-efficient fine-tuning (PEFT) freezes the original weights and trains a small set of added parameters instead. LoRA (Low-Rank Adaptation) is the most widely used PEFT method. It produces an adapter file that is a small fraction of the base model’s size and is loaded on top of the original weights at serving time. For most business tasks, LoRA on a single GPU is enough.

Fine-tuning also comes in stages. Supervised fine-tuning on input-output pairs teaches the task. Instruction tuning is supervised fine-tuning on a broad mix of instructions and responses, which is how a base model becomes a chat model. Preference methods such as RLHF (Reinforcement Learning from Human Feedback) and Direct Preference Optimization then adjust tone and judgment using comparisons between candidate answers.

Fine-tuning compared with prompting and retrieval

Fine-tuning is one of three ways to make a general model useful for a specific job, alongside prompt engineering and retrieval-augmented generation (RAG). It is usually the last of the three to reach for.

Approach What it changes Best for Main limitation
Prompt engineering The instructions and examples sent with each request Changing behavior quickly with no training Long prompts cost tokens on every call and have limits
RAG The facts supplied to the model at request time Answers that depend on current or private documents Does not change how the model writes or decides
Fine-tuning The model’s weights Consistent style, format, and domain judgment at scale Needs curated examples and retraining when requirements change

The three combine well. A fine-tuned model that has learned a company’s output format can still be given fresh facts through RAG on each request.

Fine-tuning in practice

A collections agency drafts account notes and compliance-sensitive letters by the thousand. A general model with a long prompt produces acceptable drafts, but the prompt runs to several pages and the output still varies in tone. The agency fine-tunes a small open-weight model on eight thousand past letters that compliance staff had already approved. The result follows the house style without instructions, keeps the required disclosures in the right order, and runs on one GPU, so prompts shrink and each request costs less. When state rules change, the team adds examples and retrains.

Fine-tuning and private AI

Fine-tuning data is often the most sensitive data a company holds, because good examples are real cases. Fine-tuning an open-weight model on infrastructure the company controls keeps that data in house and produces weights the company owns outright. Fine-tuning through a vendor’s application programming interface (API) means the examples leave the building and the resulting model exists only inside that vendor’s service. In Kirk Tech Solutions engagements, fine-tuning is done on the client’s own GPUs or in a dedicated cloud tenant, and the adapter files are versioned in the client’s model registry alongside the evaluation results that justified each release.

What to watch for

  • Try prompting and retrieval first and keep the results as a baseline, so a fine-tune has to earn its place.
  • Curate examples carefully, because a fine-tuned model reproduces the mistakes in its training set as faithfully as the good decisions.
  • Hold out a test set the model never sees and evaluate on it before and after each training run.
  • Expect some loss of general ability, and test tasks outside the fine-tuning data to measure it.
  • Plan for retraining, since fine-tuned weights do not update themselves when products, policies, or forms change.

← Back to AI Glossary