Lesson 1 of 4 Customizing Foundation Models

Choosing the Lightest Effective Customization Approach

This lesson explains the spectrum of ways to adapt a foundation model, from changing the prompt to changing its weights, and how to choose the lightest approach that meets the requirement.

Learning outcomes

After completing this lesson, you will be able to:

  • Order prompt engineering, RAG, fine-tuning and continued pre-training by effort.
  • Choose RAG for knowledge problems and prompting or fine-tuning for behaviour problems.
  • Combine customisation approaches.

The approaches

Prompt engineering changes only the input: instructions, examples and output format. Retrieval Augmented Generation (RAG) adds relevant documents to the prompt at runtime, giving the model current or private knowledge with citations. Supervised fine-tuning trains the model on labelled examples to change behaviour, style, format or task skill. Reinforcement fine-tuning trains with reward signals. Distillation transfers a large model's behaviour to a smaller one. Continued pre-training teaches domain language from unlabeled text. Training a model from scratch is rarely justified.

Choosing an approach

A useful rule is: knowledge problems call for RAG, and behaviour problems call for prompting first and fine-tuning if prompting is not enough. Knowledge that changes often, must be cited or is access-controlled belongs in RAG, because fine-tuned knowledge cannot be updated or removed without retraining. Consistent format, tone or a narrow task that needs long prompts suits fine-tuning, which can also shorten prompts and lower per-request cost. Cost and latency at scale suit distillation.

The following table summarises the spectrum.

ApproachChangesData neededCost and effortBest for
Prompt engineeringInputA few examplesLowestInstructions, format, quick iteration
RAGInput (retrieved context)Document corpusLow-mediumCurrent, private, citable knowledge
Supervised fine-tuningWeightsHundreds to thousands of pairsMediumStyle, format, narrow task
Reinforcement fine-tuningWeightsPrompts plus reward functionMedium-highVerifiable tasks, alignment
DistillationStudent weightsRepresentative promptsMediumLower cost and latency
Continued pre-trainingWeightsLarge unlabeled corpusHighDomain vocabulary

The following diagram matches each problem to its approach.

The rule for choosing a customisation approach, applied to three problems. Daily-changing price lists are a knowledge problem, so RAG; a strict brand voice and JSON layout are a behaviour problem, so prompting first and supervised fine-tuning when prompting is not enough; and a large model that is too expensive at scale calls for distillation.
Knowledge problems call for RAG; behaviour problems for prompting, then fine-tuning.
Scenario questions

The lightest approach that works

Exam skills 2.1.2 · 2.2.8

Choose the lightest customisation approach that meets each requirement.

Log in to try this activity Interactive activities are free with an account.

Combining approaches

Customisation approaches are not alternatives to choose between once; they combine well. A fine-tuned model can still use RAG to supply current facts, because fine-tuning teaches style and behaviour rather than up-to-date knowledge. A distilled model can use prompt caching to reduce cost further. And good prompts remain important after fine-tuning, because the fine-tuned model still responds to its instructions.

Each additional step adds cost and effort, so each should be evaluated against the previous one on the same test set. Moving from prompt engineering to RAG, or from RAG to fine-tuning, is justified only when it produces a measured gain that outweighs its cost.

True or false

Combining approaches

Exam skills 2.1.2

Check how customisation approaches work together.

Log in to try this activity Interactive activities are free with an account.
Worked example

Three requests

A company has three generative AI problems.

ProblemApproachReason
Answers must reflect price lists updated dailyRAGKnowledge changes daily; fine-tuning would be stale
Product descriptions must follow a strict brand voice and JSON layoutSupervised fine-tuning after prompt attemptsBehaviour and format consistency
A large model works well but costs too much at 5 million requests a monthDistillationKeep quality, cut cost

Fine-tuning the price lists into the model would require retraining every day and could not provide citations, so it is the wrong tool for the first problem.

Check yourself

Which approach suits knowledge that changes or must be cited?

Show answer

RAG, which retrieves current documents at query time.

Exam Tips

Remember for the exam

  • Knowledge that changes or must be cited: RAG.
  • Behaviour, style or format: prompt engineering first, then fine-tuning.
  • Lower cost at scale with similar quality: distillation.
  • Domain vocabulary from unlabeled text: continued pre-training.
  • Choose the lightest approach that meets the requirement.