精度を犠牲にせず LLM を高速化する手法
Amazon Science は、モデルサイズとデータ量の最適化だけでなく、アーキテクチャ設計(隠れ層の大きさやアテンション層の比率など)をスケーリング法則に組み込むことで、精度を損なわずに推論速度を大幅に向上させる新しい枠組みを提案した。
キーポイント
Chinchilla 法則の限界とアーキテクチャの重要性
Google DeepMind の Chinchilla 法則はモデルサイズとデータ量の最適化を示したが、内部表現の大きさやアテンション層・MLP 層の比率といったアーキテクチャ設計には言及していない。同じパラメータ数でもアーキテクチャ次第で推論スループットに最大 40% の差が生じる可能性がある。
Transformer アーキテクチャの詳細分析
LLM の中核である Transformer はアテンションブロックと MLP ブロックの積み重ねで構成され、それぞれがトークンの重み付けや知識保存に異なる役割を果たす。マルチヘッドアテンションは複数の計算を並列実行し、入力からの多様な関係性を捉えることを可能にする。
精度と効率のトレードオフを解決する新フレームワーク
Amazon Science は、スケーリング法則をアーキテクチャ設計決定に直接結びつける新しい枠組みを提示し、計算リソースの制約下で精度を維持しながら推論速度を最大化する方法を示した。
影響分析・編集コメントを表示
影響分析
この研究は、大規模言語モデルの運用コスト削減とパフォーマンス向上において、単なるパラメータ数の増加に依存しない新たな設計指針を提供します。特にリアルタイム性が求められる Web アプリケーションやエッジコンピューティング環境において、精度を犠牲にせず推論速度を最適化する具体的な道筋を示すため、業界全体のモデル設計思想に変化をもたらす可能性があります。
編集コメント
モデルの「大きさ」だけでなく「構造」そのものを最適化対象とする視点は、コスト削減を迫られる現在の AI 業界において極めて重要です。Amazon のこのアプローチは、実務レベルでの LLM デプロイメント戦略を見直すきっかけとなるでしょう。
大規模言語モデル(LLM)はますます大型化し、性能も向上しています。しかし、それらを実行するコスト——テキスト生成や質問への回答、リアルタイムアプリケーションの駆動など——も同時に増大しています。もちろん、モデルの精度は重要ですが、リアルタイム AI ベースの Web アプリケーションにおいては、効率性を犠牲にしてまで追求すべきではありません。国際学習表現会議(ICLR)で発表した論文において、私たちはスケーリング則をアーキテクチャ設計の意思決定に直接結びつけることで、この精度と効率性のトレードオフをナビゲートするためのフレームワークを提供します。
現在のスケーリング則におけるギャップ
2022 年、Google DeepMind は実験的な LLM「Chinchilla」を対象とした研究結果を発表しました。DeepMind の研究者たちは、特定の計算リソース予算の下で所望の損失レベルを達成するために、モデルサイズとトレーニングデータの両方を最適化できるスケーリング則を実証しました。より具体的には、この法則はモデルの損失(L)をモデルのパラメータ数(N)およびトレーニングデータセット内のトークン数に関連付けます。
この方程式における他の変数——E, A, B, α, β——はいずれも学習可能な係数です。DeepMind の研究者たちは、これらの係数を調整するために広範な実験を行いました。この「Chinchilla 法則」は、モデルの内部表現のサイズ(「隠れ次元」)や、アテンション層と多層パーセプトロン(MLP)層に割り当てられるパラメータの相対数といったアーキテクチャ上の選択については言及していません。しかし、同じ数十億パラメータカウントを持ち、同じデータでトレーニングされ、同じ精度を達成した 2 つのモデルであっても、追加的なアーキテクチャの選択次第では、推論時のスループットが最大 40% も異なる可能性があります。私たちは、これらの選択を予測するのに役立つスケーリング則を導き出すことを目指しました。
Transformer アーキテクチャ
すべての LLM の核心にある Transformer アーキテクチャは、主にスタックされたアテンションブロックと MLP ブロックで構成されています。アテンションブロックは、現在のトークンの表現を更新する際に、各先行トークン(単語または単語の一部)にどの程度の重みを付与するかを決定します。MLP ブロックはその表現をさらに変換し、モデルの学習済み知識の多くが保存される場所です。スタックの末尾にある別の出力層は、最終的な表現を次のトークンに関する確率分布に変換します。
アテンション機構は、情報検索から借用された名称を持つ 3 つの行列を使用します:クエリ行列は各トークンがシーケンスの残りの部分で何を探しているかを符号化し、キー行列は各トークンが何を提供できるかを符号化し、バリュー行列はアテンションの対象となった際に各トークンが貢献できる内容を保持します。クエリをキーと比較することで、モデルは各トークンが他の各トークンに対してどの程度関連性があるかを判断します。
ほとんどの LLM はマルチヘッドアテンションを使用しています:複数のアテンション計算が並列で実行され、それぞれに独自のクエリ、キー、バリュー射影を持ちます。異なるヘッドは入力の異なる側面を専門とする傾向があり、単一のヘッドでは捉えられないより豊かな関係性をモデルが捉えることを可能にします。
私たちのアプローチ:アーキテクチャを第一級の変数として扱う
私たちの ICLR 論文では、Chinchilla フレームワークに 3 つのアーキテクチャ要因を追加したスケーリング則を導入しました。それらは以下の通りです:隠れ次元(埋め込み、アテンション、MLP ブロックを流れるベクトルの次元)、MLP パラメータ数とアテンションパラメータ数の比率、およびグループ化クエリアテンション(GQA)です。GQA では、アテンションヘッドのグループが独自のクエリ行列を維持しつつ、キー行列とバリュー行列を共有します。
各要因は推論スループットに直接的な影響を与えます:
隠れ次元(d_model):固定されたパラメータ予算の下では、より大きな隠れ次元は総推論 FLOPs を削減し、キー・バリューキャッシュを縮小してスループットを向上させます。
MLP 対アテンション比率(r_mlp/attn):高い比率は MLP に多くのパラメータを割り当て、アテンションには少なく割り当てることで、キー・バリューキャッシュを縮小し、メモリ帯域幅のボトルネックを軽減します。
グループ化クエリアテンション(GQA):キー・バリューヘッドをさらに圧縮することで、生成中の入出力コストを削減します。
これらの要因を純粋にスループット向上のために調整することは、精度の低下という代償を伴います。隠れ次元と MLP 対アテンション比率の両方とも U 字型の損失曲線を示し、それぞれに最適な点があり、どちらかの方向へ行き過ぎるとモデルの精度に悪影響を及ぼします。GQA は損失に対してより不規則な効果を持つため、局所探索を通じて調整される離散ハイパーパラメータとして扱います。
私たちは 2 つの段階でスケーリング則を導き出しました。まず、調査対象のモデルに対して標準的な Chinchilla 法則を適合させ、係数 E, A, B, α, β の値を計算します。これにより最適な参照損失が確立されます。次に、各アーキテクチャ選択——私たちが考慮する 3 つの要因の違い——がその損失にどのように影響するかを較正します。実質的に、設計空間全体にわたる補正曲面を学習することになります。
隠れ次元と MLP 対アテンション比率の損失への影響が分離可能であることが判明したため、各要因は独立して最適化できます。
2 つのモデルファミリー:Panda と Surefire
このスケーリング則により、任意の精度目標に対してパレート最適なアーキテクチャを特定する検索フレームワークを開発することができました。その検索の結果得られたのが 2 つのモデルファミリーです:Panda(精度を最大化)と Surefire(精度と効率性のフロンティア上でパレート最適)。
このフレームワークを検証し、最適なモデルファミリーを特定するために、異なるアーキテクチャを持つ 200 以上(8,000 万から 30 億パラメータ、800 億から 1000 億トークン)のモデルをトレーニングしました。実験結果は以下の通りです(スループットは H200 GPU でバッチサイズ 128-4096、入力 1024 トークン、出力 1024 トークンで測定):
Model d_model GQA r_mlp/attn Loss Avg. accuracy Throughput vs. LLaMA-3.2-vLLM Throughput vs. LLaMA-3.2-SGLang
LLaMA-3.2-1B 2048 4 4.80 2.80 354.9% baseline baseline
Panda-1B 2560 4 1.07 2.78 257.0% -33% -
Surefire-1B 2560 9 3.60 2.80 455.4% +21% +47%
LLaMA-3.2-3B 3072 3 4.80 2.62 561.9% baseline baseline
Panda-3B 4096 3 1.00 2.61 962.5% -23% -
Surefire-3B 4096 7 1.00 2.62 062.6% +12% +17%
数十億パラメータの Panda モデルは、LLaMA-3.2-1B よりも 2.1% 向上し、30 億パラメータモデルは LLaMA-3.2-3B よりも 0.6% 向上しますが、その代償としてスループットが低下します。Surefire モデルは LLaMA-3.2 の精度と同等かそれ以上を維持しつつ、スループットを 12〜47% 改善し、異なるモデルサイズおよびバッチサイズの構成下では、A100(vLLM)で最大 42%、H200(SGLang)で最大 47% の向上が見られます。
重要なポイント
アーキテクチャは後付けではありません。LLaMA-3.2 スタイルのモデルにおける最適な MLP 対アテンション比率は約 1.0 であり、既存のオープンウェイト版(例:LLaMA-3.2-1B の 4.8)よりもはるかに低いです。現在のモデルは MLP 層に過剰に割り当てすぎています。
隠れ次元、MLP 対アテンション比率、GQA 設定の適切な構成により、精度を犠牲にすることなく大きな効率性の向上を実現できます。
小規模実験が大規模な結果を予測する。8,000 万から 2.97 億パラメータのモデルで較正された条件付きスケーリング則は、10 億および 30 億パラメータにおける最良のアーキテクチャを確実に予測し、高価なフルスケールトレーニング前に低コストでの探索を可能にします。
このフレームワークはハードウェアやサービングシステム全体で一般化されます。効率性の向上は A100/H200 GPU および vLLM/SGLang 全体で一貫しており、結果は即座に実装可能です。
原文を表示
Large language models (LLMs) keep getting bigger and better. But the cost of running them — generating text, answering questions, powering real-time applications — is scaling up, too. Obviously, model accuracy is important, but for real-time AI-based web applications, it can’t come at the expense of efficiency. In a paper we presented at the International Conference on Learning Representations (ICLR), we provide a framework for navigating this accuracy-versus-efficiency tradeoff, by connecting scaling laws directly to architectural-design decisions. The gap in current scaling laws In 2022, Google DeepMind announced the results of a study involving an experimental LLM called Chinchilla. The DeepMind researchers demonstrated a scaling law that enabled joint optimization of model size and training data to achieve a desired loss level, given a particular computational budget. More precisely, the law relates the model loss (L) to the number of model parameters (N) and the number of tokens in the training dataset: The other variables in this equation — E, A, B, α, and β — are all learnable coefficients. The DeepMind researchers did extensive experimentation to tune those coefficients. This "Chinchilla law" doesn't specify architectural choices, such as the size of the model's internal representations — the "hidden size" — or the relative number of parameters allocated to attention layers and multilayer perceptron (MLP) layers. However, two models, each with the same billion-parameter count, trained on the same data, with the same accuracy, can differ by up to 40% in inference-time throughput, depending on additional architectural choices. We set out to deduce scaling laws that can help predict those choices. The Transformer architecture The Transformer architecture — which lies at the heart of all LLMs — consists largely of stacked attention and MLP blocks. Attention blocks determine how much weight to give each prior token (word or word part) when updating the current token's representation; MLP blocks transform that representation further and are where much of the model's learned knowledge is stored. A separate output layer at the end of the stack converts the final representation into a probability distribution over the next token. The attention mechanism uses three matrices, with names borrowed from information retrieval: the query matrix encodes what each token is looking for in the rest of the sequence; the key matrix encodes what each token has to offer; and the value matrix holds the content each token can contribute when it's attended to. Comparing queries against keys tells the model how relevant each token is to each other token. Most LLMs use multihead attention: several attention computations run in parallel, each with its own query, key, and value projections. Different heads tend to specialize in different aspects of the input, letting the model capture a richer set of relationships than a single head would. Our approach: Architecture as a first-class variable In our ICLR paper, we introduce a scaling law that augments the Chinchilla framework with three architectural factors: the hidden size (the dimension of the vectors that flow through the embedding, attention, and MLP blocks); the ratio of the number of MLP parameters to the number of attention parameters; and grouped-query attention (GQA), in which groups of attention heads, while preserving distinct query matrices, share key and value matrices. Each factor has a direct impact on inference throughput: Hidden size (d_model): Under a fixed parameter budget, larger hidden sizes reduce total inference FLOPs and shrink the key-value cache, improving throughput. MLP-to-attention ratio (r_mlp/attn): A higher ratio allocates more parameters to the MLP and fewer to attention, shrinking the key-value cache and reducing memory-bandwidth bottlenecks. Grouped-query attention (GQA): Compressing key-value heads further cuts input/output costs during generation. Adjusting these factors purely for higher throughput comes at a cost of accuracy. Both hidden size and MLP-to-attention ratio exhibit U-shaped loss curves: there is an optimal point for each, and pushing too far in either direction has a negative effect on model accuracy. GQA has a more erratic effect on loss, so we treat it as a discrete hyperparameter tuned through local search. We deduce our scaling law in two stages. First, we fit the standard Chinchilla law to the model under investigation, calculating values for the coefficients E, A, B, α, and β. This establishes an optimal reference loss. Then we calibrate how each architectural choice — differences in the three factors we consider — affects that loss. Effectively, we learn a correction surface over the design space. Because the effects of hidden size and MLP-to-attention ratio on loss turn out to be separable, each factor can be optimized independently. Two model families: Panda and Surefire This scaling law enabled us to develop a search framework that identifies Pareto-optimal architectures for any given accuracy target. The result of that search was two model families: Panda (which maximizes accuracy) and Surefire (which is Pareto optimal on the accuracy–efficiency frontier). To validate the framework and identify our families of optimal models, we trained more than 200 models with varying architectures (80 million to three billion parameters, eight billion to 100 billion tokens). The results of our experiments are below (throughput measured on H200 GPU with batchsize-128-4096-input-1024-output tokens): Modeld_modelGQAr_mlp/attnLossAvg. accuracyThroughput vs. LLaMA-3.2-vLLMThroughput vs. LLaMA-3.2-SGLangLLaMA-3.2-1B204844.802.80354.9%baselinebaselinePanda-1B256041.072.78257.0%-33%-Surefire-1B256093.602.80455.4%+21%+47%LLaMA-3.2-3B307234.802.62561.9%baselinebaselinePanda-3B409631.002.61962.5%-23%-Surefire-3B409671.002.62062.6%+12%+17% The billion-parameter Panda model gains 2.1% over LLaMA-3.2-1B, and the three-billion parameter model gains 0.6% over LLaMA-3.2-3B — at the cost of lower throughput. Surefire models match or exceed LLaMA-3.2 accuracy while improving throughput by 12-47%, with gains reaching up to 42% on A100 (vLLM) and 47% on H200 (SGLang) under different model size and batch size configurations. Key takeaways Architecture is not an afterthought. The optimal MLP-to-attention ratio of LLaMA-3.2-style models is around 1.0, far lower than that of existing open-weight versions (e.g., 4.8 for LLaMA-3.2-1B). Current models overallocate to MLP layers. The right configurations of hidden size, MLP-to-attention ratio, and GQA configuration can unlock large efficiency gains with no accuracy cost. Small-scale experiments predict large-scale outcomes. The conditional scaling law, calibrated on models with as few as 80 million to 297 million parameters, reliably predicts the best architecture at one billion and three billion parameters, enabling low-cost exploration before expensive full-scale training. The framework generalizes across hardware and serving systems. Efficiency gains are consistent across A100/H200 GPUs and vLLM/SGLang, making the results directly actionable.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み