Building on the previous post's introduction to the Transformer architecture, its core components, and how it jointly performs alignment and representation learning on unimodal text data, this post examines how multimodal Transformers extend these ideas to jointly model language and vision.
Real-world communication rarely comes from text alone. Take a video, for example. It combines spoken or written language, facial and gestural visual cues, and acoustic tone of voice. That raises the question of how to build contextualized representations that draw on more than one modality at once. Two broad strategies show up here:
The simplest approach concatenates tokens from all modalities into a single sequence and runs that through a shared self-attention stack, letting cross-modal relationships emerge implicitly from self-attention.


Rather than concatenating everything into one sequence, this option keeps modalities separate and contextualize each other through dedicated cross-modal attention blocks.
Multimodal Transformer (MulT) introduced a crossmodal attention module. When modeling the information flowing from modality $B$ into modality $A$, the queries come from $A$ while the keys and values come from $B$.
A scaled dot-product attention between the queries and keys produces crossmodal attention weights, which are then used to pull correlated information out of $B$'s values. The output is combined with a residual connection from $A$ to produce a $B$-contextualized representation of $A$, such as a visually-contextualized representation of language.

Several follow-up works include:
[CLS] token prepended to the text sequence before entering the model and can be used for downstream multimodal classification tasks.

A different way to combine modalities treats one modality as primary and the others as secondary, and shifts the primary representation through the signals from the secondary modalities. In a language example, where language is the primary modality while acoustic and visual signals are the secondary modalities, a gate applied to the secondary modalities determines how much to shift the primary representation, so the same word: "expectations", for instance, can end up closer to a negative-shifted or a positive-shifted representation depending on the accompanying nonverbal cues.
MAG-BERT (MAG + BERT) pushed this idea inside BERT with its Multimodal Adaptation Gate (MAG). At each token position, the language, acoustic, and visual features are passed through the MAG to derive the non-verbal cues that shift the language representation, conditioned on the acoustic and visual modalities. The shifting is performed by adding a non-verbal displacement vector $H$ to the original language representation, where the displacement vector $H$ is defined as follows:
"A vector with trajectory and magnitude that shifts the language-only position of the word to the new position in light of nonverbal behaviors."
The following describes how the Multimodal Adaptation Gate (MAG) works:
Let $Z_i$, $A_i$, and $V_i$ denote the $i$th language, acoustic, and visual input, respectively. Concating $Z_i$ with $A_i$ and $V_i$, respectively, gives two gating vectors $g^a_i$ and $ g^v_i $as follows: $$\begin{align*} g^a_i &= R(W_{ga}[Z_i;A_i] + b_a) \\ g^v_i &= R(W_{gv}[Z_i;V_i] + b_v)\end{align*}$$ where $R(x)$ is a non-linear activation function, $W_{ga}$ and $W_{gv}$ are linear layer weights, and $b_a$ and $b_v$ are linear layer biases. Then, a non-verbal displacement $H_i$ is defined as: $$H_i = g^a_i \otimes (W_aA_i) + g^v_i \otimes (W_vV_i) + b_{H}$$
where $W_a$ and $W_v$ are linear layer weights, $b_H$ is the bias, and $\otimes$ represents elementwise multiplication.
Finally, the nonverbal displacement $H_i$ is added to $Z_i$ to perform modality-shifting: $$\begin{align*}Z_i &= Z_i + \alpha H_i\\ \alpha &= \min \left( \frac{\|Z_i\|_2}{\|H_i\|_2} \beta, 1 \right) \end{align*}$$ where $\beta$ is a hyperparameter, and $\|\cdot\|_2$ denotes the $L_2$ norm function. The scaling factor $\alpha$ can be viewed as controlling the effect of the non-verbal shift $H_i$ by limiting it to no greater than one.


Transformers are the most widely-used architecture for learning contextualized representations. Through the attention mechanism, they jointly perform alignment and representation learning on multimodal data.
By concatenating unimodal embeddings from different modalities and passing them through a shared self-attention layer, cross-modal relationships emerge implicitly in the resulting representations.
Instead of implicitly contextualizing information across modalities, Pairwise Cross-Modal Attention explicitly allows information to flow in both directions by letting each modality alternately serve as the query, while the other as the keys and values in dedicated cross-modal attention blocks.
Unlike "Modality Concatenation" and "Pairwise Cross-Modal Attention", Modality Shifting uses a gating mechanism to shift the primary modality's representation based on cross-modal information with the secondary modalities. This achieves attention-like modulation on the primary modality without performing self-attention.