Concept 4 of 4

Customising a foundation model

2 questions test this

A foundation model arrives trained on general text and knowing nothing about the organisation that wants to use it. Customisation is the work of closing that gap, and it is a cost decision before it is a technical one. The five available methods differ by orders of magnitude in what they cost to set up and in what they cost to correct.

The sections below take the five methods in order of cost, from the one that changes nothing about the model to the one that builds a model from nothing, and end with the question that decides which method a problem needs.

In context learning

In context learning puts instructions and examples in the prompt. Nothing about the model changes, and the effect lasts exactly one call.

In context learning is the cheapest to set up, the fastest to iterate on and the right first attempt for almost every problem. Its cost is ongoing, because those tokens are paid for on every request, and the context window limits how much can be supplied at once.

Retrieval Augmented Generation

Retrieval Augmented Generation fetches relevant documents at question time and places them in the prompt. The model is never retrained, and the documents live in the prompt for the length of one call.

Retrieval is the answer when the gap is knowledge, meaning current facts, private documents or anything that needs a citation. Building the pipeline costs a moderate amount, keeping it current is cheap, and retrieval is the only one of the five methods where correcting a wrong answer can mean editing a document.

Fine tuning

Fine tuning trains the model further on labelled examples the organisation supplies, so that its weights change. The gap it closes is behaviour.

Fine tuning has four named variants. Instruction tuning teaches the model to follow instructions in a particular way. Domain adaptation teaches the model the vocabulary and conventions of a field. Transfer learning is the general principle underneath, where a model trained for one task is adapted to another. Reinforcement learning from human feedback uses human rankings to train a reward model that shapes output towards what people prefer.

Fine tuning earns its cost when a consistent format, tone or style is needed on every call, when prompts have grown long and repetitive, or when a small fine tuned model could replace an expensive general one. The replacement case is the strongest commercial argument, because the training cost is paid once and the saving on inference recurs on every call afterwards.

Data preparation is most of the work. Curation, governance, dataset size, labelling and representativeness each decide part of the outcome, and a model learns whatever is in the examples, including the mistakes and the imbalance.

Continued pre training

Continued pre training trains an existing model on a large unlabelled corpus drawn from one field, so that the model absorbs the language of that field. It needs no labels at all. It uses far more data than fine tuning and far less than the original pre training.

Continued pre training earns its cost where a field is genuinely far from general text, as clinical notes and legal filings are. It is expensive, and it is seldom the first thing a team should try.

Pre training from scratch

Pre training from scratch builds a foundation model from nothing. It costs millions of dollars and months of compute, and it needs a specialist team of its own. A handful of organisations justify that for reasons of sovereignty, licensing or a domain no published model covers.

Choosing among the five methods

The choice follows from the kind of gap between the model and the problem. Where the gap is knowledge, meaning facts the model was never trained on, retrieval closes it. Where the gap is behaviour, meaning a format or a tone that has to hold on every call, fine tuning closes it. Where the gap is the language of a field, meaning vocabulary and conventions the model has barely seen, continued pre training closes it. Where the gap has not been identified at all, in context learning finds it in an afternoon and shows which of the other methods was actually needed.

The order matters commercially as well as technically. Each method further down the list costs more to set up and takes longer to correct, and teams that begin with fine tuning frequently find afterwards that a better prompt and a retrieval index would have done the job. Each of the major platforms offers the same options under its own names, with Amazon Bedrock and SageMaker on AWS, Vertex AI on Google Cloud and Azure AI Foundry from Microsoft. On all of them a customised model carries a hosting cost of its own on top of the tokens it uses. That standing cost is the part teams underestimate, because the hosting runs whether or not anybody is asking the model anything.

Common misconceptions

“Fine tuning is how a model is taught a company's facts.”

Fine tuning teaches behaviour, tone, format and domain language. Facts that change belong in retrieval, because correcting a fine tuned model means another training run while correcting an index means editing a document.

“More training data always makes fine tuning better.”

Quality and representativeness beat volume here. A few hundred carefully curated examples routinely outperform tens of thousands of inconsistent ones, because the model learns the inconsistency along with the task.

“In context learning changes the model.”

The weights stay exactly as they were. The examples live in the prompt and are gone after the call, which is why in context learning costs tokens on every request, and why it is the cheapest method to try and the dearest to run at volume.

2 questions test this concept

A legal firm needs every generated contract summary to follow its house structure and tone. The facts come from the contract supplied with each request. Which approach fits?

  • ARetrieval over an index of past summaries.
  • BFine tuning on a curated set of past summaries.
  • CGrounding with Google Search.
  • DRaising the output length limit so the full structure fits.
Check whether it stuck.

One per page, with a worked explanation.

Start the set
Related material
Book
AI Engineering, On when adaptation is worth its cost.
Book
Designing Machine Learning Systems, On data curation for training.
Template
RICE scoring sheet, Reach, Impact, Confidence and Effort columns with the score formula built in, defined confidence bands, and a column recording the assumption behind each input.