Q-GaLore: Gekwantiseerde GaLore met INT4-projectie en laagadaptieve laag-ranggradiënten
Q-GaLore: Quantized GaLore with INT4 Projection and Layer-Adaptive Low-Rank Gradients
July 11, 2024
Auteurs: Zhenyu Zhang, Ajay Jaiswal, Lu Yin, Shiwei Liu, Jiawei Zhao, Yuandong Tian, Zhangyang Wang
cs.AI
Samenvatting
Het trainen van Large Language Models (LLMs) is geheugenintensief vanwege het grote aantal parameters en de bijbehorende optimalisatiestatussen. GaLore, een recente methode, vermindert het geheugengebruik door gewichtsgradiënten te projecteren in een laagrangige deelruimte zonder in te leveren op prestaties. GaLore is echter afhankelijk van tijdrovende Singular Value Decomposition (SVD)-operaties om de deelruimte te identificeren, en de frequente updates van de deelruimte leiden tot aanzienlijke overhead in de trainingstijd. Bovendien biedt GaLore minimale verbeteringen in nauwkeurigheid en efficiëntie vergeleken met LoRA in meer toegankelijke fine-tuning-scenario's. Om deze beperkingen aan te pakken, introduceren we Q-GaLore, een nieuwe aanpak die het geheugengebruik aanzienlijk vermindert door kwantisatie en laagrangige projectie te combineren, waardoor de voordelen van GaLore worden overtroffen. Onze methode is gebaseerd op twee belangrijke observaties: (i) de gradiëntdeelruimte vertoont diverse eigenschappen, waarbij sommige lagen vroeg in de training convergeren terwijl andere onderhevig zijn aan frequente veranderingen; (ii) de projectiematrices zijn zeer veerkrachtig tegen laagbit-kwantisatie. Door gebruik te maken van deze inzichten, past Q-GaLore de gradiëntdeelruimte adaptief aan op basis van de convergentiestatistieken, waardoor vergelijkbare prestaties worden bereikt terwijl het aantal SVD-operaties aanzienlijk wordt verminderd. We behouden de projectiematrices in INT4-formaat en gewichten in INT8-formaat, waarbij stochastisch afronden wordt gebruikt om geaccumuleerde gradiëntinformatie vast te leggen. Deze aanpak maakt een hoogprecisie-trainingspad mogelijk met alleen laagprecisie-gewichten. We tonen aan dat Q-GaLore zeer competitieve prestaties bereikt met uitzonderlijke geheugenefficiëntie. Tijdens pre-training maakt Q-GaLore het mogelijk om een LLaMA-7B-model vanaf nul te trainen op een enkele NVIDIA RTX 4060 Ti met slechts 16 GB geheugen. Tijdens fine-tuning vermindert het het geheugengebruik met tot wel 50% vergeleken met LoRA en GaLore, terwijl het consistent beter presteert dan QLoRA bij dezelfde geheugenkosten.
English
Training Large Language Models (LLMs) is memory-intensive due to the large
number of parameters and associated optimization states. GaLore, a recent
method, reduces memory usage by projecting weight gradients into a low-rank
subspace without compromising performance. However, GaLore relies on
time-consuming Singular Value Decomposition (SVD) operations to identify the
subspace, and the frequent subspace updates lead to significant training time
overhead. Moreover, GaLore offers minimal improvements in accuracy and
efficiency compared to LoRA in more accessible fine-tuning scenarios. To
address these limitations, we introduce Q-Galore, a novel approach that
substantially reduces memory usage by combining quantization and low-rank
projection, surpassing the benefits of GaLore. Our method is based on two key
observations: (i) the gradient subspace exhibits diverse properties, with some
layers converging early in training while others are subject to frequent
changes; (ii) the projection matrices are highly resilient to low-bit
quantization. Leveraging these insights, Q-GaLore adaptively updates the
gradient subspace based on its convergence statistics, achieving comparable
performance while significantly reducing the number of SVD operations. We
maintain the projection matrices in INT4 format and weights in INT8 format,
incorporating stochastic rounding to capture accumulated gradient information.
This approach enables a high-precision training trajectory using only
low-precision weights. We demonstrate that Q-GaLore achieves highly competitive
performance with exceptional memory efficiency. At pre-training, Q-GaLore
facilitates training a LLaMA-7B model from scratch on a single NVIDIA RTX 4060
Ti with only 16 GB memory. At fine-tuning, it reduces memory consumption by up
to 50% compared to LoRA and GaLore, while consistently outperforming QLoRA at
the same memory cost.