How Do Multimodal LLMs See Images? Patches, Tokens and Encoders

By LatestLLM Editorial · Published · Facts verified · 9 min read

Also called: vision language model, VLM, image tokens, vision encoder, ViT, image patches, CLIP, multimodal LLM

Before this: Embedding, Transformer

In one line

A multimodal model accepts more than text by cutting an image into small patches, turning each into a vector, and feeding those vectors to the transformer as if they were tokens.

Multimodal models, simply and technically

In plain English

A language model only knows how to read a stream of tokens, so to let it look at a picture, the picture has to be turned into something that looks like tokens. The usual method is to cut the image into a grid of small squares, convert each square into a list of numbers, and hand those lists to the model in order, just like words.

From then on the model treats the picture much like a very long sentence. The same attention that links words to earlier words links parts of the picture to each other and to your question. More detail in the image means more squares, so a large photo can cost as many tokens as several pages of text.

Think of it like this: Reading an image this way is like describing a mosaic by calling out each tile in order, row by row. A listener who knows how tiles combine can reconstruct the scene. The cut-up grid loses nothing the tiles contain but needs the listener to work out which tiles are neighbours above and below, which is why models also need position information for patches. The comparison to a person looking at a whole picture at a glance does not carry over: the model has to piece it together.

Everyday example: A photo as a sequence

A 224 by 224 pixel photo is cut into squares 16 pixels wide.

Input:

224 × 224 photo, 16 × 16 patches

Output:

14 × 14 = 196 image tokens

What it shows: The photo becomes a grid of 14 by 14 squares, 196 pieces in all. Each becomes one token-like vector, so the model receives a sequence of 196 items for the image, followed by the words of the question. At about 0.75 words per token, that is roughly the size of 147 words of text.

Technically

The Vision Transformer (Dosovitskiy et al. 2020) splits an image into non-overlapping P × P patches, flattens each to a vector of P × P × 3 values (768 for 16 × 16 RGB), applies a learned linear projection to the model width and adds position embeddings. A 224 × 224 image with P = 16 gives 14 × 14 = 196 patch tokens; halving the patch size quadruples the sequence. Higher-resolution images give longer sequences at the same patch size, which is why image inputs can dominate the context window. CLIP (Radford et al. 2021) trains an image encoder and a text encoder so that matching pairs agree, learning from 400 million image-text pairs, and its image encoder is a common front end for language models.

In a typical vision-language model, a separate vision encoder turns the image into patch vectors, a small projector maps them to the language model's embedding width, and the decoder attends to them like text tokens. Gemma 4 uses this design in most sizes, with vision encoders of about 150M parameters in E2B and E4B and about 550M in the 31B and 26B-A4B models; the 12B is encoder-free, projecting raw image and audio patches straight into the decoder. Every Gemma 4 size accepts text and images, and E2B, E4B and 12B also accept audio.

Technical example: How many tokens is an image?

Patch grids and token counts for three example image sizes, computed with ceiling division, plus the raw values in one patch.

Code (python):

def grid(width, height, patch):
    cols, rows = -(-width // patch), -(-height // patch)       # ceiling division
    return cols, rows, cols * rows

for w, h, p in [(224, 224, 16), (336, 336, 14), (1024, 768, 16)]:
    cols, rows, tokens = grid(w, h, p)
    print(f"{w}x{h} with {p}x{p} patches: {cols} x {rows} = {tokens:,} tokens "
          f"(~{round(tokens * 0.75):,} words of text)")

print("values in one 16x16 RGB patch:", 16 * 16 * 3)
print("patch size 8 instead of 16 on a 224x224 image:", grid(224, 224, 8)[2], "tokens")

Output:

224x224 with 16x16 patches: 14 x 14 = 196 tokens (~147 words of text)
336x336 with 14x14 patches: 24 x 24 = 576 tokens (~432 words of text)
1024x768 with 16x16 patches: 64 x 48 = 3,072 tokens (~2,304 words of text)
values in one 16x16 RGB patch: 768
patch size 8 instead of 16 on a 224x224 image: 784 tokens

What it shows: Token counts follow directly from image size and patch size: 196 for 224 × 224 at 16 × 16, 576 for 336 × 336 at 14 × 14 and 3,072 for 1024 × 768 at 16 × 16. Halving the patch size to 8 on the 224 × 224 image gives 784 tokens, four times as many. Providers each apply their own image-to-token rules, so billing formulas differ from this raw patch count.

Cutting an image into tokens. Set the image width, its shape and the patch size to see a drawn image divided into a grid of patches. The readout gives the number of columns and rows, the total token count, the equivalent amount of English text and the size of Gemma 4 31B's vision encoder. Patch arithmetic from the Vision Transformer paper; the picture is an abstract illustration, and the encoder size comes from the Gemma 4 guide.

Images as tokens

In plain English: To a transformer everything must be a list of vectors. For text, a tokenizer chops sentences into pieces and looks each one up. For pictures, the equivalent is chopping the image into squares and converting each into a vector.

Technically:

Dosovitskiy et al.'s title says it: an image is worth 16 × 16 words. A patch of 16 × 16 × 3 = 768 pixel values is projected with a learned matrix to the hidden size, then position embeddings tell the model where the patch came from, after which a standard transformer encoder processes the sequence. The paper's pre-training uses 224 × 224 images.

The same recipe extends to audio, which is cut into short windows of a spectrogram, and to video, which adds a time axis. In every case the content is turned into a sequence of vectors and the attention mechanism does the rest.

What is a patch embedding?

The vector made by flattening a small square of the image and projecting it to the model's width. It plays the role of a token embedding.

Encoder and projector

In plain English: Most systems do not teach the language model to read pixels directly. A separate, smaller network first turns the picture into rich patch descriptions, and a small adapter reshapes them so the language model can use them.

Technically:

A vision encoder, usually a Vision Transformer trained with a contrastive objective such as CLIP's, outputs one vector per patch. A projector, often a linear layer or small MLP, maps those vectors to the language model's embedding width, and the results are inserted among the text tokens, with markers around them. The language model then attends to them in every layer.

In Gemma 4, the vision encoders are separate from the text decoder: about 150M parameters on E2B and E4B and about 550M on the 31B and 26B-A4B models. They add to a model's total parameters but not to the cost of the text layers.

Learning from captions

In plain English: How does an encoder learn what the patches show? One effective way is to train it on pictures paired with their captions, so that the picture and its caption end up describing the same thing in the model's internal language.

Technically:

CLIP trains on the simple task of predicting which caption goes with which image, using 400 million image-text pairs from the internet, and learns image representations from scratch that transfer to many tasks. The training uses a contrastive loss that pulls matching image and text embeddings together and pushes mismatched ones apart, which is the same kind of shared embedding space described on the embedding page.

Language models can also be trained end to end on interleaved text and images, or fine-tuned on instruction data about images, so the model learns to describe, answer questions about and reason over what the encoder produces.

Everyday example: Matching pictures and captions

A model is shown a photo of a dog on a beach and ten possible captions.

What it shows: It learns to give the highest score to the right caption and low scores to the others. After many millions of such pairs, the encoder has learned a vector for “dog on a beach” that sits near the caption's vector.

Encoder-free designs and costs

In plain English: Some newer models skip the separate encoder and feed raw patches straight into the main model, simplifying the pipeline. Whatever the design, more detail means more tokens, and tokens cost time and memory.

Technically:

Gemma 4's 12B model is a unified, encoder-free design that projects raw image and audio patches straight into the decoder-only transformer. Because the image tokens share the context window with text, a high-resolution image of 3,072 tokens leaves that much less room for the conversation, and each token enlarges the KV cache.

Services therefore resize images and offer a detail setting, and billing converts image size into a token count by provider-specific formulas. For tasks needing fine detail, such as reading small text in a screenshot, higher resolution means more tokens but better accuracy.

Common misconceptions

  • Myth: A multimodal model sees an image the way a person does.

    Reality: It receives a grid of patch vectors and attends over them. Counting objects, reading tiny text and precise spatial relations can still be hard.

  • Myth: An image costs the same as one token.

    Reality: An image becomes hundreds or thousands of tokens depending on its size and patch size, which fills context and cache.

  • Myth: Every multimodal model has a separate image encoder.

    Reality: Most do, but designs such as Gemma 4 12B feed raw image patches straight into the decoder.

Where you'll see this

  • Gemma 4 architecture: Every Gemma 4 size accepts images; encoders are about 150M (E2B, E4B) or 550M (31B, 26B-A4B), and the 12B is encoder-free.

Key takeaways

  • A multimodal model converts an image into patch vectors that the transformer reads like tokens.
  • A 224 × 224 image with 16 × 16 patches is 196 tokens; patch size and image size set the count, and a larger image costs more context.
  • CLIP-style training aligns images and captions, learned from 400 million image-text pairs, and its encoders are a common front end.
  • Gemma 4 uses separate vision encoders of about 150M to 550M parameters in most sizes and a unified, encoder-free design in its 12B.

Frequently asked questions

How does an LLM understand an image?

The image is cut into patches, each is converted to a vector, and the vectors are fed to the transformer as a sequence of tokens alongside the text.

How many tokens is an image?

It depends on size and patch size: a 224 × 224 image with 16 × 16 patches is 196 tokens, and a 1024 × 768 image with 16 × 16 patches is 3,072.

What is CLIP?

A model trained on 400 million image-text pairs to match captions with images, whose image encoder is widely used as the vision front end for language models.

What is a vision encoder?

A network, often a Vision Transformer, that turns image patches into vectors a language model can use.

Do multimodal models also handle audio?

Some do. Gemma 4 E2B, E4B and 12B accept audio as well as text and images.

Sources

Facts last verified November 23, 2026.

Next concept: RAG and vector search

Learn next

  • Context window (Beginner): A context window is the maximum number of tokens, prompt and reply together, that a language model can take into account at one time.
  • KV cache (Intermediate): The KV cache is the stored keys and values of every earlier token, kept so a language model can generate each new token without recomputing the whole conversation.
  • Tool use and agents (Intermediate): Tool use lets a language model request that an application run a function, such as search or a calculation, and agents repeat that loop until a task is finished.