Skip to main content
QUICK REVIEW

[Paper Review] Frozen Transformers in Language Models Are Effective Visual Encoder Layers

Ziqi Pang, Ziyang Xie|arXiv (Cornell University)|Oct 19, 2023
Multimodal Machine Learning ApplicationsComputer Science11 citations
TL;DR

The paper shows that frozen transformer blocks from pre-trained LLMs can serve as effective visual encoder layers across a wide range of 2D/3D and vision-language tasks, without language prompts or multi-modal pretraining.

ABSTRACT

This paper reveals that large language models (LLMs), despite being trained solely on textual data, are surprisingly strong encoders for purely visual tasks in the absence of language. Even more intriguingly, this can be achieved by a simple yet previously overlooked strategy -- employing a frozen transformer block from pre-trained LLMs as a constituent encoder layer to directly process visual tokens. Our work pushes the boundaries of leveraging LLMs for computer vision tasks, significantly departing from conventional practices that typically necessitate a multi-modal vision-language setup with associated language prompts, inputs, or outputs. We demonstrate that our approach consistently enhances performance across a diverse range of tasks, encompassing pure 2D and 3D visual recognition tasks (e.g., image and point cloud classification), temporal modeling tasks (e.g., action recognition), non-semantic tasks (e.g., motion forecasting), and multi-modal tasks (e.g., 2D/3D visual question answering and image-text retrieval). Such improvements are a general phenomenon, applicable to various types of LLMs (e.g., LLaMA and OPT) and different LLM transformer blocks. We additionally propose the information filtering hypothesis to explain the effectiveness of pre-trained LLMs in visual encoding -- the pre-trained LLM transformer blocks discern informative visual tokens and further amplify their effect. This hypothesis is empirically supported by the observation that the feature activation, after training with LLM transformer blocks, exhibits a stronger focus on relevant regions. We hope that our work inspires new perspectives on utilizing LLMs and deepening our understanding of their underlying mechanisms. Code is available at https://github.com/ziqipang/LM4VisualEncoding.

Motivation & Objective

  • Demonstrate that frozen LLM transformer blocks can function as general-purpose visual encoders for purely visual tasks.
  • Show that this approach improves performance across diverse tasks and modalities without relying on language inputs.
  • Propose an explanation for why pre-trained LLMs enhance visual encoding through an information filtering mechanism.

Proposed method

  • Insert a frozen LLM transformer block between a visual encoder and decoder, with trainable linear layers before and after to align dimensions.
  • Keep the LLM block frozen during training while training all other modules.
  • Evaluate across diverse tasks including 2D/3D classification, action recognition, motion forecasting, and vision-language tasks.
  • Compare results using different LLMs (e.g., LLaMA, OPT) and transformer blocks to show generality.
  • Propose the information filtering hypothesis to explain improved visual encoding by highlighting informative visual tokens.
  • Provide implementations and experiments across image, point cloud, video, motion forecasting, and VL benchmarks.
(a) Architecture
(a) Architecture

Experimental results

Research questions

  • RQ1Can frozen transformer blocks from pre-trained LLMs serve as effective visual encoders without language prompts?
  • RQ2Do frozen LLM transformers improve performance across a broad spectrum of visual and vision-language tasks?
  • RQ3What mechanisms explain why LLM transformers aid visual encoding (e.g., information filtering of informative tokens)?

Key findings

  • Incorporating a frozen LLM transformer block on top of a visual encoder consistently improves accuracy and robustness across image classification benchmarks.
  • The improvement is observed across 2D and 3D recognition tasks, video action recognition, motion forecasting, and 2D/3D vision-language tasks.
  • The benefits generalize across different LLMs (e.g., LLaMA, OPT) and different transformer blocks.
  • Finetuning the LLM transformer can reduce performance, suggesting freezing is often more effective and simpler.
  • The information filtering hypothesis explains that the frozen LLM transformer helps concentrate informative visual tokens, boosting their downstream impact.
  • Larger-scale LLMs and selecting appropriate transformer layers are important for achieving improvements.
(b) Pseudo-Code
(b) Pseudo-Code

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.