01

Standing on giants' shoulders

Large language models are first pre-trained on vast amounts of text to learn general knowledge and language patterns, a process that requires huge datasets and computing power. The resulting model is a generalist: it knows a little about almost everything. Fine-tuning builds on this foundation, training the model further on a much smaller, carefully chosen dataset so it becomes better at specific tasks or behaves in particular ways.

02

How it works

During fine-tuning, the model is shown examples of inputs and desired outputs, such as questions and ideal answers, documents and summaries, or customer queries and helpful responses. Its weights are adjusted slightly to make those outputs more likely. Because the model already understands language, it can learn new tasks from relatively few examples, sometimes hundreds or thousands, compared with the trillions of words used in pre-training.

03

Making chatbots

Fine-tuning is how raw language models become helpful assistants. A pre-trained model simply continues text; it does not naturally follow instructions or hold conversations. Instruction tuning trains it on examples of instructions and good responses. Preference tuning, including reinforcement learning from human feedback, teaches it which answers people prefer, making it more helpful, honest and safe. These steps turned models like GPT-3 into ChatGPT.

04

Specialising

Organisations fine-tune models for specialised domains. A hospital might fine-tune a model on medical texts to better understand clinical terminology, a law firm on legal documents, or a bank on financial reports. Companies fine-tune models to match their brand's tone of voice, follow their policies or produce outputs in specific formats. Fine-tuning can also teach a model a language or dialect that was under-represented in its original training data.

05

Efficient methods

Fine-tuning all the weights of a large model is still expensive. Techniques such as LoRA, short for low-rank adaptation, introduced in 2021, train only a small number of additional parameters while keeping the original model frozen, dramatically reducing the computing and memory needed. This allows developers to fine-tune large models on a single graphics card and to store many specialised versions cheaply.

06

Fine-tuning versus RAG

Fine-tuning is often compared with retrieval-augmented generation, or RAG, in which a model is given relevant documents at the time of answering. RAG is usually better for providing up-to-date facts and citing sources, because information can be updated without retraining. Fine-tuning is better for teaching a model new skills, styles or formats. Many systems combine both: a fine-tuned model that also retrieves information.

07

Risks and pitfalls

Fine-tuning can go wrong. If the training examples are poor, biased or too few, the model may learn bad habits. Training too much on narrow data can cause it to forget general abilities, a problem called catastrophic forgetting. Research has also found that fine-tuning can weaken a model's safety training, which is why AI providers that offer fine-tuning services screen training data and evaluate fine-tuned models for harmful behaviour.

08

Arabic and local models

Fine-tuning is important for languages and cultures under-represented in global AI. Developers in the UAE and elsewhere fine-tune open models on Arabic text, including dialects, to improve their understanding of local language and context. Government entities fine-tune models on official documents and terminology to build assistants for public services. This allows countries to benefit from global advances while tailoring AI to local needs and building expertise of their own.

09

Do you need it?

For many businesses, fine-tuning is not the first step. Clear instructions in prompts, examples within the prompt and retrieval from company documents often achieve good results with less effort. Fine-tuning becomes worthwhile when a task is performed at large scale, requires a consistent format or style, involves specialised knowledge or must run on a smaller, cheaper model. Testing different approaches helps find the best solution.

010

Why it matters

Fine-tuning makes powerful AI adaptable. It allows organisations to build specialised tools on top of general models at a fraction of the cost of training from scratch, spreading AI's benefits across industries, languages and countries. Understanding how it works helps businesses make better decisions about how to use AI and helps everyone appreciate how the chatbots they use were shaped into helpful assistants, and why different AI tools can behave so differently.

FOLLOW THE EVIDENCE

Sources & further reading

A simplified explanation of a technical topic. Photograph: original AI-generated illustration (Adobe Firefly). Reference organisations do not endorse this website.