DeepSeek-VL: Towards Real-World Vision-Language Understanding
- Publication
- Publication venue not yet verified
- First submitted to arXiv
- arXiv:2403.05525
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{deepseekdeepseekvl2024,
title = {{DeepSeek-VL: Towards Real-World Vision-Language Understanding}},
author = {Haoyu Lu and Wen Liu and Bo Zhang and Bingxuan Wang and Kai Dong and Bo Liu and Jingxiang Sun and Tongzheng Ren and Zhuoshu Li and Hao Yang and Yaofeng Sun and Chengqi Deng and Hanwei Xu and Zhenda Xie and Chong Ruan},
year = {2024},
eprint = {2403.05525},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2403.05525v2}
}
This paper discusses multimodal research.
Two months after the release of DeepSeek LLM, the DeepSeek team published their research results in the multimodal domain.
Problem Definition
Existing multimodal models often use low-resolution inputs (e.g., 336×336 or 448×448), which leads to poor performance in complex scenarios such as OCR tasks or tiny object recognition. Moreover, there is still a significant performance gap between open-source and closed-source models.
What hasn't been done well in the past serves as the best motivation for the future.
The authors briefly illustrate the typical application of multimodal models using the example of image question answering.
Solution
In this paper, the authors break down the training problems of multimodal models into three dimensions.
Training Data
The study divides the dataset into two main categories:
- Pre-training Data: Primarily used to improve the model's cross-modal basic understanding ability. The data is sourced from various origins and types, and is used for pre-warming and joint pre-training during the early stages of training.
- Supervised Fine-tuning Data: Smaller in scale, mainly used to teach the model to perform specific downstream tasks, and is applied in the later stages of supervised fine-tuning.
First, the pre-training data consists of the following:
- Interleaved Image-Text Data: Open datasets like MMC4, Wiki, Wikihow, and Epub textbooks are used to enable the model to learn multimodal input within context.
- Image Captioning Data: Sourced from high-quality datasets such as Capsfusion, TaiSu, and Detailed Caption, enhancing the model's ability to semantically describe image content.
- Table and Chart Data: Includes sources such as Chart2text, Geo170K, Unichart, Ureader, M-paper, ScienceQA, ScreenQA, SciGraphQA-295K, Paper2figure100k, Widget Captioning, Screen2words, and Refexp, enabling the model to understand typical table and chart images.
- Web Code Data: Using UI inverse rendering (drawing on Websight from HuggingFaceM4 and a method similar to MATCHA), the authors process about 1.46 million Jupyter notebooks and curate roughly 2 million image-code pairs. They then filter 1.1 million instances for the main training set; each contains one image and at least five lines of code.
- Document OCR Data: To address OCR at the document level, two main sources are integrated:
- arXiv Articles: Source code and PDFs are extracted from 1.4 million arXiv papers, and converted into image-text pairs using the Nougat tool.
- E-books and Educational Materials: 860,000 English and 180,000 Chinese e-books are processed, along with millions of primary and secondary school test papers, converted into paired formats using HTML rendering tools.
- Scene Text OCR Data: Enhances the model's ability to recognize text integrated into images in complex environments.
- Pure Text Corpus: Maintains the model's expertise in language tasks, using the same corpus as DeepSeek-LLM.
Next, the supervised fine-tuning data focuses on the model's performance on specific tasks, sourced from multimodal and language data:
- Public Multimodal Datasets: Includes ShareGPT4V, LAION-GPTV, LVIS-Instruct4V, textOCR-GPT4V, LLaVA1.6-GPT4V, and IconQA. Table 2 groups them as general multimodality data; they are not all GPT-4V datasets.
- Some Table and Chart Data: Sourced from pre-training datasets like Ureader, ScreenQA, Geo170K, and ScienceQA.
- UI Code Data: From Screen-to-code tasks, helping the model reconstruct code from graphical interfaces or visual charts.
- Internal High-Quality Multimodal SFT Data: Some data presented in Chinese, meticulously designed based on real-world application scenarios, covering categories such as cognition, transformation, analysis, reasoning, evaluation, and safety. This classification is used to select representative prompts for each test image and to create a balanced evaluation dataset.
- Pure Text SFT Data: Consistent with the text data used in DeepSeek-LLM, serving as part of the joint vision and language SFT data.
Model Architecture
The entire model architecture is relatively simple, consisting of three modules:
-
Hybrid Vision Encoder
As shown in the image, the main components are:
- SigLIP-L Vision Encoder: Accepts low-resolution input (384×384) and focuses on extracting high-level semantic information.
- SAM-B Vision Encoder: A vision-specific self-supervised encoder based on ViTDet, capable of accepting high-resolution input (1024×1024), excelling at capturing low-level detail information.
This design is chosen because image details and semantic information need to be extracted at different resolutions.
The connection process of the two models is as follows:
- The high-resolution image, after being encoded by SAM-B, produces a feature map of size
64×64×256. - This feature map is first interpolated by the VL Adaptor to
96×96×256, followed by two convolution layers with stride 2, resulting in a feature map of size24×24×1024, reshaped to576×1024. - This is concatenated with the
576×1024feature map output from SigLIP-L, ultimately forming 576 visual tokens, each with a dimension of 2048. - After GeLU activation, it passes through an embedding layer to connect with the language model.
-
Vision-Language Adaptor
This section uses a two-layer hybrid MLP. Initially, separate single-layer MLPs handle high-resolution and low-resolution features, and then the two are concatenated along the dimension and passed through another MLP to transform them into the input space of the language model.
-
Language Model
This part refers to the previously seen DeepSeek LLM, designed based on the LLaMA architecture, using Pre-Norm structure and RMSNorm.
In the Feed-Forward Network (FFN) section, the activation function uses SwiGLU, and the language model employs Rotary Embedding as positional encoding, with the same tokenizer as DeepSeek-LLM.
The released models are DeepSeek-VL-1.3B (based on a language backbone pretrained on about 500 billion text tokens) and DeepSeek-VL-7B (about 2 trillion). The SigLIP-L plus SAM-B hybrid encoder described above is used for 7B; the smaller model uses SigLIP alone. The paper also labels the smaller language backbone “DeepSeek-LLM-1B,” while its released multimodal model and results tables use 1.3B.
Training Process
The overall training process is divided into three stages, as shown in the image above:
-
Stage 1: Training the Vision-Language Adaptor
In order to establish the correspondence between vision and language features in the embedding space, and to enable the LLM to understand the entities presented in the image, the first stage only trains the adaptor parameters while freezing the vision encoder and language model.
The data used includes 1.25 million image-text captions from ShareGPT4V and 2.5 million Document OCR rendered pairs.
Experiments show that simply increasing the data scale does not provide significant benefits and may even lead to performance degradation, so the LLM will be unfrozen in the next stage.
-
Stage 2: Joint Vision-Language Pretraining
In Stage 2, the language model and VL adaptor train together; both vision encoders stay frozen (Figure 3).
The challenge here is how to train on multimodal data without affecting the language model's performance. According to experimental results, directly training on multimodal data improves multimodal performance but severely degrades the language model's linguistic performance.
Ultimately, the paper text and Table 1 use a language:multimodal ratio of about 7:3. Figure 4’s caption reverses the modality labels, saying “multimodal:language=70%:30%”; here we follow the prose and dataset table. For the 1.3B model, limited capacity and a lack of SFT data made generative evaluation metrics unstable. The authors therefore monitor training with Multi-choice PPL: they calculate perplexity for each answer option and select the lowest as the prediction. They also add a small amount of SFT data during pretraining to improve instruction following.
-
Stage 3: Supervised Fine-tuning
In Stage 3, SigLIP-L, the VL adaptor, and the language model are optimized with instruction data. SAM-B remains frozen because of GPU memory limits; this is not an all-module unfreeze.
In this step, the authors make instruction adjustments to the pretrained model to further enhance the model's dialogue and interaction capabilities, ultimately resulting in the DeepSeek-VL-Chat model.
During training, they mix multimodal data with pure text dialogue data to support dialogue performance across the tested settings.
Discussion
The paper includes several charts and tables, but here we will focus on the results from the Human Evaluation. If you're interested in other sections, feel free to refer to the original paper.
In the chart above, the green section represents the performance of DeepSeek-VL-7B, while the gray section represents GPT-4V.
The evaluation dataset consists of 100 questions divided into seven categories. These are the same categories used for internal supervised fine-tuning (SFT) data and cover the application scenarios selected by the team.
The research team collected images from free-to-use image communities and photographs taken by the researchers, then designed prompts based on task categories and requirements described in existing reports. This is an author-built set of 100 questions; its results are limited to those images and prompts.
In the evaluation, DeepSeek-VL-7B was compared with InternLM-XComposer2-VL, CogVLM, and GPT-4V. Figure 6 gives GPT-4V 5.36 in logical reasoning versus 4.29 for DeepSeek-VL-7B.
DeepSeek-VL-7B scored 5.65 overall versus GPT-4V’s 6.30. Recognition (7.01 vs 7.14) and commonsense reasoning (6.52 vs 6.74) were closer; conversion was 6.82 vs 7.73, and the multi-image gap was larger still, at 3.13 vs 8.13.
Additionally, the authors conducted an extra comparative evaluation, using GPT-4V as an evaluator to compare the answer quality between DeepSeek-VL and other models.
The procedure involved showing GPT-4V the question and answers from two models for 99 manually evaluated test samples, and GPT-4V would determine which answer was better or if both were equal.
The results are shown in the figure below:
The GPT-4V judge more often chose DeepSeek-VL in its three open-model comparisons: 91 wins against Fuyu-8B, 61 against CogVLM-17B, and 57 against InternLM-XComposer2-VL, each out of 99 questions. The last win count does not exceed 60%. Against GPT-4V itself, DeepSeek-VL had 21 wins, 34 ties, and 44 losses. It lost more often than it won in that comparison; the judge was also one of the models being compared.
Ablation Study
-
Module Capacity and Data Scale
Paper Table 8: five benchmarks after varying Stage 1 projector warm-up steps. During the first training phase (the projector warmup stage), the authors expanded the training dataset and then performed supervised fine-tuning to test whether this would improve the performance of the projector.
In this experiment, extending Stage 1 from 2K to 8K, 20K, and 80K steps, followed by SFT, gave five-benchmark averages of 55.1, 55.5, and 55.6 versus 57.5 at 2K. This fits the authors’ projector-capacity explanation, but the table does not isolate capacity as the cause.
-
The Importance of Stage-wise Training
Paper Table 9: ablation of training-stage combinations. The authors compared the impact of different stage combinations on the final model performance, as shown in the table above:
- Combination of "Stage 1 + Stage 2 + Stage 3"
- Combination of "Stage 1 + Stage 3"
- Combination of "Stage 2 + Stage 3"
Table 9 reports a 62.4 average for all three stages, versus 57.4 for Stage 1+3, showing Stage 2’s contribution in this experiment.
Stage 2+3 averaged 61.7, slightly below 62.4 with all three stages; each of the five listed metrics was also slightly lower. This supports keeping the adaptor warm-up (Stage 1) under these conditions.
The authors also discuss modality grouping and warm-up. In their setup, grouping batches by modality, with one modality per training step, improved training efficiency by about 20%. Starting with pure language data and gradually adding multimodal data softened the early drop in language ability in the plotted experiment. These findings remain tied to the training settings they tested.
The comparison tables in this section are quite detailed, so they are not fully listed here. Interested readers can refer to the original paper.
Conclusion
In this paper, the authors propose a training recipe for multimodal models, and let's review the key points:
- Use two vision encoders responsible for extracting information at different resolutions.
- Use Adapter-based methods to transform visual features into language features.
- Use a three-stage "pretraining - fine-tuning" strategy to develop multimodal performance.
As mentioned earlier, there are many pretraining methods. Another route toward compute efficiency is MoE (Mixture of Experts). The authors also mention plans to scale DeepSeek-VL up and introduce MoE techniques in hopes of improving efficiency and performance.
Let’s stay tuned for what’s next!