Skip to main content
QUICK REVIEW

[論文レビュー] Extending Context Window of Large Language Models via Positional Interpolation

Shouyuan Chen, S.H. Wong|arXiv (Cornell University)|Jun 27, 2023
Topic ModelingComputer Science被引用数 44
ひとこと要約

この論文は、Position Interpolation (PI) を導入し、RoPEベースのLLM のコンテキストウィンドウを最大32768トークンまで、最小限のファインチューニングで拡張し、元のタスクの性能を維持しつつ、複数のLLaMAモデルサイズにわたる長大文脈モデリングを強化する。

ABSTRACT

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 imes$ 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.

研究の動機と目的

  • RoPEベースのLLMs(例:LLaMA)の効果的なコンテキストウィンドウをトレーニング長を超えて拡張する。
  • 位置インデックスを補外挿するのではなく補間することで、安定したアテンションと適応のしやすさを示す。
  • 長文の言語モデリング、リトリーバルのようなタスク、長文要約における実証的な利益を示す。
  • 拡張後のオリジナルのコンテキストウィンドウ(2048)内での性能への影響を評価する。

提案手法

  • 入力位置インデックスをダウンスケールして、最大位置が事前学習ウィンドウと同じになるようにPosition Interpolationを用いる。
Figure 1: An illustration of our Position Interpolation method. Consider a Llama model pre-trained with a 2048 context window length. Upper left illustrates the normal usage of an LLM model: input position indices (blue dots) are within the pre-trained range. Upper right illustrates length extrapola
Figure 1: An illustration of our Position Interpolation method. Consider a Llama model pre-trained with a 2048 context window length. Upper left illustrates the normal usage of an LLM model: input position indices (blue dots) are within the pre-trained range. Upper right illustrates length extrapola

実験結果

リサーチクエスチョン

  • RQ1Position Interpolationは建築変更なしにRoPEベースのLLMのコンテキストウィンドウを32768トークンのようなサイズに拡張できるか?
  • RQ2補間付きの位置指定は、アテンションスコアの直接外挿よりも安定でスケーラブルな拡張を提供するか?
  • RQ3PIはLLaMA 7B–65Bにおける困惑度、パスキー取得、長文ドキュメント要約に実証的な影響を与えるか?
  • RQ4PIはオリジナルの2048トークンのウィンドウ内のタスクの性能にどう影響するか?
  • RQ5RoPEアテンションの補間と外挿の理論的な境界の差はどれくらいか?

主な発見

  • PIはLLaMA 7B–65Bにおいて約1000ステップのファインチューニングで32768までのコンテキストウィンドウを拡張できる。
  • 補間されたアテンションスコアはより安定しており、LLaMA 7B設定では外挿に比べて補間境界が約600×小さい。
  • PIで拡張されたモデルは、PG19とproof-pileデータセットで長い文脈で困惑度が改善される一方、直接ファインチューニングでは長い文脈で性能が後退する。
  • PI拡張モデルは2048トークンの一部ベンチマークでわずかな劣化を除き元の文脈性能を保持する。
  • パスキー取得実験は、7Bおよび33Bモデルで約200ステップ後にPIが拡張された文脈を実効的な文脈ウィンドウとして到達することを示している。
  • 長文要約(GovReport)では、PI有効化の16Kコンテキストがベースラインと比較してROUGEスコアで競争力がある。
Figure 2: Extrapolation versus interpolation. Left: a fitted attention score function (in red) in the form of Eqn. 3 with $d=d_{\mathrm{model}}/n_{\mathrm{head}}=4096/32=128$ (setting of LLaMA 7B). Dots are random input points to be fitted and red curve is the fitted score function via least square,
Figure 2: Extrapolation versus interpolation. Left: a fitted attention score function (in red) in the form of Eqn. 3 with $d=d_{\mathrm{model}}/n_{\mathrm{head}}=4096/32=128$ (setting of LLaMA 7B). Dots are random input points to be fitted and red curve is the fitted score function via least square,

この論文を読む

Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。

Nubintでこの論文を読む

このレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。