How language models read images
To a multimodal model, a picture is a grid of patches. How images become tokens, what they cost, why small text gets misread, and how to send better screenshots.
2 min readPart 13 of 21
On this page
A language model works on tokens. To let it look at a picture, the picture is turned into something it can handle like tokens. The idea was shown in a 2020 paper whose title says it all: An Image is Worth 16x16 Words.
From picture to patches
- 1ResizeShrink it if it’s over the limit
- 2CutDivide it into small square patches
- 3ConvertTurn each patch into a list of numbers
- 4ReadProcess patches alongside the words
The 2020 paper cut images into squares of 16 × 16 pixels, converted each into a list of numbers and fed the sequence to a standard transformer, the same design used for text. Trained on large amounts of data, it matched or beat the specialized image networks of the time, using far less computing to train.
Models that take both images and text put both kinds of token in one sequence. No one first writes a description of the picture for the model to read. The patches go in directly.
What an image costs
Images are billed as tokens, so the calculation is public. Anthropic's documentation says Claude uses patches of 28 × 28 pixels, and the cost is the width divided by 28, rounded up, times the height divided by 28, rounded up:
python3 -c "from math import ceilfor w, h in [(200, 200), (1000, 1000), (1092, 1092)]: print(w, h, ceil(w / 28) * ceil(h / 28))"200 200 641000 1000 12961092 1092 1521A 1000 × 1000 picture costs 1,296 tokens, about as much as 970 words of English by OpenAI's rule of thumb. OpenAI's models use patches or tiles, depending on the model, with their own rules. Other providers have theirs.
Images stay in the conversation, so like text they count toward the context window with every message.
Why it misreads small text
Look at the last row of the table. On the standard tier, a 3840 × 2160 screenshot costs no more than a 1920 × 1080 one, because it's first shrunk to 1456 × 819. Whatever was small in it becomes very small:
When the detail isn't there, a model doesn't see a blur the way you do. It continues with what's plausible, the same mechanism behind hallucinations. That's why a misread number usually looks like a perfectly reasonable number.
Other weak points follow from the same design:
- Exact positions and sizes. Patches are coarse, so "which bar is slightly taller?" is hard.
- Counting many similar things. Objects span patches and patches hold several objects.
- Text that's rotated or hidden. It looks unlike the text it has learned from.
Sending better images
- Crop to what matters. The most effective step: more of the limited pixels go to what you're asking about.
- Split a long screenshot into several parts instead of sending one tall image.
- Send text as text if you can copy it. It's cheaper and exact.
- Ask it to quote first. "Copy out the numbers in the table, then answer" shows you whether it read them correctly.
- Check numbers that matter against the original.
And remove what you don't want seen. A screenshot often includes notifications, tabs, names and addresses beyond the part you had in mind.