トレーニング不要の長文脈スケーリングによる大規模言語モデルの拡張
Training-Free Long-Context Scaling of Large Language Models
February 27, 2024
著者: Chenxin An, Fei Huang, Jun Zhang, Shansan Gong, Xipeng Qiu, Chang Zhou, Lingpeng Kong
cs.AI
要旨
大規模言語モデル(LLMs)は、入力トークン数が事前学習時の長さを超えると、テキストの処理および生成能力が著しく低下します。長いシーケンスで大規模モデルをファインチューニングするには多大なコストがかかるため、我々はDual Chunk Attention(DCA)を提案します。DCAは、Llama2 70Bが継続的なトレーニングなしに10万トークンを超えるコンテキストウィンドウをサポートすることを可能にします。長いシーケンスのアテンション計算をチャンクベースのモジュールに分解することで、DCAは同一チャンク内のトークン(Intra-Chunk)および異なるチャンク間のトークン(Inter-Chunk)の相対的位置情報を効果的に捕捉し、Flash Attentionとシームレスに統合します。印象的な外挿能力に加えて、DCAは実用的な長文コンテキストタスクにおいて、ファインチューニングされたモデルと同等またはそれ以上の性能を達成します。プロプライエタリモデルと比較すると、トレーニング不要の70Bモデルはgpt-3.5-16kの94%の性能を達成し、オープンソースの代替手段として有効であることを示しています。本研究で使用したすべてのコードとデータはhttps://github.com/HKUNLP/ChunkLlamaで公開されています。
English
The ability of Large Language Models (LLMs) to process and generate coherent
text is markedly weakened when the number of input tokens exceeds their
pretraining length. Given the expensive overhead of finetuning large-scale
models with longer sequences, we propose Dual Chunk Attention (DCA), which
enables Llama2 70B to support context windows of more than 100k tokens without
continual training. By decomposing the attention computation for long sequences
into chunk-based modules, DCA manages to effectively capture the relative
positional information of tokens within the same chunk (Intra-Chunk) and across
distinct chunks (Inter-Chunk), as well as integrates seamlessly with Flash
Attention. In addition to its impressive extrapolation capability, DCA achieves
performance on practical long-context tasks that is comparable to or even
better than that of finetuned models. When compared with proprietary models,
our training-free 70B model attains 94% of the performance of gpt-3.5-16k,
indicating it is a viable open-source alternative. All code and data used in
this work are released at https://github.com/HKUNLP/ChunkLlama.