トランスフォーマーは多状態RNNである
Transformers are Multi-State RNNs
January 11, 2024
著者: Matanel Oren, Michael Hassid, Yossi Adi, Roy Schwartz
cs.AI
要旨
Transformerは、従来の最先端NLPモデルであるリカレントニューラルネットワーク(RNN)とは概念的にも異なると考えられてきました。本研究では、デコーダのみのTransformerが、実際には無限の隠れ状態サイズを持つRNNの変種である無限多状態RNNとして概念化できることを示します。さらに、事前学習済みのTransformerを、隠れ状態のサイズを固定することで有限多状態RNNに変換できることも示します。既存のTransformerキャッシュ圧縮技術のいくつかがこのような変換ポリシーとして捉えられることを観察し、これらのポリシーと比較してよりシンプルな新たなポリシー、TOVAを導入します。いくつかの長距離タスクにおける実験では、TOVAが他のすべてのベースラインポリシーを上回り、完全な(無限の)モデルにほぼ匹敵する性能を示し、場合によっては元のキャッシュサイズの1/8しか使用しないことがわかりました。これらの結果は、TransformerデコーダLLMが実際にはRNNのように振る舞うことが多いことを示しています。また、Transformerの最も深刻な計算上のボトルネックの一つであるキャッシュメモリのサイズを軽減する選択肢を提示しています。私たちはコードをhttps://github.com/schwartz-lab-NLP/TOVAで公開しています。
English
Transformers are considered conceptually different compared to the previous
generation of state-of-the-art NLP models - recurrent neural networks (RNNs).
In this work, we demonstrate that decoder-only transformers can in fact be
conceptualized as infinite multi-state RNNs - an RNN variant with unlimited
hidden state size. We further show that pretrained transformers can be
converted into finite multi-state RNNs by fixing the size of their
hidden state. We observe that several existing transformers cache compression
techniques can be framed as such conversion policies, and introduce a novel
policy, TOVA, which is simpler compared to these policies. Our experiments with
several long range tasks indicate that TOVA outperforms all other baseline
policies, while being nearly on par with the full (infinite) model, and using
in some cases only 1{8} of the original cache size. Our results
indicate that transformer decoder LLMs often behave in practice as RNNs. They
also lay out the option of mitigating one of their most painful computational
bottlenecks - the size of their cache memory. We publicly release our code at
https://github.com/schwartz-lab-NLP/TOVA.