EATFormer: Improving Vision Transformer Inspired by Evolutionary Algorithm

Jiangning Zhang, Xiangtai Li, Yabiao Wang, Chengjie Wang, Yibo Yang, Yong Liu, Dacheng Tao

TL;DR

EATFormer introduces a novel Vision Transformer (ViT) architecture by establishing a formal mathematical analogy between ViTs and Evolutionary Algorithms (EAs). By incorporating design principles from advanced EA variants, the authors develop a highly efficient pyramid backbone that achieves state-of-the-art performance across image classification, object detection, and semantic segmentation while significantly reducing computational overhead.

What Problem Does This Paper Address?

While Vision Transformers (ViTs) have achieved remarkable success in computer vision, many architectural modifications remain purely empirical. Researchers frequently borrow structural designs from Convolutional Neural Networks (CNNs) without a clear theoretical understanding of why these combinations work.

This paper addresses this lack of interpretability by providing a biological and mathematical framework. The authors demonstrate that the standard components of a Transformer block correspond directly to the core mechanisms of Evolutionary Algorithms (EAs). Using this insight, they systematically address common ViT limitations, such as the rigid processing of uniform grids and the computational inefficiency of mixing task-specific tokens with spatial patch embeddings.

Methods

The authors first prove that the mathematical formulations of Multi-Head Self-Attention (MSA) and Feed-Forward Networks (FFN) are functionally equivalent to the Crossover and Mutation operators in EAs.

Comparisons of structural analogousness between the Transformer module and evolutionary algorithms.

Inspired by advanced EA variants, they propose the EATFormer backbone, constructed from a unified Evolutionary Algorithm-based Transformer (EAT) block. Each block is composed of three residual modules:

  1. Multi-Scale Region Aggregation (MSRA): Inspired by multi-population EAs that search different regions to enhance diversity, MSRA uses a multi-branch depth-wise convolution design to aggregate features from various receptive fields. It utilizes a Weighted Operation Mixing (WOM) mechanism to adaptively balance these branches.
  2. Global and Local Interaction (GLI): Drawing from Memetic Algorithms (which combine global search with local optimization), GLI splits features at the channel level. One path handles local feature extraction via convolutions, while the parallel path models global interactions.
  3. Feed-Forward Network (FFN): Performs individual feature enhancement, acting as a directional mutation operator.
Paradigm of the proposed basic EAT Block.

Additionally, the authors introduce two architecture-level enhancements:

  • Modulated Deformable MSA (MD-MSA): Replaces standard global attention in the GLI module to dynamically adjust to irregular, non-grid spatial structures in images by predicting data-dependent offsets and modulation scalars.
  • Task-Related Head (TRH): Instead of appending a [CLS] token from the first layer (which introduces distribution mismatch and extra computation), the TRH uses a late-stage cross-attention mechanism to fuse spatial features specifically for the target task.

Datasets

The EATFormer architecture was comprehensively evaluated on three standard computer vision benchmarks:

  • ImageNet-1K: For image classification performance, throughput, and efficiency scaling.
  • MS COCO 2017: Docked with Mask R-CNN for downstream object detection and instance segmentation.
  • ADE20K: Integrated with UperNet for pixel-level semantic segmentation.

Key Insights and Ideas

  • The ViT-EA Equivalence: Patch tokens act as an evolving population. MSA serves as a dense global crossover operator where tokens exchange information, while the FFN acts as a directional mutation operator that refines individual tokens under the constraint of the loss function.
  • Channel-Split Locality: Instead of applying heavy attention mechanisms across all channels, splitting channels between local convolutions and global attention (GLI) preserves global modeling capabilities while introducing a strong inductive bias for locality at a fraction of the computational cost.
  • Late-Stage Task Fusion: Treating multi-task learning as a multi-objective optimization problem reveals that forcing a single classification token through every single transformer layer is sub-optimal. Decoupling task tokens via the TRH head keeps the backbone focused entirely on representation learning.

Key Results

EATFormer establishes a highly competitive Pareto frontier across accuracy, parameter count, and throughput speed.

Comparison with SOTA models in terms of Top-1 accuracy vs. GPU throughput on ImageNet-1K.

Image Classification (ImageNet-1K)

  • EATFormer-Mobile (1.8M params): Achieves 69.4% Top-1 accuracy with an impressive throughput of 3,926 images/second on a single NVIDIA V100 GPU.
  • EATFormer-Base (49.0M params): Reaches 83.9% Top-1 accuracy (and 84.9% when scaled to 384×384 resolution), outperforming contemporary models like MPViT and Swin Transformer while running significantly faster on both GPU and CPU.

Downstream Tasks

  • Object Detection (COCO): EATFormer-Tiny paired with Mask R-CNN achieves 45.4 box AP and 41.4 mask AP, surpassing Swin-T and MPViT-T with fewer FLOPs.
  • Semantic Segmentation (ADE20K): EATFormer-Small achieves 47.3 mIoU, outperforming Swin-T by 2.8 points.

Limitations and Future Work

  • Heuristic Architecture Design: The hyper-parameters of EATFormer (such as embedding dimensions, separation ratios in GLI, and dilation rates in MSRA) were designed based on human intuition and manual ablation. The authors note that employing Neural Architecture Search (NAS) could optimize these configurations further.
  • Scale Constraints: Due to computational limits, the authors did not train extremely large variants (e.g., >100M parameters) or pre-train on massive datasets like ImageNet-21K.
  • Future Directions: The authors plan to explore combining the EATFormer backbone with self-supervised learning frameworks to evaluate its representation capacity without dense supervision.

Summary updated

BibTeX
@article{zhang2024eatformer,
  author = {Jiangning Zhang and Xiangtai Li and Yabiao Wang and Chengjie Wang and Yibo Yang and Yong Liu and Dacheng Tao},
  title = {{EATFormer: Improving Vision Transformer Inspired by Evolutionary Algorithm}},
  journal = {Int. J. Comput. Vis.},
  year = {2024},
  doi = {10.1007/s11263-024-02034-6},
}
Figure