Skip to main content
QUICK REVIEW

[論文レビュー] LongRoPE: Extending LLM Context Window Beyond 2 Million Tokens

Yiran Ding, Li Lyna Zhang|arXiv (Cornell University)|Feb 21, 2024
Image Processing and 3D ReconstructionComputer Science被引用数 15
ひとこと要約

LongRoPE は非均一な、進化指向の RoPE リスケール戦略を導入し、LLM の文脈窓を2048kトークンへ拡張する。効率的な2段階プロセスと最小限の微調整。短い文脈性能を維持し、LLaMA2 や Mistral のような RoPE ベースのモデルにも適用可能。

ABSTRACT

Large context window is a desirable feature in large language models (LLMs). However, due to high fine-tuning costs, scarcity of long texts, and catastrophic values introduced by new token positions, current extended context windows are limited to around 128k tokens. This paper introduces LongRoPE that, for the first time, extends the context window of pre-trained LLMs to an impressive 2048k tokens, with up to only 1k fine-tuning steps at within 256k training lengths, while maintaining performance at the original short context window. This is achieved by three key innovations: (i) we identify and exploit two forms of non-uniformities in positional interpolation through an efficient search, providing a better initialization for fine-tuning and enabling an 8x extension in non-fine-tuning scenarios; (ii) we introduce a progressive extension strategy that first fine-tunes a 256k length LLM and then conducts a second positional interpolation on the fine-tuned extended LLM to achieve a 2048k context window; (iii) we readjust LongRoPE on 8k length to recover the short context window performance. Extensive experiments on LLaMA2 and Mistral across various tasks demonstrate the effectiveness of our method. Models extended via LongRoPE retain the original architecture with minor modifications to the positional embedding, and can reuse most pre-existing optimizations.

研究の動機と目的

  • LLM におけるはるかに大きい文脈窓の必要性を動機づけ、拡張が ~128k トークンを超える際の障壁を特定する。
  • LongRoPE を提案する。非均一な RoPE 補間の2形式と効率的な探索を活用して、広範囲な文脈を2048kへ拡張する方法。
  • 短文脈設定のもとで perplexity、パスキー取得、標準ベンチマークにおける LLaMA2 と Mistral で LongRoPE の有効性を示す。

提案手法

  • 次元とトークン位置全体で RoPE の2種類の非均一性を特定する。
  • 各次元の RoPE リスケール因子と補間の開始トークン閾値を最適化する進化的探索を開発する。
  • 段階的拡張戦略を提案する。まず RoPE リスケーリングで 256k/128k へ拡張し、短時間微調整、次に微調整済みモデル上で2つ目の RoPE 補間を適用して 2048k へ拡張する。
  • 短い文脈長で RoPE を再調整して短コンテキスト性能を回復させる。
  • 第2段階で 256k の訓練長と最小限のファインチューニング(1k ステップ)で 4k から 2048k まで拡張を可能にする。

実験結果

リサーチクエスチョン

  • RQ1RoPE補間を、PI/NTK/YaRN の既存戦略を超えて、次元ごとの非均一リスケーリングを用いて最適化できるか。
  • RQ2拡張中に初期の重要トークン情報を保持するための、補間なしで最適な開始トークン数はあるか。
  • RQ3段階的で限られたファインチューニングのワークフローで、過度な訓練コストを伴わずに2048k文脈窓に到達できるか。
  • RQ4超長文脈拡張後、LongRoPE は短文脈ベンチマークでの性能を維持するか。

主な発見

  • 非均一な RoPE の次元とトークン位置は異なる補間ニーズを示し、次元ごとのリスケール因子の最適化は 8k–16k の文脈で perplexity を改善する。
  • 単調性制約を伴う進化的探索は、拡張文脈において PI、NTK、YaRN よりも良い RoPE リスケール因子を得る。
  • 段階的拡張アプローチは long-text の直接的な微調整なしで 2048k 文脈を達成し、中間サイズでの短時間の微調整ステップのみを必要とする。
  • 2048k への拡張は初期には短文脈性能を低下させることがあるが、短長さ用 RoPE 因子を再調整することで緩和される。
  • LongRoPE-2048k モデルは、書籍データセットと長文評価で競争力のある perplexity とパスキー取得精度を示し、256k 文脈内でいくつかのベースラインを上回っている。

この論文を読む

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

Nubintでこの論文を読む

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