- Introduced by
- Lu et al. (ViLBERT); Radford et al. (CLIP)
- Year
- 2019–2021
- Type
- Cross-modal attention-based deep learning model
- Family
- Deep learning / NLP / CV
What does it do?
A Multimodal Transformer extends the Transformer architecture to process and jointly represent two or more input modalities, most commonly text and images, and in some designs audio, video, or structured data.
Models differ in how the modalities interact: some use cross-attention between modality streams, as in ViLBERT, while others, such as CLIP, encode each modality separately and align the resulting embeddings with a contrastive objective. These models are applied to tasks such as visual question answering, image captioning, multimodal sentiment analysis, and cross-modal retrieval.
The intuition behind the method
A text-only Transformer relates words to one another through self-attention. A Multimodal Transformer applies the same mechanism to tokens from several modalities, for example word tokens and image patch tokens. In co-attention designs, tokens from one modality can attend to tokens from the other, so a word representation can be shaped by relevant image regions and the reverse. In contrastive designs, the image and the text are encoded separately and trained so that matching pairs receive similar embeddings in a shared space. Pretraining on large paired datasets, such as image-caption pairs, teaches these associations statistically, and the resulting joint representation is then adapted to a specific downstream task. Because the learned associations reflect what co-occurs in the training data, they are not guaranteed to capture meaning.
History
The multimodal Transformer line began around 2019, when ViLBERT (Lu et al., 2019) adapted BERT-style pretraining to paired vision-language data. OpenAI's CLIP (Radford et al., 2021) showed that contrastive pretraining on 400 million image-text pairs supports zero-shot transfer. Later models, including BLIP, FLAVA, Flamingo, and GPT-4V, are widely used vision-language systems.
When to use it
Use a Multimodal Transformer when your research question inherently spans two or more modalities, for example predicting sentiment from both text and facial images, answering questions about images, generating image captions, or retrieving images from text queries. It is a reasonable choice when a pretrained multimodal backbone (CLIP, BLIP, FLAVA) can be adapted to your domain. Do not use it when data from all required modalities is not available for the same instances, when compute resources are limited (these models are large), or when a simpler unimodal model achieves satisfactory performance. Small datasets without pretrained initialisation rarely yield good results.
Limitations and considerations
- Pretraining and fine-tuning require paired data in which each instance has all of its modalities, and collecting and annotating such data is costly.
- Large model sizes demand substantial GPU memory and compute, which restricts training from scratch to well-resourced groups.
- Performance can degrade when one modality is missing or noisy at inference, because the model is trained to combine both streams.
- Cross-modal attention and contrastive alignment learn correlations from the training data, so spurious co-occurrences (for example, background content that accompanies a label) can be learned as if they were meaningful cues.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Pretrained multimodal backbones such as CLIP, BLIP, and FLAVA can be adapted to downstream tasks with comparatively few labelled examples, which is the main practical reason to start from them.
- Cross-attention layers make the interaction between modalities explicit in the architecture, and attention weights can be inspected to see which image tokens a word attends to; these weights aid analysis but do not fully explain the model's decisions.
- Contrastive pretraining, as in CLIP, produces a shared image-text embedding space that supports zero-shot classification and retrieval without task-specific training.
- One pretrained backbone can serve several tasks, such as captioning, question answering, and retrieval, by changing the output head, although task-specific fine-tuning is usually still required.
Applications
- Visual question answering (VQA): answering natural-language questions about images.
- Image captioning: generating descriptive text for photographs or figures.
- Multimodal sentiment analysis: combining text, audio, and facial cues to classify emotion.
- Cross-modal retrieval: finding relevant images given a text query or vice versa.
- Medical imaging with clinical report text, where paired institutional data are available; any clinical use requires separate validation.
- Video understanding: aligning speech transcripts with video frames for action recognition or summarisation.
How it works
How it works
Each modality is first passed through a modality-specific encoder. Text is tokenised and embedded; images are split into patches (following ViT) or processed through a CNN and projected into the same embedding space. The resulting sequences of feature vectors serve as the input tokens for the transformer layers.
In co-attention designs such as ViLBERT (Lu et al., 2019), each modality is processed in its own stream, and cross-attention layers take queries from the stream being updated and keys and values from the other stream. Tokens in one modality are therefore updated using information from the other; for example, word tokens can attend to image-region tokens while a sentence is being processed. The formula shown is standard scaled dot-product attention, in which d_k is the dimension of the key vectors and the 1/sqrt(d_k) factor keeps the dot products in a range suitable for the softmax. Q, K and V are the linear projections of the input tokens that supply the queries, keys and values in a given layer. CLIP (Radford et al., 2021) has no cross-attention between modalities: its image and text encoders run separately, and interaction occurs only when their output embeddings are compared through the contrastive loss. Other designs concatenate tokens from all modalities into a single stream in which they attend to one another.
Formula
\text{Attention}(Q,K,V) = \text{softmax}\!\left(\frac{QK^{T}}{\sqrt{d_k}}\right)VAfter one or more rounds of cross-modal attention, the representations from different modalities are fused, by concatenation, pooling, or a learned fusion head, into a joint embedding that captures both modality-specific and cross-modal information. Dual-encoder designs such as CLIP may have no fusion stage; comparison happens at the level of the output embeddings.
Multimodal transformers are typically pretrained on large paired datasets with objectives such as masked language modelling conditioned on image context, masked region prediction, image-text matching, and contrastive alignment. CLIP uses the contrastive objective alone, aligning image and text embeddings in a shared space.
After pretraining, the model is fine-tuned on the target downstream task (visual question answering, image captioning, multimodal classification, or cross-modal retrieval), usually by adding a lightweight task-specific head and training on labelled examples with a small learning rate.
Common pitfalls
- Fine-tuning all layers on a small labelled set can overwrite pretrained representations; freezing lower layers or using a small learning rate limits this.
- Assuming that unimodal performance transfers to the joint model. A text-only classifier's accuracy does not show how the multimodal model uses the image, so evaluate with each modality removed.
- Letting one modality dominate the training loss, so that the model effectively ignores the weaker modality. Check per-modality performance, not only the joint score.
- Evaluating only on in-distribution test sets without testing robustness when a modality is missing or degraded.
- Reporting a single averaged metric, which can hide failures on particular modality combinations or subgroups.
Frequently asked questions
Do I need to train a Multimodal Transformer from scratch?
Rarely. Pretrained multimodal backbones such as CLIP, BLIP, or FLAVA are available and fine-tune well on downstream tasks with far less data and compute than training from scratch. Training from scratch is only warranted for highly specialised domains where public pretraining data is inadequate.
How does a Multimodal Transformer differ from a standard Transformer?
A standard Transformer operates on a single token sequence (text or images). A Multimodal Transformer introduces cross-attention layers or concatenates token sequences from multiple modalities, allowing representations from one modality to be conditioned on the other. This joint representation captures cross-modal semantics that unimodal models cannot.
What if I only have a small paired dataset?
Start from a pretrained multimodal backbone and fine-tune with a very small learning rate, freezing the lower layers. Few-shot or zero-shot use of CLIP-style models may work with very few labelled examples, but this depends strongly on the task. Zero-shot accuracy can be sensitive to how class names and text prompts are worded, so compare several prompt formulations and report the spread. Validate on a held-out labelled set of adequate size, because estimates from very small validation sets are unstable. If paired data is extremely scarce, consider weaker supervision strategies or data augmentation.
How do I handle missing modalities at inference time?
Common strategies include replacing missing modality features with learned mask tokens, using modality dropout during training so the model learns robust single-modality representations, or training separate unimodal fallback heads that activate when a modality is absent.
Which pretrained backbone should I start with?
CLIP (Radford et al., 2021) is well suited to image-text contrastive tasks and zero-shot classification. BLIP and BLIP-2 are commonly used for captioning and VQA. For a unified architecture across many tasks, FLAVA or instruction-tuned models such as InstructBLIP and LLaVA are options to consider; the right choice depends on the task and on available compute.
Related methods
Sources
Lu, J., Batra, D., Parikh, D., & Lee, S. (2019). ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. Advances in Neural Information Processing Systems (NeurIPS), 32.
Open publication referenceRadford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., ... & Sutskever, I. (2021). Learning Transferable Visual Models From Natural Language Supervision. Proceedings of the 38th International Conference on Machine Learning (ICML), PMLR 139.
Open publication referenceArtificial Intelligence Tools in Qualitative Research II, p. 210