Finetuning Language Models
Think of the modality list as open-ended. Video, 3D assets, and protein structures are among the kinds of data that some newer models understand. Any model that accepts text and also accepts another modality belongs in the multimodal branch.
Why Models Need More Than Words
Think about how you learn about the world. You use sight, sound, touch, and reading, and you rarely rely on just one of them at a time. A language model, by contrast, sees only text. It can write fluently, summarize an argument, and answer questions, yet it cannot look at a photograph of a broken appliance or listen to a recording of an engine. The gap between those two situations is the starting point for this article: what happens when models are built to take in more than words, and what those broader models can be used for.
This shift is best understood as an extension of language models rather than a replacement for them. Developers are widening what models can accept as input so that they can work in settings where information arrives in many forms. Keep that motivation in mind, because most of the concepts that follow grow out of it.
Modalities and Multimodal Models
A data modality is one type of information a model can work with, such as text, images, video, audio, or 3D assets. A multimodal model is a model that works with more than one modality.
Models that handle a single modality have a long history. Models that handle several modalities at once are the newer development. The term multimodal model is used for any model that works with more than one modality, and that includes models that accept text together with another kind of input.
Two families of models fall under one umbrella. Large language models process text. Large multimodal models, which are generative, extend the same idea to several modalities. This article uses the term foundation models to cover both families. Many people still call systems such as Gemini and GPT-4V LLMs, but they are better described as foundation models.
Think of the modality list as open-ended. Video, 3D assets, and protein structures are among the kinds of data that some newer models understand. Any model that accepts text and also accepts another modality belongs in the multimodal branch.
How Multimodal Models Extend Next-Token Generation
Recall how a language model generates output. It produces the next token from the tokens it has already seen, and it repeats this step to build a response. A multimodal model keeps that same loop but changes what the conditioning context contains. Instead of only text tokens, the context can include image tokens alongside text tokens, or tokens from whichever other modalities the model supports.
The core operation does not change. The model still predicts a next token. What differs is the evidence available when it makes that prediction. A visual token can influence the wording of an answer just as an earlier word can, which is why a multimodal model can describe a picture it was shown.
Tracing One Prediction With an Image in Context
A user uploads a photo of a broken appliance and asks what might be wrong. Trace what the model conditions on as it predicts its first answer token.
- 1Gather the inputs
The photo is represented as image tokens, and the user's question is represented as text tokens.
- 2Combine the context
Both kinds of token sit in the same context that the model conditions on.
- 3Predict the next token
The model predicts one token from everything in that context. A visual token can shape the wording of the prediction, just as an earlier word can.
- 4Repeat the loop
The predicted token is added to the context, and the loop runs again until the response is complete.
The output is still a sequence of next-token predictions. What has widened is the evidence behind each prediction, which now includes visual information.
Learning Without Hand Labels
Multimodal models need large amounts of data, just as language models do. Self-supervision works for them too. In self-supervision, the training signal comes from the data itself rather than from human-written labels. One variant is called natural language supervision, and it was used to train OpenAI's CLIP.
The method avoids writing a label for every image. Instead, training uses (image, text) pairs that already appear together on the internet. The source reports a dataset of 400 million such pairs, which it describes as 400 times larger than ImageNet, and it was produced without the cost of manual labeling. The result was a model that could generalize to several image classification tasks without additional training for each one.
The key idea is that the pairing itself is the teaching signal. A caption that already sits next to a picture can stand in for a hand-written label, which is why the approach scales to very large datasets.
From Task-Specific Models to General-Purpose Models
The other major change is in task scope. Earlier models were usually built for one job. A model trained for sentiment analysis could not perform translation, and a translation model could not do sentiment analysis. Foundation models, because of their scale and the way they are trained, can handle a broad range of tasks. The shift is from task-specific models to general-purpose ones.
A general-purpose model often performs reasonably well straight out of the box. An LLM, for instance, can carry out both sentiment analysis and translation without being built separately for either. A general-purpose model can also frequently be adjusted to do better on one particular task.
| Model type | Typical scope | What it can do |
|---|---|---|
| Task-specific model | One job | A sentiment model cannot perform translation |
| Text-only language model | Text input and output | Writes, summarizes, and answers questions, but cannot look at a photograph |
| General-purpose foundation model | Many tasks | Performs sentiment analysis and translation without a separate build for each |
| Multimodal foundation model | Several input types | Can describe a picture it was shown |
Earlier models were built around a single job or a single input type. Foundation models cover broader ground.
Breadth Does Not Guarantee Fit
A retailer wants an application that writes product descriptions for its website. An out-of-the-box model may produce accurate descriptions, yet still fail to reflect the brand's voice or to emphasize the brand's messaging. The text can also drift into marketing language and familiar clichés. The model is capable, but its default behavior does not match what this retailer needs.
Broad capability and good fit are different things. Once a general-purpose model is chosen, the practical question becomes how to steer it toward the output you need.
Three Ways to Adapt a Model
AI engineering teams use three common techniques to adapt a general-purpose model: prompt engineering, retrieval-augmented generation (RAG), and finetuning. Each changes the model's behavior in a different way, so it helps to examine them separately. The main contrast is where the adaptation lives. Prompt engineering and RAG work around the model by controlling its input. Finetuning works inside the model by training it.
| Method | Where the adaptation lives | Core idea |
|---|---|---|
| Prompt engineering | The input prompt | Shape the instructions and context given to the model |
| Retrieval-augmented generation | Retrieved external context supplied with the input | Bring relevant outside information into the input |
| Finetuning | The model's weights | Train the model on task-specific examples |
Three ways to steer a general-purpose model.
Watching Finetuning Change a Model
Finetuning trains a model on task-specific examples. Training adjusts the model's weights, which are the parameters that determine how it responds to input. After finetuning, the same kind of model can behave in a more targeted way for the task it was trained on.
In the diagram, the weights are the part that changes. The overall model is still the same model, now adjusted. The output the retailer receives moves from generic copy toward copy that reflects the brand's voice, which was the gap identified earlier.
What AI Engineering Means
AI engineering is the process of building applications on top of foundation models. People have built AI applications for over a decade, a practice often called ML engineering or MLOps (short for ML operations). What is new is the starting point. Traditional ML engineering develops models, while AI engineering leverages existing ones.
In this pipeline the expensive pretraining step is absent. The model is already built when the engineer begins. The engineer's work is selecting an adaptation method, such as prompt engineering, RAG, or finetuning, and wrapping the result in an application. This approach is cheaper and faster, because foundation models make it cheaper to develop AI applications and reduce time to market.
Several factors together make AI engineering grow quickly. The first is that foundation models are powerful not only because they do existing tasks better, but because they can do more tasks. Applications once considered impossible are now feasible, and applications nobody had planned are appearing. Writing is a clear example. Since AI can now write as well as humans, and sometimes better, it can automate or partially automate any task involving communication, such as writing emails, responding to customer requests, and explaining complex material.
Mistakes Beginners Make With Foundation Models
Common mistake Treating general-purpose capability as proof of task fit
What it looks likeAssuming that an out-of-the-box model will write product descriptions in a specific brand's voice.
Why it failsBreadth does not guarantee fit. The default output can be accurate yet still miss the brand's voice and messaging.
Do this insteadEvaluate the model on your own task first, then choose an adaptation method if the output does not match.
Common mistake Calling every multimodal system an LLM
Why it failsLarge language models process text, while large multimodal models extend the same idea to several modalities.
Do this insteadUse the term foundation models for both families, as this article does.
Common mistake Believing a multimodal model predicts differently from a text-only model
Why it failsThe core operation is still next-token prediction. What changes is the content of the context.
Do this insteadThink of image tokens as additional evidence in the same context, not as a different kind of prediction.
Common mistake Assuming prompt engineering changes the model itself
Why it failsPrompt engineering and RAG control the input. Finetuning is the method that works inside the model by training it.
Do this insteadAsk whether your change belongs in the input or in the weights before choosing a method.
Checking Your Understanding
What do you think happens?
A customer uploads a photo and asks a question about it. Does the model predict its answer in a different way from a text-only model?
Reveal answer
No, it still predicts the next token, but the context includes image tokens.
The core operation is unchanged. The difference is the evidence in the context, and image tokens can influence the wording of the answer just as earlier words can.
A team wants a model to answer questions about its internal policy documents, which change every month. Which adaptation method would you consider first, and why? Explain your reasoning in terms of where the change should live: the input, retrieved context, or the model's weights.
Hints
- Compare what changes in the input with what changes inside the model.
- Consider how often the underlying information is expected to change.
Key Takeaways
- 1Foundation models include large language models and large multimodal models, and they can be adapted for many purposes.
- 2A multimodal model keeps the next-token loop but conditions on image tokens alongside text tokens.
- 3Prompt engineering and RAG control the input, while finetuning trains the model itself.
- 4AI engineering builds applications on existing foundation models, which makes development cheaper and faster.
At a glance
- Foundation models include large language models and large multimodal models, and they can be adapted for many purposes.
- Multimodal models extend next-token generation to inputs such as images by placing image tokens in the same context as text tokens.
- Prompt engineering and retrieval-augmented generation control what goes into the model, while finetuning trains the model's weights.
- AI engineering means building applications on existing foundation models, which makes general-purpose models practical to deploy.