RSQ:重要なトークンから学習することで、より優れた量子化LLMを実現
RSQ: Learning from Important Tokens Leads to Better Quantized LLMs
March 3, 2025
著者: Yi-Lin Sung, Prateek Yadav, Jialu Li, Jaehong Yoon, Mohit Bansal
cs.AI
要旨
層ごとの量子化は、高コストな再学習を必要とせずに大規模モデルを効率的に圧縮するための重要な技術です。従来の手法では、通常、各層の重みをすべての出力トークンにわたって「均一に」最適化することで層再構成誤差を最小化していました。しかし、本論文では、重要なトークン(例えば、大きなアテンションスコアを持つもの)からの学習を優先することで、より良い量子化モデルが得られることを示します。この知見に基づき、我々はRSQ(Rotate, Scale, then Quantize)を提案します。RSQは、(1) 外れ値(特に大きい値を持つもの)を緩和するためにモデルに回転(直交変換)を適用し、(2) トークンの重要度に基づいて特徴をスケーリングし、(3) スケーリングされたトークンによって計算された二次統計量を用いてGPTQフレームワークでモデルを量子化します。トークンの重要度を計算するために、ヒューリスティックな戦略と動的な戦略の両方を検討し、すべてのアプローチを徹底的に分析した結果、各トークンのアテンションスコアをその重要度として使用するアテンション集中度を最良のアプローチとして採用しました。RSQが、LLaMA3、Mistral、Qwen2.5という3つのモデルファミリーにわたる複数の下流タスクでベースライン手法を一貫して上回ることを実証します。さらに、RSQで量子化されたモデルは、長文コンテキストタスクにおいても優れた性能を発揮し、その有効性をさらに強調しています。最後に、RSQは、異なるモデルサイズ、キャリブレーションデータセット、ビット精度、量子化手法を含むさまざまな設定においても汎用性を示します。
English
Layer-wise quantization is a key technique for efficiently compressing large
models without expensive retraining. Previous methods typically quantize the
weights of each layer by "uniformly" optimizing the layer reconstruction loss
across all output tokens. However, in this paper, we demonstrate that
better-quantized models can be obtained by prioritizing learning from important
tokens (e.g. which have large attention scores). Building on this finding, we
propose RSQ (Rotate, Scale, then Quantize), which (1) applies rotations
(orthogonal transformation) to the model to mitigate outliers (those with
exceptionally large magnitude), (2) scales the token feature based on its
importance, and (3) quantizes the model using the GPTQ framework with the
second-order statistics computed by scaled tokens. To compute token importance,
we explore both heuristic and dynamic strategies. Based on a thorough analysis
of all approaches, we adopt attention concentration, which uses attention
scores of each token as its importance, as the best approach. We demonstrate
that RSQ consistently outperforms baseline methods across multiple downstream
tasks and three model families: LLaMA3, Mistral, and Qwen2.5. Additionally,
models quantized with RSQ achieve superior performance on long-context tasks,
further highlighting its effectiveness. Lastly, RSQ demonstrates
generalizability across various setups, including different model sizes,
calibration datasets, bit precisions, and quantization methods.Summary
AI-Generated Summary