ChatPaper.aiChatPaper

LongRoPE: LLMのコンテキストウィンドウを200万トークン以上に拡張

LongRoPE: Extending LLM Context Window Beyond 2 Million Tokens

February 21, 2024
著者: Yiran Ding, Li Lyna Zhang, Chengruidong Zhang, Yuanyuan Xu, Ning Shang, Jiahang Xu, Fan Yang, Mao Yang
cs.AI

要旨

大規模なコンテキストウィンドウは、大規模言語モデル(LLM)において望ましい特徴である。しかし、高額なファインチューニングコスト、長文テキストの不足、および新しいトークン位置によって導入される破滅的な値のため、現在の拡張コンテキストウィンドウは約128kトークンに制限されている。本論文では、初めて事前学習済みLLMのコンテキストウィンドウを2048kトークンに拡張するLongRoPEを紹介する。これは、256kのトレーニング長において最大1kのファインチューニングステップのみで達成され、元の短いコンテキストウィンドウでの性能を維持する。これは、以下の3つの主要な革新によって実現されている:(i)効率的な探索を通じて位置補間における2つの不均一性を特定し、活用することで、ファインチューニングのためのより良い初期化を提供し、非ファインチューニングシナリオでの8倍の拡張を可能にする;(ii)256k長のLLMを最初にファインチューニングし、その後ファインチューニングされた拡張LLMに対して2回目の位置補間を行い、2048kのコンテキストウィンドウを達成する漸進的拡張戦略を導入する;(iii)8k長でLongRoPEを再調整し、短いコンテキストウィンドウの性能を回復する。LLaMA2とMistralを用いた様々なタスクでの広範な実験により、本手法の有効性が実証されている。LongRoPEによって拡張されたモデルは、位置埋め込みにわずかな変更を加えるだけで元のアーキテクチャを保持し、既存の最適化の大部分を再利用できる。
English
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.
PDF11720December 15, 2024