Academy / Generative AI Engineering

Path 3 · Course 3 · For developers and ML practitioners

Fine-tuning & Model Optimisation

When to fine-tune versus prompt or use RAG; full fine-tuning, LoRA and other methods; preparing training data; running and evaluating a fine-tune; and making models smaller, faster and cheaper — with Python code.

By · Last updated

6 modulesAbout 3.5 hoursKnowledge check per moduleFinal assessment & certificatePython; how LLMs work

0 of 6 modules complete

Modules

  1. 1

    When to fine-tune

    What fine-tuning is, the prompt → model → RAG → fine-tune ladder, strengths and weaknesses, where to fine-tune, and total cost.

    25 min
  2. 2

    Fine-tuning methods

    Full fine-tuning, LoRA and QLoRA, SFT, preference tuning (DPO), reinforcement fine-tuning, continued pre-training, distillation and choosing a base model.

    30 min
  3. 3

    Preparing training data

    Why data quality dominates, the JSONL chat format, qualities of good data, sources including synthetic data, validation and splits in Python, and personal data.

    30 min
  4. 4

    Running a fine-tune

    A LoRA fine-tune in Python with open-source libraries, key hyperparameters, reading loss curves, hosted fine-tuning, and forgetting and safety erosion.

    35 min
  5. 5

    Evaluating fine-tuned models

    Baselines, task metrics, comparing models in code, regression checks for ability, safety, fairness and memorisation, blind review, A/B tests and documentation.

    30 min
  6. 6

    Making models smaller, faster and cheaper

    Quantisation, distillation, pruning and smaller models, routing, caching and batching, a cost calculation in Python and a decision checklist.

    30 min

Frequently asked questions

When should you fine-tune an LLM?

Fine-tune when better prompting and RAG aren't enough and you need consistent behaviour, a specialised style or format, or a smaller, cheaper model for a narrow task. It isn't the best way to add new knowledge. Module 1: When to fine-tune →

What is LoRA?

LoRA (low-rank adaptation) fine-tunes a model by training small add-on matrices instead of all its weights. It needs far less memory and compute, and QLoRA reduces this further by quantising the base model. Module 2: Fine-tuning methods →

How much data do I need to fine-tune a model?

Quality matters more than quantity: a few hundred excellent, consistent examples often beat many thousands of noisy ones. Module 3: Preparing training data →

Can fine-tuning make a model less safe?

Yes. Fine-tuning can cause a model to forget abilities or weaken its safety behaviour, so check safety, fairness and general ability against the base model after training. Module 4: Running a fine-tune →

How can I make an AI model cheaper and faster?

Options include quantisation, distillation into a smaller model, pruning, routing easy requests to smaller models, and caching and batching. Module 6: Making models smaller, faster and cheaper →