A child learns what a dog is by seeing one, hearing it bark and hearing the word, all at once. For most of their history computer programs handled one kind of input at a time: a program for pictures, another for speech, another for text. Multimodal models take them in together. Show one a photograph of a street and ask, in words, which way the traffic is flowing, and it can answer.

Everything becomes tokens

The central idea is to turn every kind of input into the same kind of object. A language model already breaks text into tokens, small pieces of words, and represents each one as an embedding, a list of a few thousand numbers. Words with related meanings end up with similar lists.

Pictures can be treated the same way. In 2020 researchers at Google showed that an image could be cut into a grid of small squares, typically 16 pixels on a side, with each square flattened into a list of numbers and handled like a word. Sound is handled similarly: a recording is turned into a spectrogram, a picture of which pitches are loud at each moment, and cut into short slices. Once a picture, a sentence and a sound are all sequences of embeddings, one model can read them side by side.

Attention ties them together

The model that does the reading is the transformer, introduced in 2017. Its key operation is attention, which lets every token look at every other token and decide which ones matter to it. Each token produces three lists of numbers: a query, a key and a value. Attention compares queries with keys and uses the result to mix the values:

Attention(Q,K,V)=softmax(QKTd)V.

The softmax has the same shape as the Boltzmann distributionBoltzmann distributionThe rule that a system at a given temperature occupies each of its states with a probability that falls off exponentially with the state's energy. of physics: high scores win most of the weight, as low energies win most of the probability in a warm gas. In a multimodal model a word in a question can attend directly to the patch of the image it is about, so the word "traffic" can draw on the squares where the cars are.

Learning a shared space

For that to work, the embeddings of a picture and of a description of it must mean the same thing. A landmark method for achieving this was CLIP, published by OpenAI in 2021. It trains two encoders, one for images and one for text, on some 400 million pictures paired with captions collected from the internet. In each step it takes a batch of pairs and asks the model to pick out which caption belongs to which picture. The training minimises

L=−1N∑i=1Nlog⁡exp⁡(ui⋅wi/τ)∑j=1Nexp⁡(ui⋅wj/τ).

This is a cross-entropyEntropyA measure of how many microscopic arrangements fit what we observe of a system; loosely, its disorder, or the information we are missing. loss, and the method is called contrastive because the model learns by contrasting the right match with the wrong ones. Nobody labels the pictures by hand: the captions are the labels. The result is a shared space in which a photograph of a dog sits near the words "a photo of a dog". That makes new tasks possible without new training. To sort pictures into categories, write a caption for each category and pick the closest. CLIP, used this way, matched the accuracy on the ImageNet benchmark of a standard network trained directly on its 1.28 million labelled images.

What it can do, and what it cannot

Multimodal models can describe photographs to people who cannot see them, read handwriting and charts, transcribe and translate speech, and answer questions about diagrams. Systems that generate images from text use the same shared spaces to steer what they draw.

Their limits are just as real. They can describe things that are not in a picture, stating them as confidently as things that are. They often struggle to count objects or to say what is left of what. They learn from text and images gathered from the internet, so they absorb its gaps and prejudices. And matching patterns across senses is not the same as understanding the world those senses report on. A model that has seen a million photographs of glasses falling has not learned that glass breaks in the way a child who drops one has. The shared space is a powerful idea, but it is a map built from examples, and it is only as good as the examples it was built from.