Skip to main content
QUICK REVIEW

[Paper Review] AutoFormer: Searching Transformers for Visual Recognition

Minghao Chen, Houwen Peng|arXiv (Cornell University)|Jul 1, 2021
Advanced Neural Network ApplicationsComputer Science70 references15 citations
TL;DR

AutoFormer proposes a one-shot neural architecture search framework for vision transformers using a novel weight entanglement strategy that enables thousands of subnetworks to be well-trained within a single supernet, achieving state-of-the-art accuracy on ImageNet (82.4% top-1 with 53.7M parameters) without retraining, outperforming prior handcrafted models like ViT and DeiT.

ABSTRACT

Recently, pure transformer-based models have shown great potentials for vision tasks such as image classification and detection. However, the design of transformer networks is challenging. It has been observed that the depth, embedding dimension, and number of heads can largely affect the performance of vision transformers. Previous models configure these dimensions based upon manual crafting. In this work, we propose a new one-shot architecture search framework, namely AutoFormer, dedicated to vision transformer search. AutoFormer entangles the weights of different blocks in the same layers during supernet training. Benefiting from the strategy, the trained supernet allows thousands of subnets to be very well-trained. Specifically, the performance of these subnets with weights inherited from the supernet is comparable to those retrained from scratch. Besides, the searched models, which we refer to AutoFormers, surpass the recent state-of-the-arts such as ViT and DeiT. In particular, AutoFormer-tiny/small/base achieve 74.7%/81.7%/82.4% top-1 accuracy on ImageNet with 5.7M/22.9M/53.7M parameters, respectively. Lastly, we verify the transferability of AutoFormer by providing the performance on downstream benchmarks and distillation experiments. Code and models are available at https://github.com/microsoft/AutoML.

Motivation & Objective

  • To automate the design of vision transformer architectures, overcoming the limitations of manual hyperparameter tuning.
  • To address the challenge of efficiently searching diverse transformer architectures under varying resource constraints.
  • To develop a supernet training strategy that enables direct inference of subnetworks without fine-tuning or retraining.
  • To improve model performance on image classification and downstream tasks through automated architecture search.
  • To demonstrate transferability and distillation potential of searched models across benchmarks.

Proposed method

  • Proposes a one-shot architecture search framework, AutoFormer, tailored for vision transformers.
  • Introduces a weight entanglement strategy that shares weights across blocks within the same layer, enabling joint optimization.
  • Constructs a large search space including depth, embedding dimension, number of heads, MLP ratio, and query/key/value dimensions.
  • Trains a single supernet with entangled weights, allowing subnetworks to inherit high-quality parameters directly.
  • Performs evolutionary search under model size constraints to identify optimal architectures.
  • Employs a training recipe that maintains performance parity between inherited and retrained subnetworks.

Experimental results

Research questions

  • RQ1Can a one-shot NAS framework be effectively applied to vision transformers, given their unique architectural characteristics?
  • RQ2Does weight entanglement in the supernet training process lead to well-trained subnetworks that require no additional fine-tuning?
  • RQ3Can the proposed method discover vision transformer architectures that surpass handcrafted SOTA models like ViT and DeiT?
  • RQ4How well do the searched AutoFormers generalize to downstream vision tasks and distillation settings?
  • RQ5Is the weight entanglement strategy more effective than existing NAS methods for transformer-based models?

Key findings

  • AutoFormer-tiny, small, and base achieve 74.7%, 81.7%, and 82.4% top-1 accuracy on ImageNet, respectively.
  • With 22.9M parameters, AutoFormer-small outperforms DeiT-S (81.7% vs. 79.9%) and ViT-S/16 (81.7% vs. 78.8%).
  • The performance of subnetworks inherited from the supernet is comparable to those retrained from scratch, validating the effectiveness of weight entanglement.
  • AutoFormers show strong transferability to downstream classification benchmarks, achieving better or comparable results than EfficientNet.
  • Distillation experiments further improve the performance of AutoFormers, confirming their compatibility with knowledge distillation.
  • The proposed weight entanglement strategy enables a once-for-all training paradigm without additional techniques like regularization or distillation.

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.