LongLoRA: Efficient Fine-tuning of Long-Context Large Language Models

要約

限られた計算コストで、事前トレーニングされた大規模言語モデル (LLM) のコンテキスト サイズを拡張する効率的な微調整アプローチである LongLoRA を紹介します。
通常、コンテキスト サイズが長い LLM のトレーニングは計算コストが高くつき、膨大なトレーニング時間と GPU リソースが必要になります。
たとえば、コンテキスト長 8192 でのトレーニングには、セルフ アテンション層で 2048 の 16 倍の計算コストが必要です。この論文では、LLM のコンテキスト拡張を 2 つの側面で高速化します。
一方で、推論中には高密度のグローバルな注意が必要ですが、モデルの微調整はまばらなローカルな注意によって効果的かつ効率的に行うことができます。
提案されたシフト ショート アテンションは、コンテキスト拡張を効果的に有効にし、バニラ アテンションでの微調整と同様のパフォーマンスで、重要な計算の節約につながります。
特に、トレーニングではわずか 2 行のコードで実装できますが、推論ではオプションです。
一方、コンテキスト拡張の​​ためのパラメータ効率の高い微調整レジームを再検討します。
特に、コンテキスト拡張の​​ための LoRA は、トレーニング可能な埋め込みと正規化の前提下でうまく機能することがわかりました。
LongLoRA は、7B/13B から 70B までの LLaMA2 モデルのさまざまなタスクで強力な経験的結果を示しています。
LongLoRA は、単一の 8x A100 マシンで 4k コンテキストから 100k までの LLaMA2 7B、または 32k までの LLaMA2 70B を採用します。
LongLoRA は、元のアーキテクチャを維持しながらモデルのコンテキストを拡張し、FlashAttendant-2 などのほとんどの既存の技術と互換性があります。
さらに、LongLoRA を実用化するために、教師あり微調整用のデータセット LongQA を収集します。
3,000 を超える長いコンテキストの質問と回答のペアが含まれています。

要約(オリジナル)

We present LongLoRA, an efficient fine-tuning approach that extends the context sizes of pre-trained large language models (LLMs), with limited computation cost. Typically, training LLMs with long context sizes is computationally expensive, requiring extensive training hours and GPU resources. For example, training on the context length of 8192 needs 16x computational costs in self-attention layers as that of 2048. In this paper, we speed up the context extension of LLMs in two aspects. On the one hand, although dense global attention is needed during inference, fine-tuning the model can be effectively and efficiently done by sparse local attention. The proposed shift short attention effectively enables context extension, leading to non-trivial computation saving with similar performance to fine-tuning with vanilla attention. Particularly, it can be implemented with only two lines of code in training, while being optional in inference. On the other hand, we revisit the parameter-efficient fine-tuning regime for context expansion. Notably, we find that LoRA for context extension works well under the premise of trainable embedding and normalization. LongLoRA demonstrates strong empirical results on various tasks on LLaMA2 models from 7B/13B to 70B. LongLoRA adopts LLaMA2 7B from 4k context to 100k, or LLaMA2 70B to 32k on a single 8x A100 machine. LongLoRA extends models’ context while retaining their original architectures, and is compatible with most existing techniques, like FlashAttention-2. In addition, to make LongLoRA practical, we collect a dataset, LongQA, for supervised fine-tuning. It contains more than 3k long context question-answer pairs.

arxiv情報

著者 Yukang Chen,Shengju Qian,Haotian Tang,Xin Lai,Zhijian Liu,Song Han,Jiaya Jia
発行日 2023-09-21 17:59:11+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL, cs.LG パーマリンク