Skip to main content
QUICK REVIEW

[Paper Review] LLM-QAT: Data-Free Quantization Aware Training for Large Language Models

Zechun Liu, Barlas Oğuz|arXiv (Cornell University)|May 29, 2023
Topic ModelingComputer Science15 citations
TL;DR

LLM-QAT introduces data-free quantization-aware training for large language models, enabling 4-bit quantization of weights, activations, and KV caches via generated-data distillation, outperforming post-training quantization, across 7B/13B/30B LLaMA models.

ABSTRACT

Several post-training quantization methods have been applied to large language models (LLMs), and have been shown to perform well down to 8-bits. We find that these methods break down at lower bit precision, and investigate quantization aware training for LLMs (LLM-QAT) to push quantization levels even further. We propose a data-free distillation method that leverages generations produced by the pre-trained model, which better preserves the original output distribution and allows quantizing any generative model independent of its training data, similar to post-training quantization methods. In addition to quantizing weights and activations, we also quantize the KV cache, which is critical for increasing throughput and support long sequence dependencies at current model sizes. We experiment with LLaMA models of sizes 7B, 13B, and 30B, at quantization levels down to 4-bits. We observe large improvements over training-free methods, especially in the low-bit settings.

Motivation & Objective

  • Motivate quantization of large language models beyond 8 bits while preserving zero-shot and few-shot capabilities.
  • Propose a data-free distillation approach to generate training signals from the pre-trained model for QAT without access to original data.
  • Quantize weights, activations, and KV cache using tailored quantizers suitable for LLM distributions.
  • Demonstrate that QAT with data-free distillation preserves output distributions and outperforms PTQ across model scales.
  • Assess tradeoffs between model size, bit-precision, and throughput for practical deployment.

Proposed method

  • Introduce data-free distillation by generating next-token data from the pre-trained model, using a hybrid sampling strategy (top-1 for first 3–5 tokens, then stochastic sampling).
  • Use cross-entropy logits distillation from a teacher (full-precision) to train a quantized student; soft labels improve training over hard labels.
  • Adopt symmetric MinMax quantization for weights and activations with per-channel weight and per-token activation quantization.
  • Quantize the KV cache per-token with stored scaling factors and integrate quantization into gradient computation during QAT.
  • Quantize the transformer’s fully-connected layers, including the KV cache, to 4-bit weights/4-bit activations (and 6-bit activations in some settings).
  • Demonstrate data-free distillation effectiveness across LLaMA-7B, -13B, and -30B, achieving first accurate 4-bit LLMs and enabling KV cache quantization for throughput.

Experimental results

Research questions

  • RQ1Can data-free knowledge distillation preserve the original output distribution of large language models during quantization-aware training?
  • RQ2How low can bit precision go for weights, activations, and KV cache in LLMs while maintaining zero-shot and few-shot capabilities?
  • RQ3What are the effects of different quantizers, sampling strategies, and distillation targets on LLM quantization performance?
  • RQ4Does simultaneous KV cache quantization substantially improve throughput without sacrificing accuracy?

Key findings

  • LLM-QAT enables 4-bit quantization of weights, activations, and KV cache for LLaMA-7B/13B/30B with notable accuracy retention compared to 8-bit PTQ baselines.
  • In 8-8-8 and 4-8-4/4-8-8 settings, LLM-QAT often outperforms state-of-the-art PTQ methods, e.g., 30B in 8-8-4 yields higher zero-shot accuracy than PTQ baselines.
  • 4-bit weight and 4-bit activation configurations can achieve near full-precision performance (average loss within ~1.5 points) on several zero-shot tasks, with 4-bit activations showing 6-bit feasibility in some cases.
  • Data generated by the model via next-token sampling provides better generalization for zero-shot tasks than real-data subsets or WikiText-only finetuning.
  • Logit-based knowledge distillation from the teacher consistently outperforms label-only or attention/hidden-state distillation options in their ablations.
  • Combining LLM-QAT with SmoothQuant yields gains in certain 4/4/16 and 4/8/16 setups, though benefits depend on bit allocation across weights and activations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.