RoFormer: Enhanced Transformer with Rotary Position Embedding

要約

位置エンコーディングは最近、変圧器アーキテクチャにおいて効果的であることが示されています。
これにより、シーケンスの異なる位置にある要素間の依存関係モデリングの貴重な監視が可能になります。
この論文では、まず位置情報をトランスフォーマーベースの言語モデルの学習プロセスに統合するためのさまざまな方法を調査します。
そこで、位置情報を効果的に活用するための新しい手法「Rotary Position Embedding(RoPE)」を提案します。
具体的には、提案された RoPE は、回転行列を使用して絶対位置をエンコードし、同時にセルフアテンションの定式化に明示的な相対位置依存性を組み込みます。
特に、RoPE は、シーケンス長の柔軟性、相対距離の増加に伴うトークン間の依存関係の減衰、相対位置エンコーディングによる線形セルフアテンションの装備などの貴重な特性を可能にします。
最後に、RoFormer とも呼ばれる回転位置埋め込みを備えた拡張トランスフォーマーを、さまざまな長文分類ベンチマーク データセットで評価します。
私たちの実験は、それが常に代替案を克服していることを示しています。
さらに、いくつかの実験結果を説明する理論的分析を提供します。
RoFormer はすでに Huggingface: \url{https://huggingface.co/docs/transformers/model_doc/roformer} に統合されています。

要約(オリジナル)

Position encoding recently has shown effective in the transformer architecture. It enables valuable supervision for dependency modeling between elements at different positions of the sequence. In this paper, we first investigate various methods to integrate positional information into the learning process of transformer-based language models. Then, we propose a novel method named Rotary Position Embedding(RoPE) to effectively leverage the positional information. Specifically, the proposed RoPE encodes the absolute position with a rotation matrix and meanwhile incorporates the explicit relative position dependency in self-attention formulation. Notably, RoPE enables valuable properties, including the flexibility of sequence length, decaying inter-token dependency with increasing relative distances, and the capability of equipping the linear self-attention with relative position encoding. Finally, we evaluate the enhanced transformer with rotary position embedding, also called RoFormer, on various long text classification benchmark datasets. Our experiments show that it consistently overcomes its alternatives. Furthermore, we provide a theoretical analysis to explain some experimental results. RoFormer is already integrated into Huggingface: \url{https://huggingface.co/docs/transformers/model_doc/roformer}.

arxiv情報

著者 Jianlin Su,Yu Lu,Shengfeng Pan,Ahmed Murtadha,Bo Wen,Yunfeng Liu
発行日 2023-11-08 13:36:32+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL, cs.LG パーマリンク