RSQ: Leren van belangrijke tokens leidt tot betere gekwantiseerde LLM's
RSQ: Learning from Important Tokens Leads to Better Quantized LLMs
March 3, 2025
Auteurs: Yi-Lin Sung, Prateek Yadav, Jialu Li, Jaehong Yoon, Mohit Bansal
cs.AI
Samenvatting
Laaggewijze kwantisatie is een cruciale techniek voor het efficiënt comprimeren van grote modellen zonder dure hertraining. Eerdere methoden kwantiseren doorgaans de gewichten van elke laag door het "uniform" optimaliseren van de laagreconstructieverlies over alle uitvoertokens. In dit artikel tonen we echter aan dat beter gekwantiseerde modellen kunnen worden verkregen door prioriteit te geven aan het leren van belangrijke tokens (bijv. tokens met grote attentiescores). Op basis van deze bevinding stellen we RSQ (Rotate, Scale, then Quantize) voor, dat (1) rotaties (orthogonale transformaties) toepast op het model om uitbijters (die een uitzonderlijk grote omvang hebben) te verminderen, (2) de tokenfeatures schaalt op basis van hun belangrijkheid, en (3) het model kwantiseert met behulp van het GPTQ-framework met de tweede-orde statistieken berekend door geschaalde tokens. Om de belangrijkheid van tokens te berekenen, verkennen we zowel heuristische als dynamische strategieën. Op basis van een grondige analyse van alle benaderingen, nemen we aandachtconcentratie, die de attentiescores van elk token gebruikt als zijn belangrijkheid, aan als de beste benadering. We tonen aan dat RSQ consistent beter presteert dan baseline-methoden over meerdere downstreamtaken en drie modelfamilies: LLaMA3, Mistral en Qwen2.5. Daarnaast behalen modellen die met RSQ zijn gekwantiseerd superieure prestaties op taken met lange contexten, wat verder de effectiviteit ervan benadrukt. Tot slot toont RSQ generaliseerbaarheid over verschillende opstellingen, waaronder verschillende modelgroottes, kalibratiedatasets, bitprecisies en kwantisatiemethoden.
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