# The Path to Multimodal Unification: Vision Transformer Guide

> This article provides a systematic introduction to Vision Transformer fundamentals and explores how multimodal large language models achieve unification through three key stages: module independence, module sharing, and paradigm unification. It offers a clear roadmap of how Transformer architecture is driving the convergence of vision and language models.

- Source: https://www.waytoagi.com/en/kb/learning-path/multimodal-unification-path
- Original (Feishu, Chinese): https://waytoagi.feishu.cn/wiki/ReVzwZUr0ivgWfkaQ91cXrYUnoh
- Updated: 2026-12-02

---

> Author: Xiao A, aaronxic, [Zhihu Profile](https://www.zhihu.com/people/aaronxic)
>
> Publication Date: July 8, 2023
>
> Original Article: https://zhuanlan.zhihu.com/p/643969218
![](https://www.waytoagi.com/api/kb-media/NLJ6bsZ1GodlXwx4U2zcFd7rnGb)


# **Introduction**

Hello everyone, I’m Xiao A. In the previous articles, we explored how the Transformer is applied in the field of large language models (LLMs). Starting from this article, we will enter the realm of multimodal learning and examine how multimodal models are gradually moving toward unification through the Transformer architecture.

The outline is as follows, consisting of 5 chapters:

- First, we introduce the fundamentals of Vision Transformer and its related applications, covering [ViT (2020.10)](https://arxiv.org/abs/2010.11929), [ViT-22B (2023.02)](https://arxiv.org/abs/2302.05442), [Swin Transformer (2021.08)](https://arxiv.org/abs/2103.14030), [MAE (2021.11)](https://arxiv.org/abs/2111.06377), [BEiT (2021.06)](https://arxiv.org/abs/2106.08254), [BEiT v2 (2022.08)](https://arxiv.org/abs/2208.06366), [TimeSformer (2021.02)](https://arxiv.org/abs/2102.05095), and [BEVFormer (2022.03)](https://arxiv.org/abs/2203.17270).

- Next, we cover multimodal tasks, training and evaluation datasets, and evaluation methods. This includes Video Action Recognition, Image-Text Retrieval, Image Captioning, Visual Question Answering (VQA), Visual Reasoning, and Visual Entailment tasks.

- We then begin discussing Stage 1 of multimodal unification — **modular independence**. Starting from the complexity relationships among the Text Encoder (TE), Vision Encoder (VE), and Multimodal Interaction (MI) modules, we examine four types of network architectures, including [SCAN (2018.03)](https://arxiv.org/abs/1803.08024), [CLIP (2021.02)](https://arxiv.org/abs/2103.00020), [FLIP (2022.12)](https://arxiv.org/abs/2212.00794), [ViLT (2021.02)](https://arxiv.org/abs/2102.03334), [ALBEF (2021.07)](https://arxiv.org/abs/2107.07651), and [CoCa (2022.08)](https://arxiv.org/abs/2205.01917).

- We continue with Stage 2 of multimodal unification — **module sharing**. [VLMO (2021.11)](https://arxiv.org/abs/2111.02358) pioneered the approach of sharing Transformer blocks across the TE, VE, and MI modules, inspiring subsequent works such as [BLIP (2022.01)](https://arxiv.org/abs/2201.12086), [BEiT v3 (2022.08)](https://arxiv.org/abs/2208.10442), and [BLIP-2 (2023.01)](https://arxiv.org/abs/2301.12597).

- Finally, we introduce Stage 3 of multimodal unification — **paradigm unification**. This remains a rapidly evolving direction. From a personal perspective, we discuss the paradigm unification approaches of [Pixel2Seq (2021.09)](https://arxiv.org/abs/2109.10852) and [Unified-IO (2022.06)](https://arxiv.org/abs/2206.08916).


# **Vision Transformer Fundamentals**

The first step toward multimodal unification is architectural unification. Therefore, understanding how to apply the Transformer to traditional computer vision (CV) tasks becomes particularly important. In the following section, we will explore how the Transformer replaces CNNs as the backbone network for vision tasks.

**ViT**

Recall that in NLP, text is converted into a token sequence through the tokenization process. So what is the corresponding tokenization process in vision? A simple and intuitive idea is to split the image into patches. The process is as follows:

![](https://www.waytoagi.com/api/kb-media/Ymmqbcm9QoxZMoxQmX1cuX2GnKe)

- Input a 224 × 224 image and divide it into 16 × 16 pixel patches. This results in a 14 × 14 grid. Since the original input is an RGB image with 3 channels, each patch becomes a 16 × 16 × 3 = 768-dimensional feature.

- Mathematically, given an image \( x \in \mathbb{R}^{H \times W \times C} \), we split it along the height and width into \( N \) patches of size \( P \times P \), where \( N = HW / P^2 \). The final input becomes \( x_p \in \mathbb{R}^{N \times (P^2 \cdot C)} \).

- In this way, \( N = 196 \) becomes analogous to the sequence length in NLP.

- This patching can be implemented either by reshaping and transposing the raw pixels, or by using a convolution with \( s=16 \) and \( k=16 \). A learnable projection is also introduced in the process.

```python
Conv2d(3, 768, kernel_size=(16, 16), stride=(16, 16))
```

**CLS Token**: In addition, to facilitate downstream global tasks (such as image classification), a learnable `CLS token` is added and placed at the beginning of the sequence, making the total sequence length 197. The output corresponding to the `CLS token` can then be used to aggregate global information for downstream classification tasks.

**PE**: Since the Transformer itself is position-agnostic, position information must be encoded. ViT introduces learnable absolute position encodings (learnable absolute PE). In the example shown above, the image is divided into 9 patches plus one `CLS token`, resulting in 10 learnable position encodings.

**Network Structure**: All patch tokens can attend to each other, so a standard pre-norm encoder structure is used.

## **ViT-22B**

On the NLP side, models can be scaled up to 175B parameters. Can ViT be scaled just as easily? It turns out it’s not that straightforward. [ViT-22B](https://arxiv.org/abs/2302.05442) made three key modifications to successfully scale the model to 22B parameters, as shown below:

- An additional LayerNorm is added before the query and key to prevent training instability. In the figure below, the green line shows the version with the preceding LayerNorm, while the red line shows the version without it.

- The MHA and FFN are parallelized. This increases parallelism and reduces training time.

- The bias terms in the input projection and after the LayerNorm are removed.

![](https://www.waytoagi.com/api/kb-media/WMMpbpyppovw0FxHtqbcUalcnOg)

The improved Transformer block is shown below:

![](https://www.waytoagi.com/api/kb-media/JcF7bsWP8ojC99xtvAkcvW7lnO1)

A complete parameter count comparison is shown below:

> 📊 This is an embedded Feishu content (table/chart, etc.). [View the full version in the Feishu knowledge base](https://waytoagi.feishu.cn/wiki/ReVzwZUr0ivgWfkaQ91cXrYUnoh)

The parameter calculation formula can be found in this series’ article [(2) A First Look at LLM Foundation Models](https://ywh1bkansf.feishu.cn/wiki/UU9pwtOFtiKIqAkQiSVc3Zdun7e).

\#Param = (4D² + 2DM) · L

PS: ViT-G and ViT-e are from [[Paper 1](https://arxiv.org/abs/2106.04560)] and [[Paper 2](https://arxiv.org/abs/2209.06794)] respectively.

**Swin Transformer**

As we learned from the previous section, the sequence length of ViT is directly proportional to the image resolution. Since the computational complexity of the Transformer architecture grows quadratically with sequence length, when the resolution of downstream tasks increases linearly, the computational complexity of ViT grows quadratically, resulting in a significant drop in computational efficiency.

How to decouple resolution from computational cost became the core problem that Swin Transformer needed to solve. This is achieved through three key processes:

- **Intra-window information exchange**: Divide the image into non-overlapping windows and perform self-attention within each window to enable complete information exchange inside the window.
- **Inter-adjacent-window information exchange**: Use a shifted window approach to enable information exchange between neighboring windows.
- **Long-range window information exchange**: Merge windows to increase the receptive field, allowing windows that are farther apart to exchange information.

The following sections explain the processing pipeline of Swin Transformer in detail.

**Network Overview**

Using the diagram from [this article](https://zhuanlan.zhihu.com/p/507105020), the overall network is divided into 4 stages, each consisting of multiple blocks. The number of blocks in each stage is 2-2-6-2 respectively.

![](https://www.waytoagi.com/api/kb-media/VDQqbnY1aoVbGtxNP6vcv78ynTc)

**Intra-window Information Exchange**

First, the original input image of size (224, 224, 3) is divided into 4×4 patches, with the feature dimension mapped to 96. After the first layer, the tensor size becomes (224/4, 224/4, 96) = (56, 56, 96).

Unlike ViT, which directly feeds the 56×56 = 3136 tokens into the Transformer via W-MSA, Swin’s SW-MSA further divides the feature map into windows of size 7×7. This produces 8×8 = 64 windows, each containing 7×7 = 49 patches. The output tensor shape is (64, 49, 96).

In this way, 64 independent sequences of shape (49, 96) each perform self-attention separately, achieving full information exchange within each patch window. After computation, the features are reshaped back to (56, 56, 96).

The diagram below illustrates an example where 4×4 patches form one window. In practice, each window consists of 7×7 patches.

![](https://www.waytoagi.com/api/kb-media/Y3PLbkzaZo16RVxIEP3cqd02nxf)

From the article [A First Look at LLM Backbone Models](https://ywh1bkansf.feishu.cn/wiki/UU9pwtOFtiKIqAkQiSVc3Zdun7e), we know that the computational complexity formula for ViT is:

\#Flops = 4LD² + 2L²D

Therefore, the computational cost of W-MSA is:

Ω(W-MSA) = 4(hw)D² + 2(hw)²D

SW-MSA divides the input feature map of size h×w into multiple M×M patch windows. Its computational cost becomes:

\begin{align}
Ω(\text{SW-MSA}) &= (4MD^2 + 2M^4D) \cdot \frac{h}{M} \cdot \frac{w}{M} \\
&= 4(hw)D^2 + 2M^2(hw)D
\end{align}

It can be seen that the computational complexity is reduced from O((hw)²) in W-MSA to O(hw) in SW-MSA.

**Inter-adjacent-window Information Exchange**

While the above design effectively reduces computational cost, it also creates information isolation between windows — pixels in different windows can never interact with each other. One solution is to shift the patch windows. As shown below, the windows are cyclically shifted by half a window to the right and downward, resulting in 9 new windows.

After this operation, pixel P can exchange information with pixels in the upper-left window in Layer L. In Layer L+1, it can then interact with pixels in window 0, preventing information blockage.

![](https://www.waytoagi.com/api/kb-media/XM0fblsJYof1UlxL6agc5ok7nWg)

However, it is easy to see that a naive implementation of the above process would increase computational complexity, as the number of windows grows from 4 to 9. A practical solution is to merge the corner windows together and use a mask to ensure that information isolation remains exactly equivalent to the pre-merge state. Specifically, windows (0), (1, 2), (3, 6), and (4, 5, 7, 8) are merged via the shift operation to form 4 new windows.

```python
shift_size = window_size // 2
shift_windows = torch.roll(shift_windows, shifts=(shift_size, shift_size), dims=(1, 2))
```

As shown below:

![](https://www.waytoagi.com/api/kb-media/UriXbkUrAoj5blx1xekcEmOvn4g)

The way the mask is added is very clever. Yellow represents areas that are masked (i.e., information exchange is prohibited). You can try to derive it yourself.

- **Hint 1**: Flatten the pixels inside each window from left to right and top to bottom into a long vector. The row and column indices of this vector represent the window mask.

- **Hint 2**: Ensure that pixels within the same number can interact with each other, while pixels belonging to different numbers must be blocked by the yellow mask.

Note that after performing the masked attention, simply call `torch.roll` to shift the features back to their original positions.

**Long-range Information Exchange Between Windows**

Window-level interaction and adjacent-window shifting alone are not enough, as they cannot achieve long-distance information exchange. Similar to how CNNs stack stages to increase the receptive field, Swin Transformer also introduces a multi-stage design. Between stages, windows are merged and feature dimensions are expanded. This module is called the **Merging** module in the code.

This process is similar to a `spatial_to_depth` operation: spatial resolution is halved while the feature dimension increases.

```python
input_feature: (1, 56, 56, 96)
(1, 56, 56, 96) -> (1, 28, 28, 96)*4 -> (1, 28, 28, 384)

input_feature_0 = input_feature[:, 0::2, 0::2, :]
input_feature_1 = input_feature[:, 1::2, 0::2, :]
input_feature_2 = input_feature[:, 0::2, 1::2, :]
input_feature_3 = input_feature[:, 1::2, 1::2, :]
input_feature = torch.cat([input_feature_0, input_feature_1, input_feature_2, input_feature_3], -1)
```

At this point, Swin Transformer has designed three types of information exchange mechanisms — intra-window, adjacent-window, and long-range inter-window — achieving a significant reduction in computational cost while ensuring information can flow freely.

## **MAE**

After gaining a basic understanding of Vision Transformers, let’s look at several important applications to further expand our knowledge of how ViTs are used in practice.

One notable example is unsupervised pre-training using **[MAE](https://arxiv.org/abs/2111.06377)** (Masked Autoencoders), as shown below.

![](https://www.waytoagi.com/api/kb-media/NiSzb2oFPoOi79xByFCc7N4JnAb)

- MAE formulates the problem similarly to BERT’s cloze task, treating image patches as the objects for “visual cloze.”

- The overall architecture is an encoder-decoder Transformer structure. Note, however, that the decoder does **not** use cross-attention.

- **Encoder**: Randomly masks up to 75% of the patches and feeds only the remaining visible patches into a ViT-like encoder.

- **Decoder**: Learnable `[MASK]` tokens are used to represent the previously masked patches. These are concatenated with the encoded visible patches from the encoder, reordered, and then fed into the decoder for full self-attention. The decoder’s output reconstructs the pixel values of each patch — specifically, predicting 16×16×3 = 768 values per patch.

- Finally, the reconstructed pixels are compared with the original input image using mean squared error (MSE) loss for supervision.

One of the key advantages of MAE is its fast training speed, due to two main reasons:

- The encoder only processes the unmasked patches, reducing the sequence length to about 1/4 of the original.

- Although the decoder needs to process all patch positions, it is an order of magnitude smaller than the encoder, making it very efficient to use.

## **BEiT**

Unlike MAE, which uses raw pixel-level patches as reconstruction targets, BEiT reconstructs abstract vision tokens as its target, as shown below:

![](https://www.waytoagi.com/api/kb-media/LLTubtBiZoj5O9xBR2xc3L2WnKk)

- The reconstruction target vision tokens are taken directly from the codebook openly released in the DALL·E paper. This codebook was learned through dVAE reconstruction training. The training method of dVAE will be covered in the next article *AIGC Composition Principles*.

- In addition to the different reconstruction target, BEiT’s network consists solely of an Encoder. The masked patches are directly replaced with a learnable `[M] token`.

PS: BEiTv2 uses a VQ-VAE approach to reconstruct the teacher’s features (e.g., CLIP), ultimately producing a codebook of vision tokens for each patch. The training method of VQ-VAE will also be introduced in the next article *AIGC Composition Principles*.

![](https://www.waytoagi.com/api/kb-media/Lh0lbCoTfoJ4osxclkPcFDBfnuh)


## **TimeSFormer**

In addition to using Vision Transformer for unsupervised pretraining, there are also efforts that apply Vision Transformer to video action classification. As the name suggests, given a video clip, the algorithm is required to return the action category contained in the video. The core challenge here is how to allocate the Transformer’s attention computation between the spatial and temporal dimensions under limited computational complexity.

TimeSFormer explores various decomposition strategies for this problem, as shown below:

![](https://www.waytoagi.com/api/kb-media/YlEhbXImYoZxAJxPmatcY8BGnze)

- **Space Attention (S)**: Only spatial attention is retained, equivalent to processing each frame independently without considering information exchange across time. Corresponds to the (S) column in the figure below; the red patch represents the attention range of the blue patch.

- **Joint Space-Time Attention (ST)**: Full attention is performed jointly across both space and time, meaning every patch can attend to all information in both spatial and temporal dimensions. Corresponds to the (ST) column; the red patch represents the attention range of the blue patch.

- **Divided Space-Time Attention (T+S)**: Spatial and temporal dimensions perform attention separately. Corresponds to the (T+S) column; the green patches represent the blue patch’s attention range in the temporal dimension, while the red patches represent its attention range in the spatial dimension. These are two independent attention modules.

- **Sparse Local Global Attention (L+G)**: Different attention modules are used based on spatial distance. Corresponds to the (L+G) column; the pink patch represents the blue patch’s attention at distance 0, the yellow patch at distance 1, and the purple patch at distance 3. This consists of three independent attention modules.

- **Axial Attention (T+W+H)**: Different attention modules are used according to feature dimensions. Corresponds to the (T+W+H) column; the green patch represents the blue patch’s attention along the T dimension, the yellow along the W dimension, and the purple along the H dimension. This also consists of three independent attention modules.

![](https://www.waytoagi.com/api/kb-media/W9p8be514o26Bnxp72fcMv8Fn9e)

Finally, TimeSFormer found that the **T+S** (Divided Space-Time Attention) configuration performed the best.

**BEVFormer**

As the final part of our Vision Transformer introduction, let’s look at a different example: the BEVFormer network architecture, which has almost become a standard component in autonomous driving.

**Core knowledge points:**

- BEV stands for Bird’s Eye View, i.e., a top-down planar orthographic view.
- The overall architecture follows an encoder-decoder design, where the decoder contains cross-attention.
- Encoder part: BEVFormer’s visual backbone does not use ViT for feature extraction. However, in principle, the CNN can be replaced with ViT or Swin Transformer.
- Decoder part: BEVFormer essentially performs implicit multiview geometry using multi-camera information. Through learnable queries and a cross-attention mechanism, it integrates image-space features into BEV space.

The decoder computation process is explained in detail below (time dimension is omitted for simplicity):

![](https://www.waytoagi.com/api/kb-media/LffnbfP6nojLVox9rNEczOZ0nDe)

- The encoder has already produced features at different network depths for each camera, simplified as `feat(u, v)`.
- The space surrounding the vehicle is divided into a grid in BEV coordinates, where `(x', y', z')` represents a point in space. Each point corresponds to a learnable query, denoted as `q_{(x', y', z')}`.
- For each `q_{(x', y', z')}`, we examine its corresponding encoder output:

    - Using the camera’s extrinsic and intrinsic parameters, map `(x', y', z')` to the pixel plane `(u', v')` of each camera.
    - Using the Deformable Attention mechanism, aggregate the encoder’s feature outputs near the point `(u', v')` to obtain the feature for `q_{(x', y', z')}`, i.e., `DeformAttn(feat(u', v'))`.
    - Arrange and concatenate the `DeformAttn(feat(u', v'))` outputs according to grid coordinates to form the final BEV grid features, which are then fed into various downstream head tasks.

The core process of Deformable Attention is as follows:

![](https://www.waytoagi.com/api/kb-media/P1Ksb6XiUof7dtxFYxjckOxNn7c)

- Each query is passed through a linear layer to produce a set of offsets and a set of weights.
- Each offset is added to the previous `(u', v')` pixel coordinate to obtain the final sampling location. The feature at that location is then weighted and summed with the corresponding weights to produce the final feature for that query.

## **Summary**

This section introduced how Transformers are applied in Vision, along with optimization techniques and several related applications.

- **ViT**: The pioneering work in vision transformers. It essentially splits an image into patches, converts them into a sequence of patch tokens, and then processes these patch tokens in the same way text tokens are handled.
- **Swin Transformer**: To address the issue that the computational complexity of the original ViT grows quadratically with image resolution, it designs three levels of information exchange—within windows, between adjacent windows, and across distant windows—greatly reducing computation while ensuring information can flow freely.
- **Unsupervised applications**: Similar to BERT’s cloze task, MAE and BEiT in vision also attempt visual “cloze” tasks. The former tries to reconstruct raw pixels, while the latter attempts to reconstruct abstract vision tokens.
- **Video action classification**: When using Vision Transformers for video action classification, the key challenge is how to allocate the transformer’s attention computation between spatial and temporal dimensions under limited computational budget. TimeSformer explored various decomposition strategies and ultimately found that separating spatial and temporal attention yields the best performance.
- **Autonomous driving application**: Finally, we briefly introduced BEVFormer—a special example that uses a cross-attention mechanism to extract features for downstream vision tasks.

**Multimodal Tasks and Evaluation Methods**

After the emergence of Vision Transformer, vision and text can at least be represented in the same space in terms of form. This has provided great convenience for their direct interaction, leading to a surge of multimodal research.

The scope of multimodal is very broad. In my opinion, any process that involves inputs from multiple modalities (images, text, audio, video, LiDAR, millimeter-wave radar, etc.) and produces outputs in one or multiple modalities can be considered multimodal.

Before formally introducing multimodal algorithms, let’s first clarify what the main multimodal tasks are, along with the commonly used training/test datasets and evaluation methods. This section does not aim to exhaustively list every possible multimodal task; rather, it focuses on explaining and introducing the multimodal tasks that will appear in subsequent papers.

## **Video Action Recognition**

Video action classification: given a short video clip within 15 seconds, the algorithm is required to identify the action category. Commonly used datasets include:

- **UCF-101**: A dataset collected from YouTube containing 101 action categories, with a total of 13,320 video clips divided into 25 groups. Each group contains 4–7 actions and shares common characteristics such as similar backgrounds and viewpoints. Each video is approximately 10 seconds long.

- **HMDB-51**: Collected from YouTube and Google, it contains 51 action categories and 6,849 video clips, also consisting of short videos.

- **Moments in Time**: Includes 339 action categories and 1 million 3-second video clips, with an average of over 1K video clips per action.

- **Kinetics-400/600/700**: Collected from YouTube, containing 400/600/700 action categories. Each action has 400/600/700 video clips, and each clip is approximately 10 seconds long.

The evaluation metrics are similar to those of ImageNet: Top-1 or Top-5 accuracy under multi-class classification.

## **Image Text Retrieval**

Image-text retrieval task.

- **Image-to-Text**: Given one image and a set of text descriptions, the algorithm must return the most relevant text description.

- **Text-to-Image**: Given one text description and a set of images, the algorithm must return the most relevant image.

Commonly used datasets include:

- **Flickr30K**: Contains 31K images from Flickr with human-annotated captions. Each image has 5 text descriptions.

- **MS-COCO**: Contains 113K human-annotated image-text pairs. Each image has at least one text description, and the quality is very high.

The metric calculation is similar to retrieval ranking. Given one image and a large pool of candidate text descriptions, the algorithm returns a ranked list of texts. Then Recall@k is computed — i.e., whether the correct result appears within the top K returned items.

## **Image Caption**

Image captioning task: given an image, the algorithm is required to generate a textual description. Datasets used for image-text retrieval can be directly reused. In addition, there are many web-crawled image-text datasets.

- **Visual Genome (VG)**: First proposed by Prof. Fei-Fei Li’s group. The original dataset is very large, but later researchers found that the object annotations were too noisy, with ambiguous names and overlapping bounding boxes. Therefore, the cleaner VG150 subset is commonly used. It contains 108K images and 5.41M text descriptions with higher data quality.

- **CC12M**: A web dataset from Google containing URLs. Images must be downloaded via crawlers. It contains 12M pairs but has a large amount of noise, so filtering is required.

- **SBU**: A dataset from Flickr with approximately 800K image-text pairs.

- **LAION-400M**: Released by the LAION non-profit organization. It is derived from Common Crawl raw data and filtered using CLIP (removing pairs with similarity lower than 0.3). It contains a total of 400M image-text pairs.

Evaluation metrics are somewhat heuristic, essentially measuring the similarity between two sequences. Commonly used metrics include CIDEr, BLEU, ROUGE, and METEOR, with CIDEr being the most widely adopted.

## **Visual QA**

Visual Question Answering: given an image and a question, the algorithm is required to answer the question. It is generally divided into closed-set QA and open-set QA. The former is treated as a multi-class classification task, while the latter is treated as a text generation task.

![](https://www.waytoagi.com/api/kb-media/E6TsbWFDRoMdwIxI7QkcDBawnwb)

- **Closed QA**: Treated as a multi-class classification task. A commonly used dataset is VisDial. The dataset contains multiple question-answer pairs, which are often converted into binary classification problems.

- **Open QA**: Treated as a text generation task. A commonly used dataset is VQAv2. Answers are usually very short, so evaluation is done by exact string matching — only a perfect match is considered correct. Note that VQAv2 can also be converted into a closed-set QA task by selecting the multiple-choice options and turning it into a 3,129-class classification problem.

## **Visual Reasoning**

Visual reasoning task: given an image and a textual description, the algorithm must determine whether the text matches the image. The most commonly used dataset is NLVR2, which provides 2 images + a text description and asks whether the description matches the images. The dataset contains a total of 92K questions.

![](https://www.waytoagi.com/api/kb-media/Z5rQbvsaBofJi2xPbHycolG7n0f)

It is a binary classification problem, and the evaluation metric is accuracy.

**Visual Entailment**

Visual Entailment is a task that determines the relationship between an image and a text description. The image serves as the **premise**, the text serves as the **hypothesis**, and the algorithm is required to return one of three labels: **entailment**, **contradiction**, or **neutral** (undetermined). It is a three-class classification problem. The most commonly used dataset is SNLI-VE, which contains 30K images.

![](https://www.waytoagi.com/api/kb-media/BExnbCZJwoHvnkxlKp2cuHkNnCc)

It is a three-class classification task, and the evaluation metric is **accuracy**.

## **Summary**

The information above has been summarized into a table for easy reference.

> 📊 This section contains embedded Feishu content (tables, whiteboards, etc.). [View the full version in the Feishu Knowledge Base](https://waytoagi.feishu.cn/wiki/ReVzwZUr0ivgWfkaQ91cXrYUnoh)

# **Unified Framework Stage 1: Independent Modules**

Next, we officially enter the multimodal algorithm section, with a focus on the interaction between image and text modalities. We can abstract the system into three core modules:

- **Textual Embed (TE)**: The text feature extraction module. It primarily takes text as input and transforms it into abstract textual features through a backbone network (e.g., LSTM, GRU, Transformer, etc.).

- **Image Embed (IE)**: The image feature extraction module. It primarily takes images as input and transforms them into abstract visual features through a backbone network (e.g., SIFT, CNN, ViT).

- **Modality Interaction (MI)**: The multimodal interaction module. It takes textual and visual features as input, fuses the information, and completes the downstream task.

![](https://www.waytoagi.com/api/kb-media/JjSzbjUMuoUieOxQLkCcLciUnTe)

In the early stages of multimodal development, the three modules — TE, IE, and MI — were independent of each other with no weight sharing. Based on the relative complexity among these three modules, four types of network architectures can be categorized as shown in (a)–(b)–(c)–(d) above.

> 📊 This section contains embedded Feishu content (tables, whiteboards, etc.). [View the full version in the Feishu Knowledge Base](https://waytoagi.feishu.cn/wiki/ReVzwZUr0ivgWfkaQ91cXrYUnoh)

## **SCAN**

During the development of multimodal models, the backbone networks for TE and VE have continuously evolved. Before ViT completely dominated visual feature extraction, object detection pipelines were commonly used to extract bounding boxes and features for individual objects. SCAN is a representative method of this category, as illustrated below:

- The **VE** module uses Fast R-CNN as a bottom-up object detector to detect all *k* objects and obtain their corresponding features *vᵢ* via ROI Pooling, where *i ∈ [1, k]*.

- The **TE** module (referred to as IE in the original text) performs feature extraction on *n* words to obtain *eⱼ*, where *j ∈ [1, n]*.

- The **MI** module:

    - Applies a complex, hand-crafted weighting mechanism to the two sets of features, ultimately producing a fused similarity score *R(vᵢ, aᵢᵗ)*.
    - Uses Log-Sum-Exp pooling to compute the overall similarity between the image and text, which can then be supervised with positive and negative sample pairs.

![](https://www.waytoagi.com/api/kb-media/BveQbnSiBowuk0xsGAFcvvF2ndc)

As a representative early work, SCAN has the following limitations:

- The VE module is computationally expensive. Features are typically pre-extracted, which hinders the use of data augmentation techniques.
- The MI module relies on manually designed formulas, which are complex, have poor transferability, and introduce excessively strong inductive bias.

**CLIP**

OpenAI’s CLIP serves as a representative of category (b). It treats TE and VE equally, uses a simple Contrastive Loss for the MI component, and ultimately delivers outstanding performance on image classification tasks, exerting enormous influence. As shown below:

![](https://www.waytoagi.com/api/kb-media/EjsDbB7cnonTzwxOiJYcyWeXnzd)

**Pre-training**

Pre-training employs Contrastive Loss, with the specific implementation as follows:

- The IE uses a Transformer with masking, making it easy to switch between encoder-decoder and decoder-only architectures. It extracts global text features \( T_i \).
- The VE uses a ResNet or ViT network architecture to obtain global image features \( I_N \).
- The MI component treats each paired text-image as a positive sample and all others as negative samples, performing contrastive learning.

Contrastive learning typically computes softmax + cross-entropy once along each row and once along each column. The diagonal elements are positive samples, while the off-diagonal elements are negative samples. The final loss is the average of the two. The code is clearer, as shown below:

```python
 image_encoder - ResNet or Vision Transformer 
 text_encoder - CBOW or Text Transformer 
 I[n, h, w, c] - minibatch of aligned images
 T[n, l] - minibatch of aligned texts
 W_i[d_i, d_e] - learned proj of image to embed 
 W_t[d_t, d_e] - learned proj of text to embed 
 t - learned temperature parameter

 extract feature representations of each modality 
I_f = image_encoder(I) [n, d_i] 
T_f = text_encoder(T)  [n, d_t]

 joint multimodal embedding [n, d_e] 
I_e = l2_normalize(np.dot(I_f, W_i), axis=1) 
T_e = l2_normalize(np.dot(T_f, W_t), axis=1)

 scaled pairwise cosine similarities [n, n] 
logits = np.dot(I_e, T_e.T) * np.exp(t)

 symmetric loss function 
labels = np.arange(n)
loss_i = cross_entropy_loss(logits, labels, axis=0) 
loss_t = cross_entropy_loss(logits, labels, axis=1)
loss = (loss_i + loss_t)/2
```

It is worth noting that the temperature coefficient `np.exp(t)` uses a learnable parameter \( t \) rather than a fixed value. At the same time, \( \exp(t) \in (0, \infty) \), which perfectly matches the valid range of a temperature coefficient. OpenAI reported that this design yields better results and eliminates the need for manual hyperparameter tuning.

In addition, OpenAI used a closed-source, heavily cleaned dataset of up to 400 million samples. The training code itself is also closed-source, which is why subsequent open-source efforts such as OpenCLIP emerged.

**Zero-shot Prediction**

When performing downstream classification tasks, CLIP can be used completely in a zero-shot manner. The text side offers many template choices, such as `a photo of {}`. The final results were overwhelmingly strong, with ViT performing slightly better.

![](https://www.waytoagi.com/api/kb-media/FkBObTWrAoEh9oxS1Z8cuzXRn2g)

**Limitations**

- CLIP performs very well on image classification, but its direct application to more complex tasks such as VQA, VR, or VE yields suboptimal results.
- Training is expensive, requiring thousands of GPU-days in total (12 days on 256 V100 GPUs).

**FLIP**

The core motivation behind FLIP is to solve the high training cost of CLIP. It can be simply understood as a **Fast** version of CLIP. The key improvements are as follows:

![](https://www.waytoagi.com/api/kb-media/QeBzbXoKyormj1xHTVrcDG46nkh)

- In MAE, the encoder randomly masks a large proportion (up to 75%) of the original image patches.
- Only the remaining unmasked patches are fed into the Vision Encoder (VE).
- This reduces the computation of the VE to just 1/4 of the original, making training significantly cheaper.

At the end of the FLIP paper, the authors also explored scaling behavior. They found that both larger models and more data can continue to improve performance, but training for more epochs does not help.

![](https://www.waytoagi.com/api/kb-media/QvcNb6skJoJvWSxuPltcdR2Sn2c)

## **ViLT**

Although category (c) methods are currently SOTA, many of their ideas were inspired by ViLT, the representative work of category (d). Therefore, before introducing the SOTA models, let’s first take a detailed look at how ViLT works.

The classification of VE, TE, and MI at the beginning of this section actually originates from ViLT. ViLT’s main idea is to completely replace the Vision Encoder (VE) with a simple patch projection module, drawing inspiration from the ViT approach, as shown below:

- **Region Feature**: The traditional approach using a CNN backbone + detection head. It essentially performs object detection, then uses ROI Align to extract the corresponding features as vision tokens. This is computationally expensive.
- **Grid Feature**: Only the CNN backbone is used, and the final feature map is directly taken as vision tokens. The computational cost is still very high.
- **Patch Projection**: Inspired by ViT, a simple convolution is applied at the beginning to turn 32×32 pixel regions into patches, which are then used directly as vision tokens. This approach delivers extremely fast inference speed.

![](https://www.waytoagi.com/api/kb-media/VeMJbaSh5ouoMnxw3PZc7iqUnbg)

**Network Architecture**

The overall network architecture is shown below. It is a classic example of category (d):

![](https://www.waytoagi.com/api/kb-media/URxbb1bCmoUafRx1RLBcUtLznAb)

- It is very similar to ViT and follows an encoder-only structure. After embedding, Text has shape L × H, and Image has shape N × H. A `CLS token` is added in front of both the Text and Image, making the total input size (L + N + 2) × H.
- Note that the Position Encoding (PE) here consists of two parts:
  - First, 0 and 1 are used to separately encode the text portion and the image portion.
  - Second, conventional positional encodings are applied within the text and within the image respectively.

**Loss Design**

The training loss is relatively complex and deserves a detailed explanation. It consists of three components:

- **Image Text Matching (ITM)**
  - Similar to contrastive loss, derived from the text’s `CLS token`.
  - Positive samples are matched image-text pairs; negative samples are created by replacing the image with a different one.
  - RandAugment is used for image augmentation, but color jitter and crop augmentations are removed to prevent creating mismatched image-text pairs.

- **Word Patch Alignment (WPA)**
  - Performs optimal alignment between a subset of text and a subset of image patches. Specifically, optimal transport theory is used to minimize the loss. We will not expand on the details here.

- **Masked Language Modeling (MLM)**
  - Similar to BERT’s cloze task, but uses Whole Word Masking (WWM) instead of masking individual tokens.
  - The motivation for Whole Word Masking is straightforward: it prevents the model from inferring the rest of a word using its word roots. For example, if `giraffe` is split into `gi`, `raf`, and `fe`, the model could guess `raf` from `gi` and `fe`.

**Experimental Results**

While ViLT still lags behind methods based on Region Features and Grid Features, its main contribution is opening up a new direction of thinking.

![](https://www.waytoagi.com/api/kb-media/V5jobYLCKoMnHsxujfYcchm9nsn)

**ALBEF**

Following ViLT’s pioneering work in using ViT for the Vision-Encoder (VE) in vision-language tasks, a wave of follow-up studies emerged. Among them, ALBEF stands out as one of the strongest models. ALBEF addresses the issue that a plain ViT is not powerful enough for vision-language understanding. It argues that the visual encoder needs to be sufficiently complex — even more complex than the text encoder. The overall architecture is shown below:

- It is easy to see that the design is very similar to BERT, except that the decoder portion of BERT is split into two parts: one for the Text Encoder (TE) and the other for the Multimodal Interaction (MI) module.
- Since the VE consists of 12 layers while the TE has only 6 layers, this design aligns with the insight that the visual encoder should be more complex than the text encoder.

![](https://www.waytoagi.com/api/kb-media/HzPjbpY4kofcuoxrAAZczKZGnff)

Compared with ViLT’s loss functions, ALBEF retains ITC and MLM while introducing a new **Image-Text Matching (ITM) Loss**.

- **ITC (Image-Text Contrastive) Loss** is the standard contrastive learning objective.
  - Positive samples come from the paired image and text features in the current batch.
  - Negative samples are drawn from two additional queues: `q_neg^text` and `q_neg^image` (explained later).

- **ITM (Image-Text Matching) Loss** is a binary classification loss that determines whether an image-text pair is a match. To maintain class balance, it also involves careful selection of positive and negative samples.
  - Positive samples come from the currently paired image and text features.
  - Negative samples are the hardest negatives mined from the ITC task.

- **MLM (Masked Language Modeling) Loss** is the same cloze-style task as in BERT, where 15% of the tokens are replaced with the `[MASK]` token.

**Momentum Model**

Another key innovation in this paper is the adoption of the MoCo idea. The authors maintain a **Momentum Model (MM)** that has exactly the same architecture as the left-hand model shown in the figure above.

- The weights of the Momentum Model are not updated via back-propagation. Instead, they are updated using EMA (Exponential Moving Average) from the main model.
- The primary role of the MM is to provide high-quality negative samples. It maintains two large queues of size 65,536: one for negative text features (`q_neg^text`) and one for negative image features (`q_neg^image`).
- After the main model finishes its forward pass at time *t*, the resulting text and image features are enqueued at the end of `q_neg^text` and `q_neg^image` respectively (to serve as negatives for future steps). At the same time, the same number of samples are dequeued from the front of both queues to serve as the negative samples for the current step *t*.

In addition, ALBEF was trained on the relatively large and noisy CC12M dataset. To handle the noise, the authors introduced a self-training strategy using the Momentum Model:

- Because the MM is updated via EMA, its parameters change slowly and remain relatively stable, making it a reliable **teacher** model.
- The MM is used as a teacher to distill knowledge into the ITC and MLM objectives. This technique is called **Momentum Distillation (MoD)**.
- ITM does not use distillation loss because it already benefits from hard negatives mined by ITC.

ALBEF also validates the reliability of the MM as a teacher through visualization. In the figure below, “GT” denotes the original ground-truth labels, while “pseudo-target” represents the output of the MM model.

![](https://www.waytoagi.com/api/kb-media/YxoFbHrIQoYfemxsAW6cqnRwnzc)

**Experimental Results**

ALBEF achieves strong performance across Image Retrieval, VQA, Visual Reasoning (VR), and Visual Entailment (VE) benchmarks.

![](https://www.waytoagi.com/api/kb-media/OutzbIfrhoJR7IxxnFJcb3c3nsd)

**CoCa**

As a (c)-class method, CoCa pushes the capabilities of ALBEF significantly further. The main improvements are as follows:

- The MI component is replaced with a decoder-only architecture. It no longer performs BERT-style masked language modeling, but directly performs caption generation.
- The loss function is simplified to retain only the image-text Contrastive Loss (Co) and the natural language Captioning Loss (Ca). Hence the paper is named CoCa.
- After simplifying the loss, all losses can be computed with only a single forward pass. Unlike previous methods that required a separate forward pass for each loss, the model can now be trained much faster.
- An attention_pooling-based Pooler is proposed, implemented using an MHA module:
  - Set `n_query` learnable queries.
  - Keys and values come from the Image Encoder output.
  - For Contrastive Loss, `n_query = 1`.
  - For Captioning Loss, `n_query = 256`.

![](https://www.waytoagi.com/api/kb-media/ZvMHbGUwNoCPLRxwwn3cJSjbnnh)

Starting with CoCa, it became popular to display model capabilities using radar charts, as shown below:

![](https://www.waytoagi.com/api/kb-media/ZtwEb19zToCis0xJPE3chMF2nqZ)

- Video action recognition on K400 and K600
- Image classification on ImageNet
- Captioning on NoCaps
- Visual Reasoning (VR) on NLVR2
- Visual Entailment (VE) on SNLI-VE
- VQA on VQAv2
- Image-text retrieval on Flickr30K and MSCOCO

PS: For explanations of the datasets and metrics, please refer to the table in the “Multimodal Tasks and Evaluation Methods” section.

## **Summary**

This section mainly introduced the unified Stage 1. Its key characteristic is the emergence of three modules—VE, TE, and MI—although they remain largely independent of each other.

![](https://www.waytoagi.com/api/kb-media/DmlDbTrcXo203Ax7AL8cGcGgn7b)

- (a) VE > TE > MI. Representative method: SCAN. The VE part still uses Fast R-CNN, with features typically pre-extracted. The MI part relies on manually designed formulas, resulting in overly strong inductive bias.
- (b) VE = TE > MI. The CLIP method is simple and effective, but its data and training process are closed-source and computationally expensive. FLIP draws on MAE’s acceleration techniques to improve CLIP.
- (c) VE > MI > TE. ALBEF and CoCa follow the principle that VE should be more complex than the image encoder and that MI must also be sufficiently sophisticated, achieving SOTA performance in the Stage 1 era.
- (d) MI > VE = TE. ViLT pioneered the use of Patch Projection in VE. Although the results were not strong, it was a valuable pioneering effort.

# **Unified Multimodal Stage 2: Module Sharing**

In Stage 1, the three modules—VE, TE, and MI—work together to perform multimodal tasks quite well. However, they are still separate at the parameter level. For example, the encoders of VE and TE do not share weights. If VE and TE were integrated into the same Transformer structure, would model performance be affected?

This section introduces Stage 2 of unified multimodal modeling—how multimodal models share Transformer modules. Four key papers are covered: VLMO, BLIP, BEiTv3, and BLIP2.

## **VLMO**

VLMO proposes the Mixture-of-Modality-Experts (MoME) Transformer, also known as Multiway Transformers. As shown below:

- Inspired by the SuperNet concept, different modality inputs activate different FFN Expert pathways.
- Cross-attention is removed; self-attention is used uniformly. This means text and images can be encoded using the same self-attention mechanism.
- Like ALBEF, it uses three losses: ITC, ITM, and MLM.
- VLMO also introduces staged training to better leverage massive amounts of unimodal data.

![](https://www.waytoagi.com/api/kb-media/I2fIbekSqoT26Lx3vyacL0aUntb)

**Staged Training**

- Image-text paired data is relatively limited. The commonly used 4M training set plus the 14.1M CC12M dataset is still tiny compared to the billions of pure text or image samples typically available.
- To make full use of these massive unimodal datasets, VLMO adopts a staged unsupervised pre-training approach.
- Interestingly, after performing unsupervised pre-training on images, freezing the self-attention layers and only fine-tuning the FFN on text data yields surprisingly good results. Reversing the order does not work as well.

![](https://www.waytoagi.com/api/kb-media/KanAb6Mt3oWXMfxAMWdcrxNNnYf)

**BLIP**

BLIP integrates ALBEF and VLMO, also adopting a shared module architecture, while introducing two key improvements:

- Added decoder-only text generation capability to the model architecture
- Introduced the CapFilt module for data cleaning and filtering, which consistently delivers performance gains

**Network Design**

Compared to ALBEF’s three losses (ITC, ITM, and MLM), BLIP replaces the MLM cloze-style task with a decoder-only language modeling (LM) loss, because the goal is to generate captions.

- For ITC, a `[CLS]` token is added to produce text features.
- For ITM, an `[Encode]` token is added to output binary classification probabilities.
- For LM, a `[Decode]` token is added to prompt the language model to begin token prediction.

Note that ITC and ITM share the self-attention module, following the design idea from VLMO. However, for the LM task, it was found that the self-attention module needs to be trained separately.

![](https://www.waytoagi.com/api/kb-media/Dic1bAVO0oHrytxzotmcvFBSnhD)

**CapFilt Method**

BLIP follows a data-centric approach and thoroughly cleaned the training data.

- **Step 1**: First, jointly train an initial model using both human-annotated data and automatically crawled web data.
- **Step 2**: Fine-tune on clean human-annotated data. Specifically, perform ITC & ITM fine-tuning to obtain the Filter, and LM fine-tuning to obtain the Captioner.
- **Step 3**: Jointly use the Filter and Captioner to clean the data and train a new model.
- **Step 4**: Repeat Steps 1–3 multiple times.

![](https://www.waytoagi.com/api/kb-media/A1j9bQXsTogjsixkInjck6XHn0L)

The resulting Filter and Captioner produce the following effects. Red text shows the original caption, while green text shows the caption generated by CapFilt.

![](https://www.waytoagi.com/api/kb-media/TmwUbKVDhoW43Hxq2d5c7SkmnE8)

![](https://www.waytoagi.com/api/kb-media/Y3B8b62xvoTxbgxhRg7c6atKnDf)

Data cleaning generally brings 1–2 point improvements.

![](https://www.waytoagi.com/api/kb-media/R6oBbQpjDoDBOsxOsPVcQMGZnKc)

## **BEiTv3**

Highly similar to VLMO, BEiTv3 also adopts Multiway Transformers. The main improvements are:

- Treating visual encoding (VE) entirely as a kind of “foreign language” in NLP. The pre-training loss is simplified to a pure mask-and-predict paradigm. Both images and text are pre-trained using a cloze-style (masked prediction) objective.
- Text is tokenized using SentencePiece, while images use the visual tokens learned in BEiTv2 as the reconstruction target.
- BEiTv3 exclusively uses open-source, publicly downloadable data for training, emphasizing full reproducibility.

![](https://www.waytoagi.com/api/kb-media/HtFtbbQnYowcgVxt0EQcMQgJnNe)

In the end, it outperforms CoCa by a significant margin.

![](https://www.waytoagi.com/api/kb-media/J4AHbAjg0ol1Lqxjd3IcDGNsnUe)

## **BLIP2**

To further enhance multimodal capabilities, BLIP2 introduced the following improvements:

- Introduced 32 learnable query tokens to compress and extract image information. By leveraging pretrained LLMs (such as OPT and T5-FLAN), it achieved a massive improvement in VQA performance.

- Because the number of queries is fixed, the number of output tokens from the Transformer is decoupled from image resolution, making training very cost-effective — achievable with just 16×A100 40G GPUs.

- Adopted a two-stage training approach: Stage 1 trains the query tokens, and Stage 2 connects the LLM for end-to-end fine-tuning.

**Training Stage 1**

- Set 32 learnable queries. Note that the self-attention between queries and text shares weights, which helps the queries learn tokens that approximate text semantics.

- Used the common ITM, ITC, and ITG losses. Different losses apply different masks to the self-attention mechanism.

- The Pre-training stage used a total of 129M data points, while employing the CapFilt technique to filter and correct web images.

![](https://www.waytoagi.com/api/kb-media/Cke9b0wENoieulxWYtecDnX5n7e)

**Training Stage 2**

Connect a decoder-only or encoder-decoder LLM and perform VQA fine-tuning.

![](https://www.waytoagi.com/api/kb-media/XXQ9bdqOSoy39BxyJeJc0SmUnbd)

In the end, it once again dominated the leaderboards across various multimodal tasks (though it relied on LLMs — does this count as outside assistance?).

![](https://www.waytoagi.com/api/kb-media/KNZWb7TMKoXMMvxJGM0cXQvwn4d)


## **Summary**

This section mainly introduced how to fuse VE, TE, and MI within the same Transformer block. The core idea is the Multiway Transformer approach.

- VLMO was the first to propose MoME, where different modalities are represented through different expert FFNs.

- BLIP integrates ALBEF and VLMO, also uses shared modules, and adds decoder-only text generation capabilities. It employs the CapFilt module for data cleaning and filtering, delivering consistent performance gains.

- BEiTv3 is highly similar to VLMO, treating VE essentially as a foreign language in NLP. The Pre-training loss is simplified to only the mask-and-predict paradigm. Both images and text are pretrained using a cloze-style (fill-in-the-blank) approach.

- BLIP2 introduces 32 learnable query tokens to compress and extract image information. By leveraging pretrained LLMs (such as OPT/T5-FLAN), it achieved a massive improvement in VQA performance.


# **Grand Unification Stage 3: Paradigm Unification**

In my personal opinion, the ultimate form of multimodal models should support arbitrary multimodal inputs and arbitrary multimodal outputs. One solution is to convert all modalities into token sequences and uniformly model them as seq2seq tasks.

From Stage 1 and Stage 2, we can see that unifying multimodal inputs into token sequences has largely been achieved. Both images and videos can be turned into patch tokens through patch partitioning. What remains is to represent output modalities as token sequences. Specifically, we need to tokenize Image, Video, Text, Sparse (a small number of discrete position coordinates), and Dense (depth maps or segmentation maps). Here:

- **Image, Video, and Dense**: The output token sequence can be converted into a dense matrix using AIGC techniques. The technical details of AIGC will be covered in the next article, *Principles of AIGC*.

- **Text**: Naturally a token sequence.

- **Sparse**: Encoded into a token sequence through coordinate discretization.

The encoding method for Sparse may be unfamiliar to many, so we will first introduce the pixel2seq work.

**Pixel2seq**

Pixel2seq attempts to model the traditional Object Detection (OD) problem as a task that takes image pixels as input and predicts a sequence of tokens as output.

![](https://www.waytoagi.com/api/kb-media/QZo5bUWjGoTbIkx9bL6cMmvindg)

- Each object bounding box is modeled as a sequence of length 5 in the form: [\text{ymin}, \text{xmin}, \text{ymax}, \text{xmax}, \text{c}]

  - The four corner coordinates are uniformly discretized into the range [1, n_{\text{bins}}], requiring n_\text{bins} tokens. For a 600×600 image, setting n_\text{bins}=600 enables lossless representation.
  - Each category c is represented by a single token, requiring n_\text{class} tokens.
  - In total, n_\text{bins} + n_\text{class} distinct tokens are needed.

- The network adopts an encoder-decoder architecture, where the decoder uses a causal mask to ensure it can only attend to previously generated tokens in the sequence.

![](https://www.waytoagi.com/api/kb-media/SJECbf3IvoiW9FxPJ8uchMYKn4g)


## **Unified-IO**

Once we convert Image, Video, Text, Sparse, and Dense modalities into token sequences, a unified input-output framework naturally emerges, as shown below:

![](https://www.waytoagi.com/api/kb-media/XCb6b2b2moRsoRxFaGCcanUOnDk)

Most common multimodal tasks can be performed through prompt instructions. The following table illustrates typical combinations of input and output modalities for various tasks:

![](https://www.waytoagi.com/api/kb-media/Hi1jbKsVnoSoUqxPV2KceievnWb)


## **Summary**

The paradigm unification in Stage 3 is still in a phase of vigorous development. Its evolution actually runs in parallel with Stage 1 and Stage 2, without a strict chronological order. Unified-IO represents one promising direction — using seq2seq to unify multimodal learning. Many other excellent works exist, such as MetaLM, Uni-Perceiver, and PaLI. Due to space constraints, they will not be covered individually here.

**Closing Thoughts**

This article is divided into five main sections:

- The first section introduces the fundamentals of Vision Transformers and their key applications. It covers [ViT (2020.10)](https://arxiv.org/abs/2010.11929), [ViT-22B (2023.02)](https://arxiv.org/abs/2302.05442), [Swin Transformer (2021.08)](https://arxiv.org/abs/2103.14030), [MAE (2021.11)](https://arxiv.org/abs/2111.06377), [BEiT (2021.06)](https://arxiv.org/abs/2106.08254), [BEiTv2 (2022.08)](https://arxiv.org/abs/2208.06366), [TimeSformer (2021.02)](https://arxiv.org/abs/2102.05095), and [BEVFormer (2022.03)](https://arxiv.org/abs/2203.17270).

- The second section introduces multimodal tasks, along with relevant training, evaluation datasets, and assessment methods. It includes Video Action Recognition, Image-Text Retrieval, Image Captioning, Visual QA, Visual Reasoning, and Visual Entailment.

- The third section begins the discussion on the **Stage 1** of unified multimodal models — **independent modules**. Starting from the complexity relationships among the Text Encoder (TE), Vision Encoder (VE), and Multimodal Interaction (MI) modules, it presents four types of network architectures, including [SCAN (2018.03)](https://arxiv.org/abs/1803.08024), [CLIP (2021.02)](https://arxiv.org/abs/2103.00020), [FLIP (2022.12)](https://arxiv.org/abs/2212.00794), [ViLT (2021.02)](https://arxiv.org/abs/2102.03334), [ALBEF (2021.07)](https://arxiv.org/abs/2107.07651), and [CoCa (2022.08)](https://arxiv.org/abs/2205.01917).

- The fourth section continues with **Stage 2** of unified multimodal models — **shared modules**. [VLMO (2021.11)](https://arxiv.org/abs/2111.02358) pioneered the approach of having the TE, VE, and MI modules share Transformer blocks. This inspired subsequent works such as [BLIP (2022.01)](https://arxiv.org/abs/2201.12086), [BEiTv3 (2022.08)](https://arxiv.org/abs/2208.10442), and [BLIP-2 (2023.01)](https://arxiv.org/abs/2301.12597).

- The final section covers **Stage 3** of unified multimodal models — **unified paradigms**. This remains a rapidly evolving research direction. From a personal perspective, it highlights the paradigm unification approaches in [Pixel2Seq (2021.09)](https://arxiv.org/abs/2109.10852) and [Unified-IO (2022.06)](https://arxiv.org/abs/2206.08916).

**Preview**: The next planned article is *“The Composition Principles of AIGC”*. Stay tuned.

**PS**: Since the author, Xiao A, has not personally implemented every detail mentioned above, most of the content was synthesized in a bottom-up manner through studying code and carefully reading excellent papers. At its core, this is a compilation of knowledge gathered from others — essentially “talking on paper.” I warmly welcome experts with hands-on experience to critique and correct it. Only through the collision of ideas can sparks fly, and truth emerges through debate.

**If you want to learn about Transformer algorithms in NLP, multimodal learning, and AIGC, knowledge of distributed training, as well as how to perform PTQ quantization and deployment on TVM, feel free to follow me — aaronxic~**

---

**Series Article Navigation**

- [(1) What Exactly Is the Perplexity Metric?](https://ywh1bkansf.feishu.cn/wiki/E1pjwy9OMirKTdkFQDEcDDlfnTh)

- [(2) A First Look at LLM Foundation Models](https://ywh1bkansf.feishu.cn/wiki/UU9pwtOFtiKIqAkQiSVc3Zdun7e)

- [(3) How Is a ChatBot Built?](https://ywh1bkansf.feishu.cn/wiki/HRnLw588DiTDLPkSTXCcKit8nbD)

**References**

- [Transformer Beginner Paper Reading (4) Swin Transformer | Detailed Explanation of Shifted Window and Relative Position Bias](https://zhuanlan.zhihu.com/p/507105020)

- [ViLT Paper In-Depth Reading [Paper In-Depth Reading] - Bilibili](https://www.bilibili.com/video/BV14r4y1j74y)

- [Multimodal Paper Series (Part 1) [Paper In-Depth Reading · 46] - Bilibili](https://www.bilibili.com/video/BV1Vd4y1v77v)

- [Multimodal Paper Series (Part 2) [Paper In-Depth Reading · 49] - Bilibili](https://www.bilibili.com/video/BV1fA411Z772)

- [BLIP2: The Prototype of the Next-Generation Multimodal Model](https://zhuanlan.zhihu.com/p/606364639)

- [CLIP Paper Paragraph-by-Paragraph In-Depth Reading [Paper In-Depth Reading] - Bilibili](https://www.bilibili.com/video/BV1SL4y1s7LQ)
