TL;DR
ALIGN is a Google model from 2021 that learns images and text together from a very large, very noisy pile of web pictures and their alt-text captions. It has no hand-written labels and almost no cleaning. An image encoder and a text encoder are trained so that the right image and caption land close together, and the wrong pairings land far apart. The result is that the scale of the data makes up for its noise, and the model reaches state-of-the-art image-text retrieval and strong zero-shot classification.
Builds on: Contrastive Learning, Bi-Encoder, Zero-Shot Learning, EfficientNet, BERT · Leads to: Vision-Language Model
Why it mattered
Before ALIGN, the best vision-language pretraining sets were curated. MSCOCO needed human annotation, and Conceptual Captions needed complex filtering and post-processing, and that cost capped how big these sets could get. ALIGN showed that an image-text model could be trained on a dataset of 1.8 billion pairs, collected by a pipeline that keeps almost everything, and still beat models trained on curated data.
The same dual-encoder, same-batch contrastive loss idea became common for web-scale image-text models. It sits underneath image search, "find the photo that matches this sentence" features and zero-shot image classifiers. A reader who understands this paper can read most later vision-language papers without surprises.
The problem
Representation learning in language had moved to training on raw text with no human labels, using a masking or prediction task. Vision was still stuck on labelled datasets: ImageNet has class labels, and OpenImages has class labels too. For images paired with language, the datasets were small or expensive. Each one needed a collection process, a cleaning process, and often an expert to decide what a good caption is.
The authors' question was narrow. If you drop the cleaning and accept noise, can the sheer size of the data pay for the noise? The answer they give is yes, and the rest of the paper tests that answer.
How it works
The method has one input, a list of image-text pairs, and two outputs, an image encoder and a text encoder. Here is the path one batch takes.
flowchart LR A["Batch of N image-text pairs"] --> B["Image encoder (EfficientNet)"] A --> C["Text encoder (BERT)"] B --> D["Normalized image vectors x"] C --> E["Normalized text vectors y"] D --> F["N by N grid of similarity scores"] E --> F F --> G["Two softmax losses, one per direction"] G --> H["Update both encoders"]
-
Collect the data. Start from English alt-text: the caption a web page author wrote for an image. Keep an image if its shorter side is more than 200 pixels and its aspect ratio is under 3. Drop images with more than 1,000 captions. Remove near-duplicates of the test images. Then apply a few frequency rules to the text: drop any alt-text shared by more than 10 images (these are often boilerplate such as file names), drop captions with rare words, and drop captions shorter than 3 words or longer than 20 words. The result is about 1.8 billion English pairs. The captions are not checked for meaning.
-
Encode the image. A EfficientNet backbone turns the picture into a feature map, then global pooling averages each channel into one vector. The paper uses a fixed input size of 289 by 289 pixels, after resizing to 346 and taking a random crop during training. Pooling is covered in Global Average Pooling.
-
Encode the text. A BERT-style Transformer reads the caption as a sequence of wordpiece tokens. Wordpieces are word fragments from a vocabulary; ALIGN builds one of 100,000 entries from its own data. Captions are cut to 64 tokens. The output at the special first token, called the [CLS] token, is taken as the sentence summary.
-
Match the sizes. A linear layer, with no activation, maps the text vector to the same length as the image vector. In the main model the shared length is 1,376 for the L2 backbone; the paper shows that larger backbones want larger embeddings.
-
Normalize both vectors. Each vector is divided by its own length, so it has Euclidean length 1. Once both are unit length, their dot product is exactly the Cosine Similarity between them, which lies between minus 1 and plus 1.
-
Score every pair in the batch. Multiply every image vector by every text vector. With a batch of N pairs, this gives an N by N grid. The diagonal holds the true pairs. Every off-diagonal entry is a pair that does not match, and it serves as a negative example for free.
-
Turn scores into a decision. Divide each score by a temperature , then apply a Softmax across each row (image to text) and each column (text to image). The entry on the diagonal should get the largest probability in its row and its column.
-
Take the loss and update. The loss is the Cross-Entropy Loss for the diagonal entry, in both directions, added together. Gradients flow back into both encoders, and the temperature is learned along with everything else.
Check on the walkthrough. A batch of two pairs, where each image has the wrong caption, would put the true pair at the off-diagonal and give a high loss. The same batch with the right captions would give a low loss. The training signal is that difference, repeated across 16,384 pairs per batch in pretraining.
The math
Definition (ALIGN objective). For a batch of image-text pairs, let be the normalized image embedding of pair and the normalized text embedding of pair . The temperature scales the scores. The image-to-text loss is
and the text-to-image loss is
The total loss is the sum . Here is the dot product, which for unit vectors is the cosine similarity. The paper divides by , so a small makes the softmax sharper and a large one flattens it.
Step 2 in symbols (image encoder). The image encoder gives , and the paper normalizes it as .
Step 3 and 4 in symbols (text encoder). The text encoder gives a vector of the BERT width, and a linear map brings it to dimension : .
Step 6 and 7 in symbols. Let . Then is the average over rows of the negative log of the diagonal entry after a row-wise softmax of , and is the same for columns. This is exactly the Softmax plus cross-entropy pattern, with the true class being the matching caption.
Label smoothing. The paper also uses a label smoothing value of 0.1 in both softmax losses. This is Label Smoothing: it gives a small share of the probability to the wrong entries, so the model is never pushed all the way to probability 1. The formula above omits this term for clarity.
Learned temperature. The paper initializes to 1.0 and trains it. It reports that the learned value settles near 1/64 in the baseline it studies, and that a hand-picked fixed value could be slightly better. The authors kept the learned value because it performs competitively and removes a sweep.
Worked numbers for the walkthrough. Take and , so dividing by means multiplying by 2. If image 1 matches caption 1 and both unit vectors are and , and image 2 matches caption 2 with and , then the score grid is . The first row gives probability to the true caption, so its loss is . Both directions give the same, so the total is about 0.254. If the captions were swapped, the diagonal would score 0 and the off-diagonal 2, so the true probability is and the loss is about 2.127 per direction.
Results
The paper evaluates on image-text retrieval, zero-shot classification, fine-tuned classification and multilingual retrieval. The headline numbers below are copied from its tables.
| Setting | Benchmark | ALIGN | Comparison |
|---|---|---|---|
| Zero-shot, image to text, R@1 | Flickr30K 1K test | 88.6 | 88.0 (CLIP) |
| Zero-shot, text to image, R@1 | Flickr30K 1K test | 75.7 | 68.7 (CLIP) |
| Zero-shot, text to image, R@1 | MSCOCO 5K test | 45.6 | 37.8 (CLIP) |
| Zero-shot, top-1 | ImageNet | 76.4 | 76.2 (CLIP) |
| Frozen features, top-1 | ImageNet | 85.5 | 85.4 (CLIP ViT-L/14) |
| Fine-tuned, top-1 | ImageNet | 88.64 | 90.2 (Meta Pseudo Labels) |
R@1 means recall at one: the fraction of queries whose correct match is the top result (see Precision and Recall).
What the numbers mean. Zero-shot retrieval is where ALIGN is clearly ahead, mostly in the text-to-image direction. On ImageNet, the zero-shot result is close to CLIP's, and ALIGN does better on the ImageNet-R variant (92.2 against 88.9). After full fine-tuning on ImageNet, ALIGN is strong but not first; the paper says Meta Pseudo Labels is better because it uses a deeper interaction with the unlabelled data.
Limits. Every ALIGN number comes from a model trained on web data that the authors did not clean, so the claim is about scale compensating for noise, not about noise being harmless. The paper removes test images from training to keep evaluation fair. Zero-shot classification depends on the prompt template: the authors reuse CLIP's prompt ensemble, which added about 2.9 points of top-1 accuracy on ImageNet. The paper also reports that data size matters: at 3 million pairs, its noisy data trails the cleaned Conceptual Captions set, but at 6 million and 12 million it catches up quickly. A multilingual variant trained on 1.8 billion pairs across more than 100 languages is also reported, with a 250,000-entry vocabulary.
Reading guide
Read the paper in this order. Each section names the lessons it leans on.
- Section 1, Introduction, and Section 2, Related Work. The motivation and the contrast with curated datasets. Needs Self-Supervised Learning and Representation Learning for the vocabulary, and Word Embedding if you want the older language background.
- Section 3, A Large-Scale Noisy Image-Text Dataset. Pure data processing. Only the filters matter: image size, aspect ratio and caption count, as in step 1 above.
- Section 4.1, Pre-training on Noisy Image-Text Pairs. The core method. Needs Bi-Encoder, Contrastive Learning, Softmax, Softmax Temperature and Vector Norm. Read the two loss equations with the worked numbers beside them.
- Section 4.2 and 4.3, Transfer to retrieval and to classification. How the frozen model is used. Needs Zero-Shot Learning, Transfer Learning and Fine-Tuning.
- Section 5, Experiments and Results. The tables above. Needs Precision and Recall for the metrics and Convolutional Neural Network for what the EfficientNet backbone is.
- Section 6, Ablation Study. Backbone sizes, batch negatives and temperature. Needs EfficientNet, BERT and Softmax Temperature.
- Sections 7 to 10. Embedding analysis, the multilingual model, and a discussion of social impact and limits. Needs Vision-Language Model for the shared space.
Check yourself
QuestionIn one sentence, what does ALIGN use instead of human-curated labels, and what is the trade-off it accepts?Show answer
It uses about 1.8 billion alt-text captions from the web, with only minimal frequency-based filtering. The trade-off is noisier captions. The paper's claim is that the scale of the data makes up for that noise.
QuestionFor a batch of N pairs, how many negative pairs does a single positive pair get in the softmax, and why is that useful?Show answer
Each positive pair is compared with the other captions (or images) in the batch, so it gets negatives. The negatives come for free from the batch and grow with batch size, which makes the softmax a harder and more informative task.
QuestionTake the worked numbers in the Math section. If were changed from 0.5 to 1 with the same unit vectors, what would the true-pair probability in the first row become?Show answer
With the row is , so the probability of the true caption is . The probability is lower than the 0.881 at because the larger temperature flattens the softmax.
QuestionWhy does the paper normalize the image and text embeddings before the dot product?Show answer
Normalizing makes each vector unit length, so the dot product equals the cosine similarity and depends only on the angle. The temperature then becomes the only scale on the scores, which keeps the loss stable and lets the temperature be learned.
QuestionA new team wants to build an image search for a product catalogue of 50,000 curated photos with clean titles. Would they need ALIGN's approach, and why or why not?Show answer
Probably not as a first step. ALIGN's advantage is scale: it wins by using a dataset far larger than any curated set. With 50,000 clean pairs, a smaller pretrained model fine-tuned on their own data, or a pretrained model used zero-shot, is the cheaper and more reliable choice. The dual-encoder design still applies if they want the same architecture.
Sources
- ALIGN: Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision, arXiv:2102.05918 (https://arxiv.org/abs/2102.05918)
- DOI 10.48550/arXiv.2102.05918 (https://doi.org/10.48550/arXiv.2102.05918)