AI curriculum
Course outline for Model Adaptation and Fine-Tuning
A house style lives in the weights, not in the prompt. Build forty instruction pairs, train a small adapter on one GPU, and score it against a prompt baseline. Then serve the merged model locally and write when to tune and when to prompt.
Model Adaptation and Fine-Tuning Course Objectives
- Choose between prompting, retrieval, and changing the model weights.
- Build a labelled instruction dataset with a held-out split.
- Explain what a low-rank adapter changes and what it leaves frozen.
- Run a quantized training job on one small open model.
- Measure the tuned model against a prompt baseline on held-out cases.
- Record when not to tune and what triggers a refresh.
Pre-requisites
- How Large Language Models Work or equivalent understanding of weights, tokens, and sampling.
- Local and Small Language Models or equivalent experience running a model locally.
- Retrieval-Augmented Generation helps contrast retrieval with tuning, but it is optional.
- Basic Python: read a file, write a loop, and run a script.
- One 16 GB GPU, or one rented GPU hour. A laptop alone is not enough.
Before this course
Complete the required courses or bring equivalent experience. Recommended courses add useful depth; they are not enrolment gates.
Required preparation
Recommended preparation
Can read and write Python files and run a command. One GPU hour is available. No pretraining, distributed training, or reinforcement learning experience is required.
Find your place in the learning mapLab Setup
Delivery requirements: the following environment, materials, access, and exercise timing must be prepared and verified before delivery. This outline does not certify that a lab package is ready.
- A prepared container with Python 3.15.2, PyTorch 2.15.0, transformers 5.22.2, datasets 5.1.0, peft 0.21.2, bitsandbytes 0.50.2, and trl 1.17.1.
- One 16 GB GPU, rented by the hour, with 20 GB of free disk.
- Sixty supplied house emails and twenty held-out cases.
- Qwen2.5-1.5B-Instruct under Apache-2.0, downloaded once.
- Ollama 0.40.15 for the final local call.
Detailed Course Outline
Module 1: Decide what to change (2 hours)
- Prompting, retrieval, and weights: Three ways to change an answer. A prompt changes the request, retrieval changes the evidence, and tuning changes the parameters.
- Instruction data: Pairs of one instruction and one accepted answer. The pairs define the style the model should copy, so their quality limits the result.
- Baseline scoring: One written rule and one fixed case set scored before training. Without a baseline, no later gain is measurable.
Practical outcome: Choose one of three fixes and build a labelled dataset with a held-out split.
Module 2: Train an adapter (2 hours)
- Adapters and frozen weights: A small set of trained matrices added beside frozen base weights. The adapter file holds a fraction of the base parameters.
- Quantized base models: Base weights stored at low precision during training. The adapter trains in higher precision while the base stays small.
- The training loop: Repeated passes over the pairs with a loss, a learning rate, and a step count. Each step updates the adapter only.
Practical outcome: Load a four-bit base, add an adapter, and run a short training job.
Module 3: Judge the tuned model (2 hours)
- Training evidence: Loss per step, evaluation loss, peak memory, and wall time. A falling training loss can still mean memorised pairs.
- Held-out scoring: The same rule applied to cases the model never trained on. This score decides whether the adapter beats the baseline.
- Regression checks: Cases the base model answered well and the tuned model now fails. A short regression sheet keeps these visible.
Practical outcome: Score the tuned model on held-out cases and name what it lost.
Module 4: Serve and decide (2 hours)
- Merging and export: The adapter weights folded into the base and written as one model file. The merged file serves without the training stack.
- Local serving: The merged file loaded in one local runtime and called from a client. Memory and latency are measured the same way as before training.
- Adaptation decisions: When to prompt, when to retrieve, when to tune, and when to refresh. Each decision names an owner and a trigger.
Practical outcome: Merge the adapter, serve it locally, and write a decision with conditions.
Practical exercise
- Produce a dataset card, a split manifest, and one written scoring rule.
- Run one prompt baseline and one tuned run on the same twenty held-out cases.
- Record adapter size, peak memory, and training time.
- Name two regressions and one task the tuned model kept.
- Write a decision record with one owner and one refresh trigger.
What you will produce
Build one small adapter from your own instruction data and measure it against a prompt baseline.
How the work is checked
- The dataset card records sources, pair count, and the held-out split.
- The adapter card records rank, target modules, trainable parameters, and the frozen base.
- Training evidence reports loss per logged step, peak memory, and wall time.
- The comparison scores the prompt baseline and the tuned model on the same held-out cases.
- The decision record names two regressions and one condition for a refresh.
Eight hours on one 1.5B open model, forty instruction pairs, and twenty held-out cases. The course runs one quantized LoRA training job on one 16 GB GPU. It does not teach pretraining, distributed training, reinforcement learning from feedback, or production serving.
When another approach is better
- Do not tune a model when a prompt or a retrieved passage already passes the held-out cases.
- Do not compare a tuned model with a baseline scored on different cases.
- Do not call a tuned model correct because its training loss is low.
How we train
Contact us for full course details, including duration, delivery options and lab requirements.
Ask about exercises, instructor feedback and the prior knowledge you need. Tool-specific courses marked provisional may become modules in a broader course.
Discuss your learning goals