How VLMs Came Together — Wiring a Vision Encoder into an LLM
A vision-language model is three parts: a vision encoder, a projection layer, and an LLM. From the bridge CLIP built, through the three schools of connector design, to resolution strategies and the implementation constraints that bite in practice.
Learning Transferable Visual Models From Natural Language Supervision
Primary source — what this article is built on
undefined2021-02-26→undefined2026-08-135y 6mo later
Learning Transferable Visual Models From Natural Language Supervision (CLIP)Alec Radford, Jong Wook Kim, Chris Hallacy et al. · 2021-02-26 · v1arXiv:2103.00020Paper page·PDFVisual Instruction Tuning (LLaVA)arXiv:2304.08485Paper page·PDF
BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language ModelsarXiv:2301.12597Paper page·PDF
Flamingo: a Visual Language Model for Few-Shot LearningarXiv:2204.14198Paper page·PDF
undefined
State-of-the-art computer vision systems are trained to predict a fixed set of predetermined object categories. This restricted form of supervision limits their generality and usability since additional labeled data is needed to specify any other visual concept. Learning directly from raw text about images is a promising alternative which leverages a much broader source of supervision. We demonstrate that the simple pre-training task of predicting which caption goes with which image is an efficient and scalable way to learn SOTA image representations from scratch on a dataset of 400 million (image, text) pairs collected from the internet. After pre-training, natural language is used to reference learned visual concepts (or describe new ones) enabling zero-shot transfer of the model to downstream tasks. We study the performance of this approach by benchmarking on over 30 different existing computer vision datasets, spanning tasks such as OCR, action recognition in videos, geo-localization, and many types of fine-grained object classification. The model transfers non-trivially to most tasks and is often competitive with a fully supervised baseline without the need for any dataset specific training. For instance, we match the accuracy of the original ResNet-50 on ImageNet zero-shot without needing to use any of the 1.28 million training examples it was trained on. We release our code and pre-trained model weights at https://github.com/OpenAI/CLIP.
How did language models learn to "read" images?
Hand ChatGPT a photo and it will describe what's in it. Yet the LLM at its core is a machine that only processes sequences of text tokens. Image support was not achieved by rebuilding the LLM from scratch. Instead, engineers bolted on a separate part that plays the role of eyes, and converted its output into a format the LLM can read. The whole assembly is called a VLM — a Vision-Language Model.
This article explains, assuming no prior knowledge, what parts a VLM is made of, what the "projection layer" that glues them together actually does, and why the current battleground is resolution strategy.
An analogy: the foreign correspondent and the interpreter
A VLM works like a news broadcast with an interpreter. There are three people involved.
- The vision encoder is a foreign correspondent. It goes to the scene (the image) and writes detailed notes (a sequence of vectors) — but the notes are written in the correspondent's native tongue, the "language of vision"
- The projection layer (the projector) is the interpreter. It translates the correspondent's notes into words the anchor can read
- The LLM is the anchor. It reads the translated notes together with the viewer's question (the text prompt), and speaks
The crucial point: the anchor never sees the scene. Only the correspondent did, and all the anchor receives is the translated notes. A VLM's quality is the product of three factors — how observant the correspondent is, how faithful the interpreter is, and how articulate the anchor is.
The intuition: turn the image into a "foreign-language sentence"
To an LLM, input means a sequence of embedding vectors. For text, each token becomes one vector. So if we can turn an image into a sequence of vectors too, the LLM should be able to read it without distinguishing it from text — that is the single idea underlying nearly every modern VLM.
The recipe:
- Cut the image into small patches, e.g. 14×14 pixels (exactly as in a Vision Transformer)
- The vision encoder turns each patch into a vector that reflects its surrounding context
- The projection layer maps those vectors into the LLM's embedding dimension
- Splice the resulting vector sequence directly into the sequence of text tokens
From the LLM's point of view, an image is "a sentence of a few hundred foreign words it has never seen." Through training, it learns to read that foreign language.
The founding moment: CLIP built the bridge
For years, the near-default choice of bolt-on eyes was the image encoder from CLIP, published in 2021. CLIP collected a huge set of image–caption pairs and trained an image encoder and a text encoder jointly, so that embeddings of matching pairs end up close together and mismatched pairs end up far apart (contrastive learning).
"Closeness" is measured with cosine similarity.
Here is the embedding vector of image , is the embedding vector of text , the in the numerator is the dot product, and is the length of a vector. In plain words, equation (1) just measures how small the angle between two vectors is — the more the image and the caption point in the same direction, the closer the value gets to 1.
As a by-product of this training, CLIP's image encoder learned to summarize images in a form that lines up naturally with language. That is precisely why later VLMs could simply borrow this encoder, frozen, and get away with it.
Comments
Sign in to comment