In short
- Vectorsthe common currencyWords, image patches, slices of sound and video frames are each turned into vectors: lists of a few thousand numbers. A transformer only ever sees vectors, so it does not care where they came from.
- Encodersone per senseEach kind of input has its own front end that cuts it into pieces and turns each piece into a vector: patches for images, spectrogram slices for audio, sampled frames for video.
- Alignmentwhy it makes senseTraining pulls a photo of a dog, the words “a dog” and a bark close together in the same space. That is what lets the model connect what it sees with what it reads.
- Budgetwhy video is costlyOne image costs hundreds of tokens and a minute of video thousands, against about 60 for a short paragraph. Models sample sparsely to cope, which explains many of their blind spots.
01The trick: turn everything into vectors
A language model is built on the transformer (Vaswani et al. 2017). Its input is not text. It is a sequence of vectors: lists of numbers, a few thousand long. For text, a tokenizer cuts the words into pieces and each piece is swapped for its own learned vector. The transformer then lets each vector look at the ones before it, layer after layer, and predicts what comes next.
Nothing in that machinery says the vectors must come from words. If you can turn a photo or a sound into vectors of the right length, you can put them in the same sequence. That is the whole idea of a multimodal model. The rest of this post is about how each kind of input becomes vectors, and how the model learns to make sense of them together.
Four kinds of input, one sequence, one model
Each input has its own front end. What comes out of each is the same kind of thing: vectors, shown as coloured blocks.
02Images: cut into patches
The standard way to feed an image to a transformer is to cut it into a grid of small squares, called patches, and treat each patch like a word. The paper that made this work was titled “An image is worth 16×16 words” (Dosovitskiy et al. 2021). Each patch’s pixels are flattened into one long list of numbers and multiplied by a learned matrix, which squeezes it into one vector. Try it:
An image becomes a grid of patches; each patch becomes one vector
Change the patch size and click a square to follow it from pixels to a vector.
Those raw patch vectors are not yet very meaningful: one is “mostly red”, another “a green edge”. So they first pass through a vision encoder, itself a transformer, in which every patch looks at every other patch. By the end, the vector for a patch on the car’s wheel carries information like “part of a car”. Many models reuse an encoder called CLIP for this (Radford et al. 2021). How CLIP learned to do that is the key to the whole story.
03Making pictures and words meet
Cutting an image into vectors is easy. Making those vectors mean the same things as the language model’s word vectors is the hard part. If the vector for a photo of a dog lands nowhere near the idea of “dog”, the language model cannot use it.
CLIP solved this with a simple game, played over 400 million image–caption pairs collected from the web. Show an image encoder and a text encoder a batch of photos and their captions. Reward them when each photo’s vector is closest to its own caption’s vector and far from the others. This is called contrastive training. After enough rounds, photos and descriptions of the same thing end up near each other in one shared space. Later work extended the same trick to sound, depth and other kinds of data (Girdhar et al. 2023).
Training pulls matching image, text and sound together
A sketch of a shared embedding space, flattened to two dimensions. Toggle before and after training; hover or tap points.
With an aligned encoder in hand, the last step is small. A little projector, often just two layers, reshapes the image vectors to the exact size and style of the language model’s word vectors. LLaVA, one of the first open models to do this, then trained on image–instruction pairs so the model learned to talk about what it sees (Liu et al. 2023).
04Audio: a picture of sound
Sound arrives as a wave: thousands of pressure readings per second. That raw wave is too long and too repetitive to read directly, so most models first draw a spectrogram, a picture of which pitches are loud at each moment. Speech then looks like stripes and bands, and a model can read it much as it reads an image.
Whisper, OpenAI’s speech model, takes 25-millisecond slices every 10 milliseconds and measures 80 frequency bands in each (128 in its latest version) (Radford et al. 2022). That gives 100 columns per second. Its encoder then merges neighbouring columns, leaving 50 vectors per second of audio. Gemini’s API counts 32 tokens per second (Google, Gemini API docs).
From a sound wave to the vectors a model reads
A real spectrogram, computed with Whisper’s settings, of a synthetic 3-second sound: three vowels, an “s”, a rising whistle and a clap. Drag the slider to move through it.
There is a second way to turn audio into tokens, used when a model must also speak. A neural audio codec compresses sound into a sequence of discrete codes, like a tiny vocabulary of sound fragments, and can turn those codes back into audio (Zeghidour et al. 2021; Défossez et al. 2022). A model that predicts codec tokens can produce speech the same way it produces words.
05Video: a flip-book of images
A video is a stack of images over time, usually with a soundtrack. The simplest approach is to sample frames, turn each into image tokens and place them in order, with timestamps and the audio alongside. Some models instead cut video into small 3D blocks that span a few frames, so motion is captured inside a single token (Arnab et al. 2021).
Frames are expensive, so models sample sparingly. Gemini’s API, for example, samples one frame per second by default and counts video at 263 tokens per second (Google, Gemini API docs). That keeps costs manageable, but anything that happens between two sampled frames is simply not there.
What the model sees depends on how often it looks
A 10-second clip of a bouncing ball. Black lines mark the sampled frames. Change the rate and watch the cost and the yellow moment.
06Three ways to wire it together
Given encoders that produce vectors, there are three main ways to connect them to a language model. They differ in what is reused, what is trained, and whether the model can produce images or sound as well as understand them.
Adapter, cross-attention or native
Switch between the three designs.
07Inside the sequence: words look at pixels
Once image vectors and word vectors share a sequence, attention does the rest. When the model processes the word “car” in your question, attention lets it pull information from whichever vectors are most relevant, and after alignment training those include the patches that show the car. No special “vision module” answers the question; the same layers that link a pronoun to its noun link a word to a region of the picture.
Each text token draws on the image patches it needs
An illustration of attention from text to image, with hand-set weights; brighter squares get more attention.
08The token budget
Every vector in the sequence costs compute and fills up the model’s context window. Text is cheap. Pictures, sound and especially video are not.
A minute of video costs as many tokens as a long book chapter
Tokens per input, log scale. Each bar is a documented or measured count for a specific model.
09What this explains about everyday quirks
- Small text in images is hard. A screenshot is shrunk and cut into patches; a line of tiny print may fall across a few patches and lose detail. Many systems now split large images into tiles to keep resolution, at the cost of more tokens.
- Fast events in video are missed. At one frame a second, a quick gesture or a ball hitting a can may never be sampled (Figure 5). The model fills the gap with a plausible guess.
- Counting and exact positions are shaky. The model reads a few hundred patch vectors, not objects. Five overlapping apples do not arrive as five separate things.
- Long recordings run into limits. An hour of video can use close to a million tokens, so models summarise, sample less often or cut the input.
- Speaking and drawing are the same trick in reverse. To talk, a model predicts audio-codec tokens that are decoded into sound. To make pictures, it predicts image tokens or hands a description to a separate image generator.
Underneath the variety there is one idea: find a way to cut each kind of input into pieces, turn each piece into a vector, train until vectors about the same thing land in the same place, and let one transformer read them in a single line.
References
- Alayrac et al. (2022). Flamingo: a Visual Language Model for Few-Shot Learning. NeurIPS 2022. arXiv:2204.14198
- Arnab, Dehghani, Heigold, Sun, Lučić, Schmid (2021). ViViT: A Video Vision Transformer. ICCV 2021. arXiv:2103.15691
- Chameleon Team (2024). Chameleon: Mixed-Modal Early-Fusion Foundation Models. arXiv:2405.09818
- Défossez, Copet, Synnaeve, Adi (2022). High Fidelity Neural Audio Compression (EnCodec). arXiv:2210.13438
- Dosovitskiy et al. (2021). An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. ICLR 2021. arXiv:2010.11929
- Gemini Team, Google (2023). Gemini: A Family of Highly Capable Multimodal Models. arXiv:2312.11805
- Google. Understand and count tokens, Gemini API documentation (accessed December 2026). ai.google.dev/gemini-api/docs/tokens
- Girdhar, El-Nouby, Liu, Singh, Alwala, Joulin, Misra (2023). ImageBind: One Embedding Space To Bind Them All. CVPR 2023. arXiv:2305.05665
- Liu, Li, Wu, Lee (2023). Visual Instruction Tuning (LLaVA). NeurIPS 2023. arXiv:2304.08485
- Liu, Li, Li, Lee (2024). Improved Baselines with Visual Instruction Tuning (LLaVA-1.5). CVPR 2024. arXiv:2310.03744
- OpenAI (2024). Hello GPT-4o. openai.com/index/hello-gpt-4o
- Radford et al. (2021). Learning Transferable Visual Models From Natural Language Supervision (CLIP). ICML 2021. arXiv:2103.00020
- Radford, Kim, Xu, Brockman, McLeavey, Sutskever (2022). Robust Speech Recognition via Large-Scale Weak Supervision (Whisper). arXiv:2212.04356
- Vaswani et al. (2017). Attention Is All You Need. NeurIPS 2017. arXiv:1706.03762
- Zeghidour, Luebs, Omran, Skoglund, Tagliasacchi (2021). SoundStream: An End-to-End Neural Audio Codec. arXiv:2107.03312