EfficientQAT: 大規模言語モデルのための効率的な量子化対応トレーニング
EfficientQAT: Efficient Quantization-Aware Training for Large Language Models
July 10, 2024
著者: Mengzhao Chen, Wenqi Shao, Peng Xu, Jiahao Wang, Peng Gao, Kaipeng Zhang, Yu Qiao, Ping Luo
cs.AI
要旨
大規模言語モデル(LLMs)は、現代の自然言語処理と人工知能において不可欠な存在です。しかし、その膨大なメモリ要件を管理する上で課題に直面しています。量子化対応トレーニング(QAT)は、低ビット表現を用いてメモリ消費を削減しつつ精度の低下を最小限に抑える解決策を提供しますが、モデルの重みと量子化パラメータを最適化するために多大なトレーニングリソースを必要とします。この問題に対処するため、我々はLLMを圧縮するための新しい量子化技術であるEfficient Quantization-Aware Training(EfficientQAT)を提案します。EfficientQATは、2つの連続したフェーズで構成されます:全パラメータのブロック単位トレーニング(Block-AP)と量子化パラメータのエンドツーエンドトレーニング(E2E-QP)。Block-APでは、各トランスフォーマーブロック内の全パラメータに対してブロック単位の再構築を行いながら量子化対応トレーニングを順次実施し、LLM全体をトレーニングすることを避けることで効率を維持します。量子化されたモデルで初期化された後、E2E-QPでは量子化パラメータ(ステップサイズ)のみをエンドツーエンドでトレーニングし、固定された量子化バックボーンと削減されたトレーニング可能なパラメータ数により効率を向上させます。広範な実験により、EfficientQATが7Bから70Bパラメータまでの様々な量子化ビット幅において、ベースLLM、指示チューニングされたLLM、マルチモーダルLLMを含む幅広いモデルで従来の量子化手法を凌駕することが実証されました。例えば、EfficientQATは単一のA100-80GB GPU上で41時間で2ビットのLlama-2-70Bモデルを取得し、フル精度と比較して3%未満の精度低下(69.48 vs. 72.41)を達成しました。特に、このINT2量子化された70Bモデルは、Llama-2-13Bモデル(69.48 vs. 67.81)に対して1.67の精度向上を達成しつつ、より少ないメモリ(19.2GB vs. 24.2GB)を必要とします。コードはhttps://github.com/OpenGVLab/EfficientQATで公開されています。
English
Large language models (LLMs) are integral to modern natural language
processing and artificial intelligence. However, they face challenges in
managing their significant memory requirements. Although quantization-aware
training (QAT) offers a solution by reducing memory consumption through low-bit
representations with minimal accuracy loss, it demands substantial training
resources to optimize model weights and quantization parameters. To address
this, we propose Efficient Quantization-Aware Training (EfficientQAT), a novel
quantization technique for compressing LLMs. EfficientQAT involves two
consecutive phases: Block-wise training of all parameters (Block-AP) and
end-to-end training of quantization parameters (E2E-QP). Block-AP sequentially
conducts quantization-aware training for all parameters in each transformer
block with block-wise reconstruction, maintaining efficiency by avoiding
training the entire LLM. Initialized with quantized model, E2E-QP then trains
only quantization parameters (step sizes) end-to-end, enhancing efficiency with
a fixed quantized backbone and reduced trainable parameter count. Extensive
experiments demonstrate that EfficientQAT outperforms previous quantization
methods across a range of models, including base LLMs, instruction-tuned LLMs,
and multimodal LLMs, with scales from 7B to 70B parameters at various
quantization bits. For instance, EfficientQAT obtains a 2-bit Llama-2-70B model
on a single A100-80GB GPU in 41 hours, with less than 3\% accuracy degradation
compared to the full precision (69.48 vs. 72.41). Notably, this INT2 quantized
70B model obtains a 1.67 accuracy gain over the Llama-2-13B model (69.48 vs.
67.81) while requiring less memory (19.2GB vs. 24.2GB). Code is available at
https://github.com/OpenGVLab/EfficientQAT.Summary
AI-Generated Summary