What is fine-tuning in LLMs?

Fine-tuning is further training of a pre-trained model on a smaller set of your own examples, so it reliably follows a format, style or narrow task. It changes the model's weights, unlike prompting or RAG.

Also called LLM fine-tuning, supervised fine-tuning, SFT, instruction tuning, LoRAUpdated

A general-purpose model has already learned language, reasoning and a broad picture of the world during pre-training. Fine-tuning continues that training on a much smaller dataset that you supply, so the model shifts towards the behaviour in your examples. The result is a new set of weights, or a small add-on to the original ones, that you call like any other model.

Types of fine-tuning

Supervised fine-tuning (SFT). You provide pairs of an input and the ideal output, and the model learns to produce outputs like yours. Instruction tuning is SFT on instruction-following examples. It is how a base model becomes a chat assistant.

Preference tuning. You provide pairs of a better and a worse answer, and methods such as RLHF or DPO push the model towards the preferred one. Model vendors use this heavily. Application teams use it less often.

Full vs parameter-efficient. Full fine-tuning updates every weight. It needs a lot of GPU memory and produces a complete copy of the model. LoRA (low-rank adaptation, Hu et al., 2021) freezes the original weights and trains small extra matrices instead. The LoRA paper reported 10,000 times fewer trainable parameters and a third of the GPU memory, compared with fully fine-tuning GPT-3 175B. QLoRA applies the same idea to a quantised model to save more memory. Most teams that fine-tune open models now use LoRA or a variant of it.

Several model providers also offer fine-tuning through their APIs for selected models: you upload examples and receive a private model ID.

Example: extracting fields from discharge summaries

A hospital software team needs structured JSON from free-text discharge summaries. Prompting a large model works but drifts: dates arrive in mixed formats, and drug names sometimes land in the wrong field. The team prepares 1,200 de-identified summaries, each paired with the correct JSON checked by a clinician:

{"messages": [
  {"role": "system", "content": "Extract discharge fields as JSON."},
  {"role": "user", "content": "Pt discharged 03/11/26 on metformin 500mg BD..."},
  {"role": "assistant", "content": "{\"discharge_date\": \"2026-11-03\", \"medications\": [{\"name\": \"metformin\", \"dose\": \"500 mg\", \"frequency\": \"twice daily\"}]}"}
]}

They hold back 200 examples as a test set and fine-tune a small open model with LoRA on the other 1,000. Then they compare the tuned model with the prompted large model on the held-out set: field accuracy, format errors, latency and running cost. If the tuned model wins on the measures that matter, it replaces the large model for this one step.

When fine-tuning is the wrong tool

  • To add knowledge. Models don't reliably memorise facts from fine-tuning, the facts go stale and there are no citations. Use retrieval-augmented generation for knowledge, as our RAG vs fine-tuning guide explains.
  • Before trying prompts. Clear instructions, examples and structured outputs fix many format problems at far lower effort.
  • Without an evaluation set. You can't tell whether tuning helped without LLM evaluation on held-out data.
  • On personal data you may need to erase. Removing one person's records from trained weights isn't practical, so de-identify first.

Common mistakes

  • Few or inconsistent examples. If two reviewers labelled the same case differently, the model learns the inconsistency.
  • Testing on training data. Scores look excellent and mean nothing.
  • Ignoring the upkeep. A tuned model needs versioning, hosting, monitoring and retraining when its base model is retired. That is MLOps work.

We build fine-tuning and evaluation pipelines through our data and AI team.

Any idea in mind? Let's make it real.

Tell us what you're building. You'll hear back from an engineer, not a sales team, usually within one working day.

Book a 30-min call