Skip to main content
QUICK REVIEW

[Paper Review] MSG-Transformer: Exchanging Local Spatial Information by Manipulating Messenger Tokens

Jiemin Fang, Lingxi Xie|arXiv (Cornell University)|May 31, 2021
Advanced Neural Network ApplicationsComputer Science58 references10 citations
TL;DR

This paper proposes MSG-Transformer, a vision Transformer that enhances local spatial information exchange via lightweight Messenger (MSG) tokens, which summarize and relay features between non-overlapping local windows. By replacing direct cross-window attention with MSG token manipulation—especially through a shuffle operation—it achieves state-of-the-art performance on ImageNet (84.0% Top-1 accuracy) and MS-COCO (52.8 mAP) with faster inference, especially on CPU, due to reduced computational overhead and streamlined implementation.

ABSTRACT

Transformers have offered a new methodology of designing neural networks for visual recognition. Compared to convolutional networks, Transformers enjoy the ability of referring to global features at each stage, yet the attention module brings higher computational overhead that obstructs the application of Transformers to process high-resolution visual data. This paper aims to alleviate the conflict between efficiency and flexibility, for which we propose a specialized token for each region that serves as a messenger (MSG). Hence, by manipulating these MSG tokens, one can flexibly exchange visual information across regions and the computational complexity is reduced. We then integrate the MSG token into a multi-scale architecture named MSG-Transformer. In standard image classification and object detection, MSG-Transformer achieves competitive performance and the inference on both GPU and CPU is accelerated. Code is available at https://github.com/hustvl/MSG-Transformer.

Motivation & Objective

  • To address the high computational cost of standard Transformers in vision tasks, especially due to quadratic attention complexity.
  • To overcome limitations of existing local-attention methods like Swin Transformer and HaloNet, which suffer from memory waste, implementation complexity, or restricted communication.
  • To design a modular, flexible framework for local feature exchange that decouples information propagation from patch-level attention computation.
  • To achieve high accuracy with reduced FLOPs and faster inference, particularly on CPU, by minimizing redundant feature transitions and data copies.
  • To enable efficient multi-scale feature learning through a hierarchical, non-overlapping window design with centralized information routing via MSG tokens.

Proposed method

  • Introduce a lightweight Messenger (MSG) token for each local window to summarize and propagate spatial features, replacing direct cross-window attention.
  • Use non-overlapping local windows to reduce computation and memory overhead, avoiding redundant feature copies as in HaloNet or window shifting as in Swin Transformer.
  • Implement a shuffle operation that redistributes MSG token features across different spatial locations, enabling cross-window information exchange with minimal computational cost.
  • Integrate MSG tokens into a multi-scale architecture (MSG-Transformer), where each stage processes features at different resolutions.
  • Design the network so that patch tokens only attend within their local window, while MSG tokens handle inter-window communication, reducing the burden on patch-level attention.
  • Use a hierarchical design with multiple stages, where MSG tokens are updated and shared across feature maps of increasing resolution, enabling multi-level feature learning.

Experimental results

Research questions

  • RQ1Can a centralized, lightweight token mechanism (MSG) effectively replace direct cross-window attention to reduce computational cost in vision Transformers?
  • RQ2How does the proposed MSG-Transformer compare to Swin Transformer in terms of accuracy, FLOPs, and inference speed, especially on CPU?
  • RQ3What is the impact of different shuffle region sizes on the performance and efficiency of MSG-Transformer?
  • RQ4Can MSG tokens be used to flexibly control information exchange patterns without increasing architectural complexity?
  • RQ5Does the MSG-Transformer maintain strong performance across diverse vision tasks like image classification and object detection?

Key findings

  • MSG-Transformer achieves 84.0% Top-1 accuracy on ImageNet classification, outperforming the recent Swin Transformer.
  • On MS-COCO object detection, MSG-Transformer reaches 52.8 mAP, exceeding the performance of Swin Transformer.
  • The model shows significant speed advantages over Swin Transformer, especially on CPU, due to reduced feature transition and memory overhead.
  • The shuffle operation enables effective cross-window information exchange with negligible computational cost, and increasing shuffle region size improves accuracy.
  • The deeper and narrower architecture (64-dim, [2,4,12,4] blocks) achieves better accuracy-computation trade-off in MSG-Transformer than in Swin Transformer.
  • Attention map visualization confirms that MSG tokens in deeper layers focus on object-relevant regions, indicating effective spatial modeling despite local attention.

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.