Skip to main content
QUICK REVIEW

[論文レビュー] Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention

Yunyang Xiong, Zhanpeng Zeng|arXiv (Cornell University)|Feb 7, 2021
Topic Modeling参考文献 60被引用数 29
ひとこと要約

Nyströmformerは自己注意のNyströmベース近似を導入し、O(n) 時間とメモリを実現、長いシーケンスに対して効率的なTransformersを可能にしつつ、競争力のある性能を維持します。

ABSTRACT

Transformers have emerged as a powerful tool for a broad range of natural language processing tasks. A key component that drives the impressive performance of Transformers is the self-attention mechanism that encodes the influence or dependence of other tokens on each specific token. While beneficial, the quadratic complexity of self-attention on the input sequence length has limited its application to longer sequences -- a topic being actively studied in the community. To address this limitation, we propose Nyströmformer -- a model that exhibits favorable scalability as a function of sequence length. Our idea is based on adapting the Nyström method to approximate standard self-attention with $O(n)$ complexity. The scalability of Nyströmformer enables application to longer sequences with thousands of tokens. We perform evaluations on multiple downstream tasks on the GLUE benchmark and IMDB reviews with standard sequence length, and find that our Nyströmformer performs comparably, or in a few cases, even slightly better, than standard self-attention. On longer sequence tasks in the Long Range Arena (LRA) benchmark, Nyströmformer performs favorably relative to other efficient self-attention methods. Our code is available at https://github.com/mlpen/Nystromformer.

研究の動機と目的

  • 長いシーケンスに対するTransformersモデルで、スケーラブルな自己注意の必要性を動機づける。
  • 全ソフトマックス自己注意を線形計算量で置換するNyströmベースの近似を提案する。
  • ソフトマックス行列を近似するためのランドマーク(Nyström)戦略と反復疑似逆行列法を開発する。
  • 標準的なNLPベンチマークと長いシーケンス課題で手法を評価し、基準法に対する精度と効率を比較する。

提案手法

  • 自己注意を S = softmax(QK^T / sqrt(d_q)) と表現し、Nyström法を用いて S を O(n) の計算量で近似することを目指す。
  • ランドマークを Q- および K-ベースで導入し、ランドマーク上の softmax によって小さな m x m 行列 A_S を形成し、そのMoore-Penrose逆を計算する。
  • Nyström-form の近似 hat{S} を導出する: hat{S} = softmax(Q ~K^T / sqrt(d_q)) A_S^+ softmax(~Q K^T / sqrt(d_q)).
  • Segment-means を用いたランドマーク選択を適用し、Q-ランドマークおよび K-ランドマークを O(n) で効率的に計算する。
  • コストの高いSVDを避けるために反復法を用いて A_S の Moore-Penrose 逆 Z^* を計算し、実務上は約6回の反復で安定化する。
  • 自己注意出力を hat{S} V と近似し、V 上の depthwise conv によるスキップ接続と統合された線形時間の自己注意モジュールを得る。

実験結果

リサーチクエスチョン

  • RQ1ソフトマックス自己注意のNyströmベース近似は、NLPベンチマークで標準の注意と同等の精度を達成できるか。
  • RQ2Nyströmformer はシーケンス長に対して線形の時間とメモリ計算量を維持しつつ性能を保つか。
  • RQ3Nyströmformer は他の効率的自己注意手法と比較して長いシーケンス課題でどう性能を示すか。
  • RQ4実用的な学習におけるランドマーク選択(Segment-means)と疑似逆近似のトレードオフは何か。

主な発見

  • NyströmformerはGLUEとIMDBでベースラインBERTと同等かわずかに上回る性能を、顕著な効率向上とともに達成する。
  • 長距離タスク(Long Range Arena)では、Nyströmformerは他の効率的自己注意手法(例:Reformer、Linformer、Performer)と比べて有利に機能する。
  • ランドマーク数 m が n に比してはるかに小さい場合、手法は時間とメモリの両方でシーケンス長 n に対して線形にスケールする。
  • Segment-means ランドマーク選択により、最小限のオーバーヘッドで O(n) の計算を実現する。
  • 実証的な結果は、Nyströmformer が標準の自己注意に近い精度を維持しつつ、いくつかの線形注意変種よりも上回ることを示している。

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。