Upgrade to Pro — share decks privately, control downloads, hide ads and more …

論文解説 EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention

koharite
January 25, 2024

論文解説 EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention

Presentation for explaining the paper "EfficientViT "presented from Microsoft Research, The Chinese University of Hong Kong.
EfficientViT is designed high recognition performance with high throughput in real devices.

koharite

January 25, 2024
Tweet

More Decks by koharite

Other Decks in Research

Transcript

  1. 2 論⽂情報 タイトル: EfficientViT: Memory Efficient Vision Transformer with Cascaded

    Group Attention • 論⽂: https://arxiv.org/abs/2305.07027 • コード: https://github.com/microsoft/Cream/tree/main/EfficientViT • 投稿学会: CVPR2023 • 著者: Xinyu Liu, Houwen Peng, Ningxin Zheng, Yuqing Yang, Han Hu, Yixuan Yuan • 所属: The Chinese University of Hong Kong, Microsoft Research 選んだ理由: • Vision Transformerをエッジデバイスなどで⾼速に実⾏するためにはどのような 構成にすればよいか学ぶことができそう
  2. 3 Vision Transformer 画像分野においてもTransformerの利⽤が広がってきた。 ただし、⾼い性能が⽰されているものはサイズが⼤きなモデルが多い。 最近、軽量なVision Transformer modelも提案されてきた。 ただし、model parameter数やFlopsによる計測は、

    実際のモデルのinference throughputとずれがあることも多い。 ex.) MobileViT-XSは700M Flopsで、DeiT-Tは1,220M Flopsだが、 Nvidia V100 GPUで実⾏するとDeiT-Tのほうが早い 実際にinferenceを実⾏するときにThroughputが⾼いViTの構造を本⼿法で紹介する。
  3. 5 Good throughput with good recognition l Memory-efficiency l Parameter-efficiency

    Multi-head self-attention(MHSA)はメモリによる速度制約の影響⼤ parameter reallocation(Pruning) MHSAをFFNで挟むsandwich layout l Computation redundancy Multi-headの類似性を減らす (cascaded group attention[CGA])
  4. 7 Transformer Attention is All You Need https://arxiv.org/abs/1706.03762 Transformer Architecture

    Transformer Block Q K V Multi-Head Attention Add & Norm Feed Forward Add & Norm
  5. 8 Single Head Self Attention Attention is All You Need

    https://arxiv.org/abs/1706.03762 Q K V Linear Linear Linear Scaled Dot-Product Attention Multi head attentionの前にSingle Head Attentionの振り返り
  6. 10 MHSA proportions memory-inefficient layersを減らす構成を考える。 従来のViTではMHSA(Multi Head Self Attention)がFFN(Feed Forward

    Network)と同等数使われることが多い。 しかし、MHSAはFFNよりmemory-inefficient なoperationsが多い。 MHSAの割合を変えた場合、20~40%の割合のときに性能が良かった。 Swin-T-1.25xで20%のMHSAを採⽤すると、Memory-bound operationsが減少し合計のruntimeは 44.26%になった。
  7. 12 Parameter Efficiency Typical ViTs mainly inherit the design strategies

    from NLP transformer [71], e.g., using an equivalent width for Q,K,V projections, increasing heads over stages, and setting the expansion ratio to 4 in FFN. Taylor structured pruning*により、パラメータの縮⼩を⾏う。 重要でないchannelsの削除 * Importance Estimation for Neural Network Pruning https://arxiv.org/abs/1906.10771 Swin-T
  8. 13 Taylor structured pruning Overview Importance Estimation for Neural Network

    Pruning https://arxiv.org/abs/1906.10771 重要度の⼩さい層を除去する ある層をなくしたとき(wm =0)の誤差を測れればよいが・・・、 全ての層についてなくしたパターンを計算するのは⼤変。 Taylor展開で近似する。 1st order 2nd order 𝑔! = 𝜕𝐸 𝜕𝜔! 𝐻",$ = 𝜕%𝐸 𝜕𝜔" 𝜕𝜔$ いくつかの層のグループ(S)による重要度計算は下のようになる。
  9. 16 Sandwich layout To build up a memory-efficient block, we

    propose a sandwich layout that employs less memory-bound self-attention layers and more memory-efficient FFN layers for channel communication. Single attention layer 1つのAttention layerをN個のFFNで挟む Token InteractionとしてDWConv (Depthwise Convolution)を使う
  10. 19 Experiments ImageNet-1K • PyTorch 1.11.0, Timm 0.5.4 • 8

    Nvidia V100 GPUでscratchで300epochs, batch size 2,048 • AdamW optimizer, cosine learning rate scheduler train inference • GPU: Nvidia V100 • CPU: Intel Xeon E5-2690 v4 @ 2.6-GHz
  11. 25 Ablation Study 同等速度では3%精度低下 FFNの数を増やしても精 度低下 Cascade Group Attention が精度にも寄与

    有効なパラメータにすること で同等速度に対する精度を上 げることができる。