ChatPaper.aiChatPaper

MoA: Mengsel van Sparse Attention voor Automatische Compressie van Grote Taalmodellen

MoA: Mixture of Sparse Attention for Automatic Large Language Model Compression

June 21, 2024
Auteurs: Tianyu Fu, Haofeng Huang, Xuefei Ning, Genghan Zhang, Boju Chen, Tianqi Wu, Hongyi Wang, Zixiao Huang, Shiyao Li, Shengen Yan, Guohao Dai, Huazhong Yang, Yu Wang
cs.AI

Samenvatting

Sparse attention kan de aanzienlijke geheugen- en doorvoereisen van Large Language Models (LLMs) in lange contexten effectief verminderen. Bestaande methoden gebruiken doorgaans een uniform sparse attention masker, waarbij hetzelfde sparse patroon wordt toegepast op verschillende attention heads en invoerlengtes. Deze uniforme aanpak slaagt er echter niet in om de diverse aandachtspatronen die inherent zijn aan LLMs vast te leggen, en negeert hun specifieke nauwkeurigheid-latency afwegingen. Om deze uitdaging aan te pakken, stellen we de Mixture of Attention (MoA) voor, die automatisch verschillende sparse aandachtconfiguraties aanpast aan verschillende heads en lagen. MoA construeert en navigeert een zoekruimte van verschillende aandachtspatronen en hun schaalregels ten opzichte van invoersequentielengtes. Het profileert het model, evalueert potentiële configuraties en bepaalt het optimale sparse aandachtcompressieplan. MoA past zich aan aan variërende invoergroottes en laat zien dat sommige attention heads hun focus uitbreiden om langere sequenties te accommoderen, terwijl andere heads zich consistent concentreren op vaste-lengte lokale contexten. Experimenten tonen aan dat MoA de effectieve contextlengte met 3,9 keer verhoogt bij dezelfde gemiddelde aandachtsspanne, en de ophaalnauwkeurigheid met 1,5-7,1 keer verbetert ten opzichte van de uniform-attention baseline over de Vicuna-7B, Vicuna-13B en Llama3-8B modellen. Bovendien verkleint MoA de capaciteitskloof tussen sparse en dense modellen, en reduceert de maximale relatieve prestatievermindering van 9%-36% tot binnen 5% over twee lange-context begripstests. MoA bereikt een 1,2-1,4 keer vermindering van het GPU-geheugen en verhoogt de decode doorvoer met 5,5-6,7 keer voor 7B en 13B dense modellen op een enkele GPU, met minimale impact op de prestaties.
English
Sparse attention can effectively mitigate the significant memory and throughput demands of Large Language Models (LLMs) in long contexts. Existing methods typically employ a uniform sparse attention mask, applying the same sparse pattern across different attention heads and input lengths. However, this uniform approach fails to capture the diverse attention patterns inherent in LLMs, ignoring their distinct accuracy-latency trade-offs. To address this challenge, we propose the Mixture of Attention (MoA), which automatically tailors distinct sparse attention configurations to different heads and layers. MoA constructs and navigates a search space of various attention patterns and their scaling rules relative to input sequence lengths. It profiles the model, evaluates potential configurations, and pinpoints the optimal sparse attention compression plan. MoA adapts to varying input sizes, revealing that some attention heads expand their focus to accommodate longer sequences, while other heads consistently concentrate on fixed-length local contexts. Experiments show that MoA increases the effective context length by 3.9times with the same average attention span, boosting retrieval accuracy by 1.5-7.1times over the uniform-attention baseline across Vicuna-7B, Vicuna-13B, and Llama3-8B models. Moreover, MoA narrows the capability gaps between sparse and dense models, reducing the maximum relative performance drop from 9%-36% to within 5% across two long-context understanding benchmarks. MoA achieves a 1.2-1.4times GPU memory reduction and boosts decode throughput by 5.5-6.7 times for 7B and 13B dense models on a single GPU, with minimal impact on performance.
PDF164November 29, 2024