RelayAttention for Efficient Large Language Model Serving with Long System Prompts

要約

実用的なラージ言語モデル (LLM) サービスには、タスクの指示、例、ナレッジ ドキュメントを指定する長いシステム プロンプトが含​​まれる場合があり、多数のリクエストにわたって再利用されます。
ただし、システム プロンプトが長いため、次のトークンを生成するコストが増加するため、スループットと遅延のボトルネックが発生します。
シーケンスの長さ。
このペーパーは、長いシステム プロンプトを伴う LLM サービスの効率を向上させることを目的としています。
私たちの重要な観察は、これらのシステム プロンプトを処理するには、既存の因果的注意計算アルゴリズムで非常に冗長なメモリ アクセスが必要であるということです。
具体的には、バッチ化されたリクエストの場合、システム プロンプトのキャッシュされた隠し状態 (キーと値のペア) がオフチップ DRAM からオンチップ SRAM に複数回転送され、それぞれが個別のリクエストに対応します。
このような冗長性を排除するために、入力トークンのバッチに対してこれらの隠れた状態を DRAM から 1 回だけ読み取ることを可能にするアテンション アルゴリズムである RelayAttendance を提案します。
RelayAttendant はフリーランチです。因果的アテンションの数学的再定式化に基づいているため、モデルの再トレーニングを必要とせずに、生成の品質を維持します。

要約(オリジナル)

Practical large language model (LLM) services may involve a long system prompt, which specifies the instructions, examples, and knowledge documents of the task and is reused across numerous requests. However, the long system prompt causes throughput/latency bottlenecks as the cost of generating the next token grows w.r.t. the sequence length. This paper aims to improve the efficiency of LLM services that involve long system prompts. Our key observation is that handling these system prompts requires heavily redundant memory accesses in existing causal attention computation algorithms. Specifically, for batched requests, the cached hidden states (i.e., key-value pairs) of system prompts are transferred from off-chip DRAM to on-chip SRAM multiple times, each corresponding to an individual request. To eliminate such a redundancy, we propose RelayAttention, an attention algorithm that allows reading these hidden states from DRAM exactly once for a batch of input tokens. RelayAttention is a free lunch: it maintains the generation quality while requiring no model retraining, as it is based on a mathematical reformulation of causal attention.

arxiv情報

著者 Lei Zhu,Xinjiang Wang,Wayne Zhang,Rynson W. H. Lau
発行日 2024-02-22 18:58:28+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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