LM-Infinite: Simple On-the-Fly Length Generalization for Large Language Models

要約

近年、さまざまなドメインにわたって、Transformer ベースの大規模言語モデル (LLM) のパフォーマンスが目覚ましい進歩を遂げています。
これらの LLM はますます複雑になるドメインに導入されるため、長いユーザー プロンプトに従うか、長いテキストを生成する必要に直面することがよくあります。
このような状況では、長いシーケンス上の LLM の $\textit{長さ汎化の失敗}$ がより顕著になります。
ほとんどの事前トレーニング スキームは、トレーニング シーケンスを固定長に切り詰めます。
LLM は、この問題に対処するために特別に設計された相対位置エンコーディングを使用しても、長いコンテキストの後に流暢で一貫したテキストを生成するのに苦労することがよくあります。
長いコーパスの微調整などの一般的なソリューションには、多くの場合、膨大なハードウェアと時間のコストがかかり、慎重なトレーニング プロセス設計が必要です。
既存の LLM の生成品質をより効率的に長いテキストに推定するために、この問題に寄与する主な配布外 (OOD) 要因を理論的および経験的に調査します。
この診断に触発されて、私たちは、オンザフライ長さの一般化のためのシンプルかつ効果的なソリューションである LM-Infinite を提案します。
これには $\mathbf{\Lambda}$ 型のアテンション マスク (過剰な出席トークンを避けるため) と距離制限 (目に見えない距離を避けるため) のみが含まれ、パラメーターの更新や学習は必要ありません。
相対位置エンコード方式を使用するさまざまな LLM に適用できることがわかりました。
LM-Infinite は $O(n)$ の時間とスペースで計算効率が高く、ArXiv および OpenWebText2 データセット上の 128,000 トークンまで一貫したテキスト生成の流暢性と品質を示し、デコード速度が 2.72 倍向上します。
出版後にコードを一般公開します。

要約(オリジナル)

In recent years, there have been remarkable advancements in the performance of Transformer-based Large Language Models (LLMs) across various domains. As these LLMs are deployed for increasingly complex domains, they often face the need to follow longer user prompts or generate longer texts. In these situations, the $\textit{length generalization failure}$ of LLMs on long sequences becomes more prominent. Most pre-training schemes truncate training sequences to a fixed length. LLMs often struggle to generate fluent and coherent texts after longer contexts, even with relative positional encoding specifically designed to cope with this problem. Common solutions such as finetuning on longer corpora often involve daunting hardware and time costs and require careful training process design. To more efficiently extrapolate existing LLMs’ generation quality to longer texts, we theoretically and empirically investigate the main out-of-distribution (OOD) factors contributing to this problem. Inspired by this diagnosis, we propose a simple yet effective solution for on-the-fly length generalization, LM-Infinite. It involves only a $\mathbf{\Lambda}$-shaped attention mask (to avoid excessive attended tokens) and a distance limit (to avoid unseen distances) while requiring no parameter updates or learning. We find it applicable to a variety of LLMs using relative-position encoding methods. LM-Infinite is computationally efficient with $O(n)$ time and space, and demonstrates consistent text generation fluency and quality to as long as 128k tokens on ArXiv and OpenWebText2 datasets, with 2.72x decoding speedup. We will make the codes publicly available following publication.

arxiv情報

著者 Chi Han,Qifan Wang,Wenhan Xiong,Yu Chen,Heng Ji,Sinong Wang
発行日 2023-11-16 17:26:20+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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