大規模言語モデルのコンテキストウィンドウ拡張:位置補間によるアプローチ
Extending Context Window of Large Language Models via Positional Interpolation
June 27, 2023
著者: Shouyuan Chen, Sherman Wong, Liangjian Chen, Yuandong Tian
cs.AI
要旨
我々は、Position Interpolation(PI)を提案します。これは、LLaMAモデルなどのRoPEベースの事前学習済み大規模言語モデル(LLM)のコンテキストウィンドウサイズを、最小限のファインチューニング(1000ステップ以内)で最大32768まで拡張するものです。これにより、パスキー検索、言語モデリング、長文書要約など、長いコンテキストを必要とする様々なタスクにおいて、LLaMA 7Bから65Bまでのモデルで強力な実証結果を示しています。同時に、Position Interpolationによって拡張されたモデルは、元のコンテキストウィンドウ内のタスクにおいても比較的良好な品質を維持します。この目標を達成するために、Position Interpolationは、入力位置インデックスを線形にダウンスケールして元のコンテキストウィンドウサイズに合わせることで、学習済みのコンテキスト長を超えて外挿することを避けます。外挿は、自己注意メカニズムを完全に破壊する可能性のある破滅的に高い注意スコアを引き起こすことがあります。我々の理論的研究は、補間の上限が外挿の上限よりも少なくとも約600倍小さいことを示しており、その安定性をさらに実証しています。Position Interpolationによって拡張されたモデルは、元のアーキテクチャを保持し、既存の最適化やインフラストラクチャの大部分を再利用することができます。
English
We present Position Interpolation (PI) that extends the context window sizes
of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal
fine-tuning (within 1000 steps), while demonstrating strong empirical results
on various tasks that require long context, including passkey retrieval,
language modeling, and long document summarization from LLaMA 7B to 65B.
Meanwhile, the extended model by Position Interpolation preserve quality
relatively well on tasks within its original context window. To achieve this
goal, Position Interpolation linearly down-scales the input position indices to
match the original context window size, rather than extrapolating beyond the
trained context length which may lead to catastrophically high attention scores
that completely ruin the self-attention mechanism. Our theoretical study shows
that the upper bound of interpolation is at least sim 600 times smaller
than that of extrapolation, further demonstrating its stability. Models
extended via Position Interpolation retain its original architecture and can
reuse most pre-existing optimization and infrastructure.