url : https://arxiv.org/pdf/2305.17888
QAT가 연구되지 않은 이유)
2 측면을 신경써야 함:

Pretrain data의 distribution을 얻기 위해 → 이미 pretrain data로 학습된 pretrained model을 사용해 next token data generation
<start token>을 랜덤하게 뽑은 후, 문장 생성
3가지 sampling strategies 실험)
LLM weight&activation distribution에서는 outlier가 많이 존재 (smaller model이랑 다름) → small model의 SOTA quantization clipping method가 잘 작용하지 않을 수 있음 → LLM에 맞는 적절한 quantizer 식별
Quantization Function

Outlier가 확실히 안좋은 영향을 주지만, 그렇다고 quantization을 할 때 outlier를 없애는 것도 LLM 성능에 안좋다
학습의 초기 단계 동안, clipping 기반 방법은 perplexity score를 매우 높힌다(i.e., > 10000) → fine-tuning을 통해 회복하기 힘들 정도로 상당한 정보 손실 유발
이상치를 유지하는 방법 선택
실험적 Finding) GLU function을 사용하는 모델 → Activations & Weight : Symmetric distribution
LLaMA model의 activation function: SwiGLU = Swi + GLU
Symmetric MinMax quantization 선택 ⇒ Activation & Weight 모두에
: quantized activations or weights, : real-valued weights or activations
Efficient quantization을 위해, per-token activation quantization & per-channel weight quantization 채택 (아래 그림)

Quantization-aware training for key-value cache
Knowledge Distillation
Cross-Entropy 기반 logits distillation 사용 (teacher model: full-precision & student model: quantized)
: 전체 n개의 문장에서 i번째 sample, : class의 수(논문의 경우 vocabulary size)
: Teacher network, Student network
결국 top-1 candidate를 뽑지 않고 distribution에 맞춰 sampling 하기 때문에, student model을 학습시킬 때 사용하는 sampling에 내재된 noise가 들어있을 것 → 학습에 사용하는 next token은 optimal label을 사용하는 것은 아니다
이를 보완하기 위해 teacher model의 soft label(logit)을 활용하여, student model을 학습시 더 풍부한 정보 제공!
논문에서 LLM의 일반화 성능 유지를 중요시 하는 것 같음. 따라서 zero-shot performance와 few-shot performance를 확인
Data Generation: LLaMA-7B model 활용 & 생성 문장의 최대 길이 1024
Bits: Weight - Activation - KV




낮은 bit로 quantization 했을 때, LLM-QAT가 좋은 성능을 내는 것처럼 보이나 비교군이 적절하지 않은 것 같음
그렇게 생각한 이유) SmoothQuant의 경우 핵심이 W8A8(weight: 8-bit, activation: 8-bit)을 이끌어 내는 것이며, KV cache의 quantization에 대한 내용은 해당 논문에 나오지 않음→ 그렇기에 SmoothQuant의 weight와 activation이 8-bit인 결과만 비교할 거리가 된다고 생각 & KV cache의 quantization에 대한 내용은 smoothquant에 나오지 않은데, KV의 bit에 따른 비교가 적절한지 모르겠음
따라서 SmoothQuant와 비교하려면 8-8-16을 비교하는 것이 맞다고 보는데, 이는 SmoothQuant가 전반적으로 더 성능이 좋아보임(zero-shot performance의 경우)
LLaMA all 16-bit인 baseline과 비교하는 것은 유의미하다고 보는데, weight, KV cache를 4-bit까지 & activation을 6-bit까지 줄여도 성능이 어느정도 유지된다는 점은 유의미하다고 봄
Data Generation을 LLaMA 7B로 했는데, 그러면 teacher model이 LLaMA 7B인 것일까? 그러면 LLaMA 13B, LLaMA-30B 모델의 결과는 규모가 더 작은 모델이 teacher model이 된 것일까?



4-bit quantization이 흔하지 않다보니, 논문에서 이를 비교한 부분이 아쉬웠다(SmoothQuant는 4-bit quantization의 비교군으로 적절하지 않다고 봄)
잘 학습된 모델에서 생성하는 data를 이용해 distillation을 하며 quantized model이 일반화 성능을 잃지 않는다는 점이 흥미로웠음