arXiv reaDer
EcoFormer: 線形の複雑さによる省エネルギーへの配慮
EcoFormer: Energy-Saving Attention with Linear Complexity
Transformer は、シーケンシャル データをモデル化する革新的なフレームワークであり、幅広いタスクで優れたパフォーマンスを達成していますが、計算コストとエネルギー コストが高くなります。その効率を改善するために、一般的な選択肢は、浮動小数点値をバイナリ値に制約するバイナリ化によってモデルを圧縮し、安価なビット演算によりリソース消費を大幅に節約することです。ただし、既存の二値化方法は、入力分布の情報損失を統計的に最小限に抑えることのみを目的としており、注意の中心にあるペアワイズ類似性モデリングを無視しています。この目的のために、EcoFormer と呼ばれる、カーネル化されたハッシュを介して高次元のソフトマックス アテンションにカスタマイズされた新しいバイナリ化パラダイムを提案し、元のクエリとキーをハミング空間の低次元のバイナリ コードにマッピングします。カーネル化されたハッシュ関数は、アテンション マップから抽出されたグラウンド トゥルースの類似関係を自己教師付きの方法で照合するように学習されます。バイナリコードの内積とハミング距離の等価性、および行列乗算の連想特性に基づいて、バイナリコードの内積として表現することにより、注意を線形複雑度で近似できます。さらに、クエリとキーのコンパクトなバイナリ表現により、注意を払っている高価な積和演算のほとんどを単純な累算に置き換えることができ、エッジ デバイスのオンチップ エネルギー フットプリントを大幅に節約できます。視覚と言語の両方のタスクに関する広範な実験により、EcoFormer は、はるかに少ないリソースを消費しながら、標準的な注意を払って同等のパフォーマンスを一貫して達成することが示されています。たとえば、PVTv2-B0 と ImageNet-1K に基づく Ecoformer は、標準の注意と比較してわずか 0.33% のパフォーマンス低下で、73% のオンチップ エネルギー フットプリントの削減を達成します。コードは https://github.com/ziplab/EcoFormer で入手できます。
Transformer is a transformative framework that models sequential data and has achieved remarkable performance on a wide range of tasks, but with high computational and energy cost. To improve its efficiency, a popular choice is to compress the models via binarization which constrains the floating-point values into binary ones to save resource consumption owing to cheap bitwise operations significantly. However, existing binarization methods only aim at minimizing the information loss for the input distribution statistically, while ignoring the pairwise similarity modeling at the core of the attention. To this end, we propose a new binarization paradigm customized to high-dimensional softmax attention via kernelized hashing, called EcoFormer, to map the original queries and keys into low-dimensional binary codes in Hamming space. The kernelized hash functions are learned to match the ground-truth similarity relations extracted from the attention map in a self-supervised way. Based on the equivalence between the inner product of binary codes and the Hamming distance as well as the associative property of matrix multiplication, we can approximate the attention in linear complexity by expressing it as a dot-product of binary codes. Moreover, the compact binary representations of queries and keys enable us to replace most of the expensive multiply-accumulate operations in attention with simple accumulations to save considerable on-chip energy footprint on edge devices. Extensive experiments on both vision and language tasks show that EcoFormer consistently achieves comparable performance with standard attentions while consuming much fewer resources. For example, based on PVTv2-B0 and ImageNet-1K, Ecoformer achieves a 73% on-chip energy footprint reduction with only a 0.33% performance drop compared to the standard attention. Code is available at https://github.com/ziplab/EcoFormer.
updated: Mon Mar 20 2023 04:49:10 GMT+0000 (UTC)
published: Mon Sep 19 2022 13:28:32 GMT+0000 (UTC)
参考文献 (このサイトで利用可能なもの) / References (only if available on this site)
被参照文献 (このサイトで利用可能なものを新しい順に) / Citations (only if available on this site, in order of most recent)
Amazon.co.jpアソシエイト