Skip to main content
QUICK REVIEW

[Paper Review] CogVLM: Visual Expert for Pretrained Language Models

Weihan Wang, Qingsong Lv|arXiv (Cornell University)|Nov 6, 2023
Multimodal Machine Learning ApplicationsComputer Science76 citations
TL;DR

CogVLM introduces a trainable visual expert to a frozen pretrained language model, enabling deep fusion of vision-language features and achieving state-of-the-art results on 17 cross-modal benchmarks with a 17B-parameter base.

ABSTRACT

We introduce CogVLM, a powerful open-source visual language foundation model. Different from the popular shallow alignment method which maps image features into the input space of language model, CogVLM bridges the gap between the frozen pretrained language model and image encoder by a trainable visual expert module in the attention and FFN layers. As a result, CogVLM enables deep fusion of vision language features without sacrificing any performance on NLP tasks. CogVLM-17B achieves state-of-the-art performance on 10 classic cross-modal benchmarks, including NoCaps, Flicker30k captioning, RefCOCO, RefCOCO+, RefCOCOg, Visual7W, GQA, ScienceQA, VizWiz VQA and TDIUC, and ranks the 2nd on VQAv2, OKVQA, TextVQA, COCO captioning, etc., surpassing or matching PaLI-X 55B. Codes and checkpoints are available at https://github.com/THUDM/CogVLM.

Motivation & Objective

  • Motivate the need for deeper fusion between vision and language beyond shallow alignment in existing VLMs.
  • Propose a visual expert module that interplays with a frozen LLM to enable deep multimodal fusion without sacrificing NLP capabilities.
  • Show that deep fusion with a trainable visual expert yields competitive or superior performance on standard multi-modal benchmarks.
  • Demonstrate open-source availability of CogVLM weights and training data to advance research and applications in visual understanding.

Proposed method

  • Add a trainable visual expert module to each Transformer layer of the language model, using a dedicated QKV and MLP path for image features that coexist with text features.
  • Map ViT outputs into the language-model feature space via an MLP adapter and share position IDs for image tokens to manage long image sequences.
  • Maintain the GPT-style causal mask across all attention operations, including image-text attention, to preserve autoregressive generation.
  • Pretrain CogVLM-17B on large-scale image-text data (LAION-2B and COYO-700M-derived) with a two-stage regimen: image captioning loss alone, then a mixed captioning and referring expression grounding (REC) objective with occasional resolution to visual grounding tasks.
  • Use a visual grounding dataset (40M images with noun-to-box annotations) to reinforce region-object alignment during pretraining.
  • Fine-tune alignment via two generalist models: CogVLM-Chat for natural language interactions and CogVLM-Grounding for bounding-box grounded tasks.
  • Ablate components (visual expert placement, initialization, attention masking, EMA) to validate the design choices and determine impact on task performance.

Experimental results

Research questions

  • RQ1Can a trainable visual expert in each LLM layer enable deeper fusion between visual and linguistic features without harming pure NLP capabilities?
  • RQ2How does deep fusion compare to shallow alignment methods across diverse multi-modal tasks (captioning, VQA, LVLM, grounding)?
  • RQ3What are the critical factors (visual encoder scale, attention masking, self-supervised image loss, EMA) that influence multimodal pretraining effectiveness?
  • RQ4How does CogVLM perform against state-of-the-art models on standard image captioning, VQA, LVLM benchmarks, and visual grounding datasets?
  • RQ5What are the effects of dataset size, pretraining data composition, and grounding supervision on multimodal generalization?

Key findings

  • CogVLM-17B achieves state-of-the-art or competitive performance across 17 cross-modal benchmarks, including image captioning, VQA, LVLM, and visual grounding tasks.
  • Deep fusion with a trainable visual expert substantially outperforms shallow fusion baselines (e.g., InstructBLIP, MiniGPT-4) across multiple benchmarks.
  • The model demonstrates strong performance on VQA, TextVQA, OCRVQA, and ScienceQA, as well as LVLM benchmarks like MM-Vet, MMBench, SEED-Bench, LLaVA-Bench, POPE, MMMU and MathVista.
  • Visual grounding results reach SOTA levels on several splits (e.g., RefCOCO val/test subsets, RefCOCO+, RefCOCOg), highlighting robust region-phrase alignment.
  • Ablation studies show that initializing the visual expert with LLM weights, using a causal visual attention mask, and including image-related self-supervision contribute positively to performance.
  • CogVLM provides open-source weights and the dataset used in SFT, enabling researchers to build upon the open foundation for visual-language understanding.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.