InternLM-XComposer: A Vision-Language Large Model for Advanced Text-image Comprehension and Composition

Pan Zhang, Xiaoyi Dong, Bin Wang, Yuhang Cao, Chao Xu, Linke Ouyang, Zhiyuan Zhao, Haodong Duan, Songyang Zhang, Shuangrui Ding, Wenwei Zhang, Hang Yan, Xinyue Zhang, Wei Li, Jingwen Li, Kai Chen, Conghui He, Xingcheng Zhang, Yu Qiao, Dahua Lin, Jiaqi Wang

TL;DR

InternLM-XComposer is an advanced vision-language large model (VLLM) designed to seamlessly handle both text-image comprehension and interleaved text-image composition. By utilizing a decoupled text-generation, image-spotting, and context-aware image selection pipeline, it can automatically write long-form articles and insert highly relevant, realistic images. The model achieves state-of-the-art performance across multiple multimodal benchmarks and demonstrates composition quality on par with commercial solutions like GPT-4V.

What Problem Does This Paper Address?

While existing Vision-Language Large Models (VLLMs) excel at generating text from images (e.g., image captioning or Visual Question Answering), they are generally limited to pure text outputs. They struggle with interleaved text-image composition—the ability to generate long-form articles where text and contextually relevant images are seamlessly integrated to create an immersive reading experience.

Additionally, standard vision-language datasets are dwarfed by the massive text corpora used to train pure LLMs. This data scarcity leads to a "long-tail" problem, where VLLMs lack the diverse, real-world visual concepts required to understand complex or niche imagery across multiple languages.

Methods

InternLM-XComposer bridges this gap using a specialized architecture and a unique, decoupled composition pipeline:

  1. Model Architecture: The model integrates three core components:
  2. Visual Encoder: A pre-trained EVA-CLIP model that extracts detailed image patches.
  3. Perceive Sampler: A BERT-base structure utilizing cross-attention layers to pool and condense 257 initial image embeddings down to 64 refined tokens compatible with the LLM.
  4. LLM Backbone: InternLM-Chat-7B, a powerful multilingual foundational language model.
Figure 2. The architecture and training regimen of the InternLM- XComposer. The Pre-training stage aligns the visual and language knowledge and the SFT stage excites different model capabilities.
  1. Training Regimen: Training is split into a Pre-training Stage (freezing the visual encoder while aligning the sampler and LLM on next-token prediction) and a Supervised Fine-Tuning (SFT) Stage (using Low-Rank Adaptation (LoRA) to activate multi-task capabilities and instruction following).
  2. Decoupled Composition Pipeline: Instead of relying on text-to-image diffusion models, which can produce unrealistic or contextually disjointed graphics, InternLM-XComposer uses a three-step retrieval-based approach:
  3. Text Generation: The model writes a text-based article from a user prompt.
  4. Image Spotting and Captioning: It automatically identifies optimal locations within the text to insert images and generates descriptive captions for what those images should contain.
  5. Image Retrieval and Selection: A first pass uses CLIP to retrieve top candidate images from a web-crawled repository. Crucially, InternLM-XComposer then acts as the final judge, evaluating the candidate images against the entire preceding text and prior images to select the most contextually coherent option.
Figure 3. The pipeline of the interleaved image-text composition. (a) Given a writing instruction, the model initially generates a corresponding text-based article. (b) Subsequent to the article generation, the model is trained to identify suitable image locations and generate corresponding captions for the ensuing steps. (c) A text-image retrieval algorithm is initially employed to constrict the pool of candidate images. Following this, our model leverages its vision-language understanding ability to make the final image selection, ensuring thematic and visual coherence by considering both the preceding textual content and images within the article.

Datasets

  • Pre-training Data: A massive corpus consisting of 1.1 billion images and 77.7 billion text tokens. To solve the long-tail concept issue, the authors introduced a curated In-house Concept dataset containing over 11 million high-quality vision-language concepts extracted from encyclopedic websites like Wikipedia and Baidu Baike.
  • SFT & Evaluation Benchmarks: Multi-task training utilized standard datasets like COCO, TextCaps, VQAv2, and LLaVA-150k. The model was evaluated across mainstream English benchmarks (MME, MMBench, Seed-Bench, QBench, Tiny LVLM) and Chinese benchmarks (MMBench-CN, CCBench).

Key Insights and Ideas

  • Retrieval over Generation: Sourcing real-world web images rather than generating them synthetically ensures higher realism and visual consistency across long-form documents.
  • VLLM as a Contextual Filter: Traditional text-to-image retrieval (like standard CLIP) evaluates image-caption pairs in isolation. By using the VLLM to make the final selection from a candidate pool, the system ensures document-level coherence, matching the image to the broader narrative context.
  • Linguistic Parity: By mixing pure text data with multilingual vision-language data during pre-training, the model minimizes the performance degradation typically seen when moving from English to Chinese benchmarks.

Key Results

InternLM-XComposer achieves top-tier performance in both comprehension and composition:

  • Comprehension Benchmarks: It achieved a state-of-the-art score of 1919.5 on the MME Benchmark (outperforming Qwen-VL-Chat by over 5%) and 74.4% accuracy on MMBench.
  • Multilingual Robustness: On MMBench-CN (Chinese), it scored 72.4%, demonstrating only a minor 2.0% performance drop compared to its English baseline, outperforming competing models whose performance degraded by up to 7.9%.
  • Composition Evaluation: Because quantitative metrics for interleaved articles are lacking, the authors implemented a robust evaluation framework using human experts and GPT-4V. InternLM-XComposer consistently outperformed open-source alternatives (like Qwen-14B and InternLM-20B) and performed competitively alongside GPT-4V.
Figure 1. The InternLM-XComposer shows excellent interleaved composition and text-image comprehension ability, leading to strong performance on various multi-modal benchmarks. For the Interleaved Composition Evaluation by both Human and GPT4-Vision (GPT4- V), our model shows competitive performance to GPT4-Vision and GPT3.5.

Limitations and Future Work

  • Repository Dependence: The quality of the final interleaved article depends heavily on the size and diversity of the underlying image repository. If the pool lacks niche images matching the generated caption, selection quality degrades.
  • Evaluation Subjectivity: Assessing interleaved text-image generation still relies heavily on subjective human or LLM-based scoring due to the lack of automated, standardized quantitative metrics for multimedia documents.
  • Future Directions: The authors suggest exploring hybrid approaches that can seamlessly switch to text-to-image generation models when high-quality retrieval candidates are unavailable.

Summary updated

BibTeX
@misc{zhang2023internlm,
  author = {Pan Zhang and Xiaoyi Dong and Bin Wang and Yuhang Cao and Chao Xu and Linke Ouyang and Zhiyuan Zhao and Haodong Duan and Songyang Zhang and Shuangrui Ding and Wenwei Zhang and Hang Yan and Xinyue Zhang and Wei Li and Jingwen Li and Kai Chen and Conghui He and Xingcheng Zhang and Yu Qiao and Dahua Lin and Jiaqi Wang},
  title = {{InternLM-XComposer: A Vision-Language Large Model for Advanced Text-image Comprehension and Composition}},
  year = {2023},
  eprint = {2309.15112},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.15112},
}
Figure