LongAlign: 大規模言語モデルの長文脈アラインメントのレシピ
LongAlign: A Recipe for Long Context Alignment of Large Language Models
January 31, 2024
著者: Yushi Bai, Xin Lv, Jiajie Zhang, Yuze He, Ji Qi, Lei Hou, Jie Tang, Yuxiao Dong, Juanzi Li
cs.AI
要旨
大規模言語モデルを長文脈に効果的に対応させるためには、同程度の長さの入力シーケンスに対する指示ファインチューニングが必要です。これを実現するため、我々はLongAlignを提案します。これは、長文脈アライメントのための指示データ、トレーニング、評価のレシピです。まず、Self-Instructを用いて長文指示追従データセットを構築します。データの多様性を確保するため、様々な長文脈ソースからの幅広いタスクをカバーしています。次に、パッキングとソートバッチ戦略を採用し、長さの異なるデータに対する教師ありファインチューニングを高速化します。さらに、パッキングトレーニング中に異なるシーケンスの損失への寄与をバランスさせるための損失重み付け手法を開発しました。第三に、10k-100kの長さのクエリに対する指示追従能力を評価するためのLongBench-Chatベンチマークを導入します。実験結果は、LongAlignが長文脈タスクにおいて既存のLLMレシピを最大30%上回りながら、短い汎用タスクの処理能力も維持することを示しています。コード、データ、および長文脈アライメントされたモデルはhttps://github.com/THUDM/LongAlignで公開されています。
English
Extending large language models to effectively handle long contexts requires
instruction fine-tuning on input sequences of similar length. To address this,
we present LongAlign -- a recipe of the instruction data, training, and
evaluation for long context alignment. First, we construct a long
instruction-following dataset using Self-Instruct. To ensure the data
diversity, it covers a broad range of tasks from various long context sources.
Second, we adopt the packing and sorted batching strategies to speed up
supervised fine-tuning on data with varied length distributions. Additionally,
we develop a loss weighting method to balance the contribution to the loss
across different sequences during packing training. Third, we introduce the
LongBench-Chat benchmark for evaluating instruction-following capabilities on
queries of 10k-100k in length. Experiments show that LongAlign outperforms
existing recipes for LLMs in long context tasks by up to 30\%, while also
maintaining their proficiency in handling short, generic tasks. The code, data,
and long-aligned models are open-sourced at https://github.com/THUDM/LongAlign.