[논문 리뷰] SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
SwiftFormer는 자기주의 행렬 곱셈을 선형 요소 간 연산으로 대체하는 효율적인 덧셈형 어텐션 메커니즘을 제안하여, 모바일 디바이스에서 고정확도·저지연 시간의 비전 트랜스포머를 가능하게 한다. 이 방법은 아이폰 14에서 0.8ms의 추론 지연 시간으로 ImageNet-1K의 상위 1위 정확도 78.5%를 달성하여, 모바일 비전 트랜스포머의 성능 기준을 초월한다.
Self-attention has become a defacto choice for capturing global context in various vision applications. However, its quadratic computational complexity with respect to image resolution limits its use in real-time applications, especially for deployment on resource-constrained mobile devices. Although hybrid approaches have been proposed to combine the advantages of convolutions and self-attention for a better speed-accuracy trade-off, the expensive matrix multiplication operations in self-attention remain a bottleneck. In this work, we introduce a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations with linear element-wise multiplications. Our design shows that the key-value interaction can be replaced with a linear layer without sacrificing any accuracy. Unlike previous state-of-the-art methods, our efficient formulation of self-attention enables its usage at all stages of the network. Using our proposed efficient additive attention, we build a series of models called "SwiftFormer" which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Our small variant achieves 78.5% top-1 ImageNet-1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2x faster compared to MobileViT-v2. Code: https://github.com/Amshaker/SwiftFormer
연구 동기 및 목표
- 비전 트랜스포머에서 자기주의 높은 계산 비용 문제를 해결하기 위해, 특히 모바일 디바이스에서의 성능을 향상시키기 위해.
- 정확도를 유지하거나 향상시키면서도 자기주의 고비용 행렬 곱셈 연산을 제거하기 위해.
- 자기주의 기능을 사용할 수 있는 범위를 후기 단계의 저해상도 단계에 국한하지 않고, 비전 트랜스포머의 모든 단계에 적용할 수 있도록 하기 위해.
- 실시간 모바일 비전 응용 프로그램에서 뛰어난 속도-정확도 트레이드오프를 달성하기 위해.
- 자원 제약이 있는 디바이스에서 다양한 비전 작업에 적합한 일반적이고 효율적인 백본 모델을 개발하기 위해.
제안 방법
- 쿼리-키-밸류 행렬 곱셈을 선형 요소 간 연산으로 대체하는 효율적인 덧셈형 어텐션 메커니즘을 도입하기 위해.
- 자기주의를 쿼리-키 상호작용과 학습 가능한 선형 투영으로 분해하여 명시적인 키-밸류 상호작용을 제거하기 위해.
- 오직 쿼리 및 키 특징만을 사용하여 요소 간 곱셈을 통해 컨텍스트 벡터를 계산함으로써 계산 복잡도를 선형 시간으로 감소시키기 위해.
- 경량화되고 모든 비전 트랜스포머 단계와 호환되는 어텐션 블록을 설계하여 네트워크 전반에 걸쳐 글로벌 컨텍스트 모델링을 가능하게 하기 위해.
- 제안된 효율적인 어텐션 블록을 스택하여 이동형 추론에 최적화된 모델 패밀리인 SwiftFormer를 구성하기 위해.
- 분류, 검출, 세그멘테이션 작업 전반에서 성능을 검증하기 위해 ImageNet-1K, COCO, ADE20K 벤치마크에서 모델을 훈련하고 평가하기 위해.
![Figure 1 : Latency vs Accuracy Comparison . Compared to the recent EfficientFormer-L1 [ 20 ] , our SwiftFormer-L1 achieves an absolute gain of 1.7% in terms of top-1 accuracy with the same latency and without requiring any neural architecture search.](https://ar5iv.labs.arxiv.org/html/2303.15446/assets/Figures/Swiftformer_performance_3.png)
실험 결과
연구 질문
- RQ1정확도를 희생시키지 않고도 자기주의 계산 비용을 실시간으로 모바일 디바이스에 구현할 수 있을까?
- RQ2자기주의의 2차 복잡도를 정확도를 유지하면서 선형 복잡도로 줄일 수 있을까?
- RQ3효율적인 어텐션을 후기 단계의 저해상도 단계에 국한되지 않고, 비전 트랜스포머의 모든 단계에 적용할 수 있을까?
- RQ4자기주의에서 행렬 곱셈을 요소 간 연산으로 대체하면, 모바일 하드웨어에서 더 나은 속도-정확도 트레이드오프를 달성할 수 있을까?
- RQ5모바일 최적화된 트랜스포머 백본 모델이 기존의 최고 수준 모델인 MobileViT-v2와 EfficientFormer보다 정확도와 지연 시간 양면에서 뛰어나게 성능을 냈을까?
주요 결과
- SwiftFormer-L1은 아이폰 14에서 0.8ms의 지연 시간으로 ImageNet-1K에서 78.5%의 상위 1위 정확도를 달성하여, 속도와 정확도 면에서 MobileViT-v2를 모두 뛰어넘었다.
- 소형 SwiftFormer 모델는 MobileViT-v2보다 2배 빠르며 정확도는 0.5% 더 높고, MobileViT-v2 ×2.0보다 3배 빠르며 정확도는 1.8% 향상되었다.
- SwiftFormer-L3는 아이폰 14에서 1.9ms의 지연 시간으로 83.0%의 상위 1위 정확도를 달성하여 이동형 비전 모델의 새로운 SOTA를 수립했다.
- COCO 객체 검출에서 SwiftFormer-L1은 41.2 AP 박스를 기록하여 EfficientFormer-L1보다 3.3점, ResNet18보다 7.2점 높았다.
- 인스턴스 세그멘테이션에서 SwiftFormer-L1은 38.1 AP 마스크를 기록하여 이전 SOTA보다 2.7점 높았다.
- ADE20K 세그멘테이션에서 SwiftFormer-L1은 41.4%의 mIoU를 기록하여 EfficientFormer-L1보다 2.5%p 높고, ResNet18보다 8.5%p 높았다.
![Figure 2 : Comparison with different self-attention modules . (a) is a typical self-attention used in ViTs [ 9 ] . (b) is the transpose self-attention used in EdgeNeXt [ 29 ] , where the self-attention operation is applied across channel feature dimensions (d $\times$ d) instead of the spatial dimen](https://ar5iv.labs.arxiv.org/html/2303.15446/assets/x1.png)
더 나은 연구,지금 바로 시작하세요
논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.