ChatPaper.aiChatPaper

EfficientViT: Trasformatore Visivo Efficiente in Memoria con Attenzione a Gruppi a Cascata

EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention

May 11, 2023
Autori: Xinyu Liu, Houwen Peng, Ningxin Zheng, Yuqing Yang, Han Hu, Yixuan Yuan
cs.AI

Abstract

I vision transformer hanno dimostrato un grande successo grazie alle loro elevate capacità di modellazione. Tuttavia, le loro prestazioni eccezionali sono accompagnate da costi computazionali elevati, il che li rende inadatti per applicazioni in tempo reale. In questo articolo, proponiamo una famiglia di vision transformer ad alta velocità denominata EfficientViT. Abbiamo osservato che la velocità dei modelli transformer esistenti è comunemente limitata da operazioni inefficienti in termini di memoria, in particolare il ridimensionamento dei tensori e le funzioni elemento per elemento nell'MHSA. Pertanto, abbiamo progettato un nuovo blocco costitutivo con una disposizione a sandwich, ovvero utilizzando un singolo MHSA vincolato dalla memoria tra efficienti strati FFN, che migliora l'efficienza della memoria mentre potenzia la comunicazione tra i canali. Inoltre, abbiamo scoperto che le mappe di attenzione condividono un'elevata somiglianza tra le teste, portando a una ridondanza computazionale. Per affrontare questo problema, presentiamo un modulo di attenzione a gruppi in cascata che alimenta le teste di attenzione con diverse suddivisioni della feature completa, il quale non solo riduce i costi computazionali ma migliora anche la diversità dell'attenzione. Esperimenti completi dimostrano che EfficientViT supera i modelli efficienti esistenti, trovando un buon compromesso tra velocità e accuratezza. Ad esempio, il nostro EfficientViT-M5 supera MobileNetV3-Large dell'1,9% in accuratezza, ottenendo un throughput più alto del 40,4% e del 45,2% rispettivamente su GPU Nvidia V100 e CPU Intel Xeon. Rispetto al recente modello efficiente MobileViT-XXS, EfficientViT-M2 raggiunge un'accuratezza superiore dell'1,8%, mentre è 5,8x/3,7x più veloce su GPU/CPU e 7,4x più veloce quando convertito in formato ONNX. Codice e modelli sono disponibili su https://github.com/microsoft/Cream/tree/main/EfficientViT.
English
Vision transformers have shown great success due to their high model capabilities. However, their remarkable performance is accompanied by heavy computation costs, which makes them unsuitable for real-time applications. In this paper, we propose a family of high-speed vision transformers named EfficientViT. We find that the speed of existing transformer models is commonly bounded by memory inefficient operations, especially the tensor reshaping and element-wise functions in MHSA. Therefore, we design a new building block with a sandwich layout, i.e., using a single memory-bound MHSA between efficient FFN layers, which improves memory efficiency while enhancing channel communication. Moreover, we discover that the attention maps share high similarities across heads, leading to computational redundancy. To address this, we present a cascaded group attention module feeding attention heads with different splits of the full feature, which not only saves computation cost but also improves attention diversity. Comprehensive experiments demonstrate EfficientViT outperforms existing efficient models, striking a good trade-off between speed and accuracy. For instance, our EfficientViT-M5 surpasses MobileNetV3-Large by 1.9% in accuracy, while getting 40.4% and 45.2% higher throughput on Nvidia V100 GPU and Intel Xeon CPU, respectively. Compared to the recent efficient model MobileViT-XXS, EfficientViT-M2 achieves 1.8% superior accuracy, while running 5.8x/3.7x faster on the GPU/CPU, and 7.4x faster when converted to ONNX format. Code and models are available at https://github.com/microsoft/Cream/tree/main/EfficientViT.
PDF41December 15, 2024