LongRecipe: 大規模言語モデルにおける効率的な長い文脈一般化のためのレシピ
LongRecipe: Recipe for Efficient Long Context Generalization in Large Languge Models
August 31, 2024
著者: Zhiyuan Hu, Yuliang Liu, Jinman Zhao, Suyuchen Wang, Yan Wang, Wei Shen, Qing Gu, Anh Tuan Luu, See-Kiong Ng, Zhiwei Jiang, Bryan Hooi
cs.AI
要旨
大規模言語モデル(LLMs)は、事前学習中の有効なコンテキストウィンドウサイズの制限により、長いコンテキストタスクを処理する際に重要な課題に直面しています。これにより、LLMsの一般化能力が制限されます。一方、LLMsのコンテキストウィンドウを事前学習後に拡張することは、非常にリソースを消費します。この問題に対処するために、私たちは**LongRecipe**を導入します。これは、影響力のあるトークン分析、位置インデックス変換、およびトレーニング最適化戦略を含む、LLMsのコンテキストウィンドウを拡張するための効率的なトレーニング戦略です。これにより、トレーニング効率を維持しながら、長いシーケンス入力をシミュレートし、モデルが長距離依存関係を理解する能力が大幅に向上します。3種類のLLMsに対する実験では、LongRecipeが長いシーケンスを利用でき、対象のコンテキストウィンドウサイズの30%のみが必要であり、計算トレーニングリソースをフルシーケンストレーニングと比較して85%以上削減します。さらに、LongRecipeは一般的なタスクにおいて元のLLMの機能を維持します。最終的に、*オープンソースのLLMsの有効なコンテキストウィンドウを8kから128kに拡張し、80Gメモリを搭載した単一GPUを使用して1日だけの専用トレーニングで、GPT-4に近い性能を達成できます。* 私たちのコードは[リンク](https://github.com/zhiyuanhubj/LongRecipe)で公開されています。
English
Large language models (LLMs) face significant challenges in handling
long-context tasks because of their limited effective context window size
during pretraining, which restricts their ability to generalize over extended
sequences. Meanwhile, extending the context window in LLMs through
post-pretraining is highly resource-intensive. To address this, we introduce
**LongRecipe**, an efficient training strategy for extending the context window
of LLMs, including impactful token analysis, position index transformation, and
training optimization strategies. It simulates long-sequence inputs while
maintaining training efficiency and significantly improves the model's
understanding of long-range dependencies. Experiments on three types of LLMs
show that LongRecipe can utilize long sequences while requiring only 30% of the
target context window size, and reduces computational training resource over
85% compared to full sequence training. Furthermore, LongRecipe also preserves
the original LLM's capabilities in general tasks. Ultimately, *we can extend
the effective context window of open-source LLMs from 8k to 128k, achieving
performance close to GPT-4 with just one day of dedicated training using a
single GPU with 80G memory.* Our code is released at the
[link](https://github.com/zhiyuanhubj/LongRecipe).Summary
AI-Generated Summary