Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Fine-tuning

Definition

Further training a pretrained model on task-specific examples to change its behaviour, format or style, rather than its general knowledge.

In more detail

Fine-tuning is good for consistent formats, narrow classification tasks and moving a job to a smaller model. It is a poor way to add facts that change, which RAG handles better. Always compare against a well-prompted baseline with an eval.

A typical project starts with a few hundred to a few thousand examples of the exact input and output you want, often drawn from logs of a larger model doing the job well. With LoRA or QLoRA a small open model can be tuned on a single GPU in hours, and hosted providers offer fine-tuning through their APIs for some of their models.

Keep a held-out test set the model never trains on, and watch for regressions on tasks outside the one you tuned for. Re-tune when the base model changes, since adapters do not carry across models.

  • Distillation

    Training a smaller model to imitate the outputs of a larger one, keeping much of the quality at a lower cost and latency per request.

  • LoRA

    Low-Rank Adaptation: a fine-tuning method that freezes the model's weights and trains small added matrices instead, cutting memory needs.

  • Post-training

    Training after pretraining that shapes a model's behaviour, including instruction tuning and preference or reinforcement learning.

  • QLoRA

    LoRA fine-tuning applied to a base model loaded in 4-bit quantised form, cutting memory needs further so large models fit on one GPU.

  • Supervised fine-tuning (SFT)

    Fine-tuning on labelled input and output pairs so the model learns to produce the target output for each input.

  • Data poisoning

    Tampering with the data used to train a model or build its retrieval index, so that it learns false, biased or hidden behaviour.

  • Fine-tuning

    Further training a model on task-specific examples, and knowing when RAG is enough.

    SkillAdvanced

  • Fine-tune a small model with LoRA

    Fine-tune a small open model with LoRA using TRL and PEFT, measure it on a held-out set before and after, and decide whether the gain is worth keeping.

    TutorialAdvanced2 h

  • RAG vs long context vs fine-tuning: how to choose

    What each approach changes, what it costs, where it fails, and a practical order to try them in before you commit to one.

    Article