
swiftformer (image classification)
Image classification295 ops3M params
A mobile-oriented image classifier built on efficient additive attention used in every stage.
Image classification · 348 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
timm.create_model('swiftformer_l1', pretrained=False) This model is SwiftFormer-L1, for which the paper reports a 1.7% absolute gain in top-1 accuracy over EfficientFormer-L1 at the same latency.
About this model's family
SwiftFormer is a series of image classification models built for real-time use on mobile devices. The paper starts from the cost of self-attention, whose quadratic computational complexity with respect to image resolution limits its use in real-time applications on resource-constrained mobile devices.
Its answer is efficient additive attention, which replaces the quadratic matrix multiplication operations with linear element-wise multiplications. The design drops the explicit key-value interaction and uses a linear layer in its place. Because this attention is linear in the token length, it is used in every stage of the network, where convolutional encoder blocks are followed by a SwiftFormer Encoder.
The architecture is based on EfficientFormer, and the paper notes that the SwiftFormer models are built without any neural architecture search. The paper reports 78.5% top-1 ImageNet-1K accuracy with 0.8 ms latency on iPhone 14 for its small variant. For SwiftFormer-L3 it reports 83.0% top-1 accuracy at 1.9 ms.
Key idea. The paper introduces efficient additive attention, which replaces the quadratic matrix multiplications of self-attention with linear element-wise multiplications and can be used at all stages of the network.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{shaker2023swiftformerefficientadditiveattention,
title={SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications},
author={Abdelrahman Shaker and Muhammad Maaz and Hanoona Rasheed and Salman Khan and Ming-Hsuan Yang and Fahad Shahbaz Khan},
year={2023},
eprint={2303.15446},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2303.15446},
}