[論文レビュー] Fast Inference from Transformers via Speculative Decoding
本論文は、推測サンプリングを用いた推測デコードを導入し、小さな近似モデルを並列実行して出力を再利用することで、ターゲットモデルの出力分布を保持しつつ自己回帰Transformer推論を高速化します。 retraining せずにT5-XXLで2x-3xのウォールタイム速度アップを達成します。
Inference from large autoregressive models like Transformers is slow - decoding K tokens takes K serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel. At the heart of our approach lie the observations that (1) hard language-modeling tasks often include easier subtasks that can be approximated well by more efficient models, and (2) using speculative execution and a novel sampling method, we can make exact decoding from the large models faster, by running them in parallel on the outputs of the approximation models, potentially generating several tokens concurrently, and without changing the distribution. Our method can accelerate existing off-the-shelf models without retraining or architecture changes. We demonstrate it on T5-XXL and show a 2X-3X acceleration compared to the standard T5X implementation, with identical outputs.
研究の動機と目的
- 大規模自己回帰Transformerでデコードが逐次的で遅い問題を動機づける。
- ターゲットモデルと並列で近似モデルを動かし、推測トークンを生成する方法を提案する。
- 再学習やアーキテクチャ変更なしに最終出力がターゲットモデルの分布と一致することを保証する。
- 実タスク全体で実用的な速度向上を示す理論的指針と実証的証拠を提供する。
提案手法
- 対象モデル Mp と同じタスクの小さな近似モデル Mq を定義する。
- Mq から gamma 候補トークンを生成し、Mp と並行して推測サンプリングを用いて Mp の分布を保持する。
- 最終出力分布が Mp と同一になるようサンプリング調整を行い、各ステップで gamma+1 トークンまで出力する可能性がある。
- alpha(受理確率)と c(Mq のコスト係数)という指標の下で速度向上を分析し、最適な gamma を導出する。
- Mp によるウォールタイムの改善が alpha、gamma、c に依存する式に従うことを示し、速度向上が実現される条件を特定する。
- 翻訳・要約・対話などのタスクで経験的に検証し、T5-XXL 上の T5X ベースラインと比較する。
実験結果
リサーチクエスチョン
- RQ1推測デコードは出力を変更せずに大規模Transformerモデルの推論をどれだけ高速化できるか?
- RQ2近似品質(alpha)と速度アップの関係はどのようで、gamma はどう選ぶべきか?
- RQ3異なる近似モデルとサンプリング設定でウォールタイムと計算資源のトレードオフはどうなるか?
主な発見
| Task | M_q | Temp | gamma | alpha | Speed |
|---|---|---|---|---|---|
| EnDe | T5-small ☆ | 0 | 7 | 0.75 | 3.4X |
| EnDe | T5-base | 0 | 7 | 0.80 | 2.8X |
| EnDe | T5-large | 0 | 7 | 0.82 | 1.7X |
| EnDe | T5-small ☆ | 1 | 7 | 0.62 | 2.6X |
| EnDe | T5-base | 1 | 5 | 0.68 | 2.4X |
| EnDe | T5-large | 1 | 3 | 0.71 | 1.4X |
| CNNDM | T5-small ☆ | 0 | 5 | 0.65 | 3.1X |
| CNNDM | T5-base | 0 | 5 | 0.73 | 3.0X |
| CNNDM | T5-large | 0 | 3 | 0.74 | 2.2X |
| CNNDM | T5-small ☆ | 1 | 5 | 0.53 | 2.3X |
| CNNDM | T5-base | 1 | 3 | 0.55 | 2.2X |
| CNNDM | T5-large | 1 | 3 | 0.56 | 1.7X |
- 実証的に、T5-XXL に対して T5X との比較で同一出力を維持しつつ2x-3xのウォールタイム速度アップを達成。
- 速度向上は受理率 alpha と相関し、高品質な近似(より大きな alpha)ほど適切な gamma に対してより大きな利得を生む。
- ほぼ無コストの近似(例: unigram/bigram)でも測定可能な速度向上を提供するが、より大きな近似モデルほど効果は大きい。
- 推定生成トークン数とウォールタイム改善の理論式を提供し、alpha およびハードウェアコスト c に基づく gamma の選択を導く。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。