Understand AI in 10 minutes

Vision language models: how AI reads pictures

A vision language model is a language model that can also read pictures. What it can do, how pictures become tokens and where it gets things wrong – with two real models to try.

  • #VLM
  • #Multimodal
  • #Basics
Reading mode

TL;DR: A vision language model (VLM) is a language model that can also read pictures: picture and question in, text out. The picture is cut into small pieces that become tokens, and the language model reads them like words. That is how a VLM describes scenes, reads text, finds objects and answers questions about a picture. It also gets things wrong in its own particular ways.

For everyone

A language model with eyes

A language model like the one in What is a language model? only knows text. A vision language model combines it with computer vision: it gets a picture and a question and answers in text. If you have ever shown ChatGPT, Gemini or Claude a photo, you have used a VLM.

What these models can do:

  • Describe scenes: "A red car drives past a house."
  • Answer questions about a picture (visual question answering): "How much is the croissant?"
  • Read text (OCR): signs, receipts, screenshots.
  • Understand documents and charts: which month had the most visitors?
  • Find objects (object detection): a box around every car, every cat.
  • Point to what you mean (grounding): you say "the yellow sign", and the model draws a box around it.

Try it yourself. Two small VLMs run right in your browser: Florence-2 for fixed tasks with boxes, and SmolVLM for free questions. Your photo never leaves your device.

🧪Interactive demo (needs JavaScript)

How the picture gets into the model

A text model splits your question into tokens and turns each token into a vector, a list of numbers. A VLM does almost the same with the picture. It cuts the picture into small squares called patches; in SmolVLM they are 16 × 16 pixels. A separate network, the vision encoder, turns the patches into vectors. A small translator, the projector, brings them into the language model's "language". After that they simply sit in front of the question's tokens, and the same transformer reads both together. How a transformer reads is explained in Transformers: the brain of modern AI.

Pictures are expensive. SmolVLM turns a 512 × 512 pixel section into 64 tokens. To read small print, it cuts a picture into tiles: for the receipt in the lab that is 13 tiles, or 832 image tokens – for a question of about a dozen tokens. More tiles mean more detail, but also more compute.

Where VLMs get it wrong

The lab shows the typical mistakes too:

  • They make things up. Ask SmolVLM whether there is a dog in the street scene, and it says "Yes". Asked for "a dog", Florence-2 draws a box – around the car. The longer the description, the more it invents.
  • Counting and charts are hard. Without tiles, SmolVLM names the wrong month, reads the yellow sign wrong and counts two trees where there is one.
  • Small or unusual print goes wrong: "0.5 l" becomes "0.5 1".
  • Bias from the training data can show up in the answers, IBM warns.

Large models make these mistakes less often, but not never. If you let a VLM read invoices or forms, check the result.

For nerds

Three building blocks

Most VLMs have three parts (Hugging Face):

  1. an image encoder, usually a vision transformer (ViT) that cuts the picture into patches and mixes them with self-attention – often CLIP or SigLIP,
  2. a projector, often a small MLP, that maps the image vectors to the width of the text embeddings,
  3. a text decoder, an ordinary language model.

There are variants. Llama 3.2 Vision and NVLM-X don't put the image vectors into the sequence; they read them in their own layers via cross-attention. Fuyu-8B has no image encoder at all and projects the patches directly. Florence-2 is an encoder-decoder that outputs coordinates as tokens.

The two models in the lab

  • SmolVLM-256M (Hugging Face, Apache-2.0): a SigLIP encoder with 16-pixel patches on 512-pixel tiles, so 32 × 32 = 1,024 patches per tile. A pixel shuffle merges every 4 × 4 patches into one token: 64 tokens per tile. Behind it, the small language model SmolLM2 reads.
  • Florence-2-base (Microsoft, MIT licence): squeezes every picture to 768 × 768 pixels. Its DaViT encoder shrinks it by a factor of 32 to 24 × 24 regions, plus one averaged vector for the whole picture: 577 image features. Boxes come out as location tokens: a red car<loc_310><loc_662><loc_591><loc_872> are two corners on a grid from 0 to 999. So object detection, too, is next-token prediction here.

Training

The groundwork was CLIP by OpenAI: an image encoder and a text encoder learn from 400 million image-text pairs from the web to pull matching pairs together in a shared vector space and push the others apart. This is called contrastive learning (IBM). Other methods hide parts of the picture or text and have the model reconstruct them, FLAVA for example.

Training a VLM from scratch is expensive, so most connect ready-made parts, like LLaVA: a CLIP encoder plus the Vicuna language model. In stage 1 both stay frozen and only the projector learns. In stage 2 the language model learns too, on picture, question and answer data. Hugging Face calls this the most common way. KOSMOS-2, by contrast, was trained end to end, which costs much more compute.

Measuring and models

VLMs are compared on benchmarks such as MMMU (11,500 college-level questions), MMBench (3,000 multiple-choice questions on 20 skills), OCRBench or MathVista, collected for example in the Open VLM Leaderboard. In the Vision Arena, people vote on the better answers. Open model families include Qwen-VL, Llama 3.2 Vision, DeepSeek-VL2, SmolVLM and Florence-2; closed ones are GPT-4o, Gemini and Claude.

Image generators, by the way, are a different model family (diffusion models): they turn text into pictures, not pictures into text.

And agents?

VLMs give agents eyes. According to IBM, Qwen 2.5-VL can navigate desktop and smartphone interfaces. More on the agent loop: Understanding agents.

Sources