DeepSpeed-VisualChat: Multi-Round Multi-Image Interleave Chat via Multi-Modal Causal Attention

Zhewei Yao, Xiaoxia Wu, Conglong Li, Minjia Zhang, Heyang Qin, Olatunji Ruwase, Ammar Ahmad Awan, Samyam Rajbhandari, Yuxiong He

TL;DR

DeepSpeed-VisualChat is a new open-source framework from Microsoft designed to help Large Language Models (LLMs) master multi-round, multi-image interleaved conversations. By introducing a novel Multi-Modal Causal Attention (MMCA) mechanism and clever data-blending techniques, the team has built a system that scales up to 70B parameters and significantly improves how AI understands complex visual relationships across a dialogue.

What Problem Does This Paper Address?

While Large Vision-Language Models (LVLMs) like LLaVA have made huge strides, they often stumble in real-world chat scenarios. Most existing models are optimized for single-image tasks (like captioning) or require all images to be fed at once. They struggle with interleaved inputs—where a user might show an image, ask a question, show another image, and then ask for a comparison.

Furthermore, training these models is incredibly resource-intensive, and high-quality datasets for multi-image dialogues are scarce. The authors aim to bridge this gap by providing an efficient, scalable, and fully open-source framework that can handle the "interleaved" nature of human-AI interaction.

Methods

The DeepSpeed-VisualChat architecture builds upon the foundations of MiniGPT-4 and LLaVA but introduces several key innovations:

  1. Architecture: The model uses a frozen 2B visual encoder (from QWen-VL) and a frozen LLM (like LLaMa-2). The only trainable parts are a linear projection layer (to align visual and text features) and the LLM’s embedding layer. This keeps the trainable parameter count relatively low (10M to 100M).

    Figure 2: Model Structure. A pre-trained vision encoder encodes an image which is then projected through a linear layer to align with the hidden dimension of the text embedding layer’s output. These different inputs are subsequently merged and forwarded to language models like LLaMa-2 powered by our new Multi-Modal Casual Atten- tion (MMCA) mechanism. Here, both the vision encoder and the language model are frozen.
  2. Multi-Modal Causal Attention (MMCA): This is the paper's "secret sauce." In standard causal attention, text tokens often struggle to balance their focus between previous text and visual tokens. MMCA independently computes attention weights for different modalities. Visual tokens only perform self-attention (since they are already bidirectionally encoded), while text tokens attend to text and image tokens using separate weight matrices. This improves data efficiency without adding new parameters.

    Figure 4: Different Attention Mechanisms: Examine the differing attention mechanisms using an input sentence "User: Please describe the image." coupled with three Image tokens (I-token1, I-token2, I-token3). On the left, we demonstrate standard causal attention [48, 5], treating image tokens as text. In the middle, we present cross attention applied to images, while maintaining standard causal attention for text tokens. On the right, we illustrate our innovative multi-modal attention proposal where image tokens only perform self-attention, and text tokens attend to text/image tokens independently, highlighted with an orange mask. This mechanism is defined by: softmax(QKT ⊙M1) + softmax(QKT ⊙M2) with Q and K as query and key, M1 = [M == 1], and M2 = [M == 2], with M ∈R10×10 in this case.
  3. Scalability: Leveraging the DeepSpeed framework, the authors demonstrate that their approach can scale up to a 70B parameter language decoder, a significant jump from the 7B or 13B models common in the field.

Datasets

To overcome the lack of interleaved multi-image data, the authors employed Data Blending:

  • Simple Concatenation: They took existing single-image datasets (LLaVA, Otter) and randomly concatenated 1–3 samples into a single multi-image dialogue.
  • LLaVA-Otter Blend: They matched images across different datasets to create more natural-feeling transitions.
  • SparklesDialogue: A small but high-quality dataset of 6,520 samples was used to enhance narrative and comparison skills.

Key Insights and Ideas

  • Modality Independence: The "aha moment" for MMCA is that visual tokens don't need to "look back" at text tokens to understand an image, but text tokens do need a specialized way to look at images. By separating these attention paths, the model learns faster.
  • Resolution is King: The authors found that switching from a standard CLIP encoder (224x224) to a higher-resolution 448x448 encoder (QWen-VL) significantly boosted the model's ability to see fine details.
  • Scaling Benefits: Moving from 7B to 13B parameters noticeably reduced repetitive text and improved the logical flow of multi-round conversations.

Key Results

  • Superior Reasoning: DeepSpeed-VisualChat-13B outperformed competitors like QWen-VL and SparklesChat in multi-image reasoning tasks, such as identifying differences between three different images of cats.

    Figure 1: An example of DeepSpeed-VisualChat.
  • Qualitative Edge: In head-to-head comparisons, the MMCA mechanism produced more accurate and detailed descriptions than standard causal attention or cross-attention combinations.

    Figure 5: Qualitative comparison showing MMCA providing a more nuanced description of a kitten compared to baseline methods.
  • Efficiency: The framework achieved these results with significantly lower training expenditure than proprietary models.

Limitations and Future Work

  • 70B Challenges: While the framework supports 70B models, the authors noted their initial 70B results were "suboptimal," likely due to hyperparameter tuning issues (like learning rate) that require more exploration.
  • Hallucinations: Like all LLaMa-2 based models, DeepSpeed-VisualChat still suffers from occasional hallucinations.
  • Benchmarking: The paper focuses heavily on qualitative demonstrations; the authors acknowledge that comprehensive benchmarking against standard vision-language suites is a necessary next step.
  • Narrative Data: The model initially lacked storytelling skills, which was only partially mitigated by adding the SparklesDialogue dataset. Future work will likely involve sourcing more diverse narrative-driven multi-modal data.

Summary updated

BibTeX
@misc{yao2023deepspeed,
  author = {Zhewei Yao and Xiaoxia Wu and Conglong Li and Minjia Zhang and Heyang Qin and Olatunji Ruwase and Ammar Ahmad Awan and Samyam Rajbhandari and Yuxiong He},
  title = {{DeepSpeed-VisualChat: Multi-Round Multi-Image Interleave Chat via Multi-Modal Causal Attention}},
  year = {2023},
  eprint = {2309.14327},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.14327},
}
Figure