mlsanityData to 7 Oct 2026

Align Attention Heads Before Merging Them: An Effective Way for Converting MHA to GQA

arXiv 2412.20677 ↗First posted 30 Dec 2024cs.CLcited by 6

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have demonstrated exceptional performance across diverse natural language processing tasks. However, as the model size and the input sequence's length increase, the linearly increasing key-value (KV) cache significantly degrades inference throughput. Therefore, grouped-query attention (GQA), as an alternative to multi-head attention (MHA), has been widely introduced into LLMs. In this work, we propose a cost-effective method for converting MHA into GQA with any compression ratio of KV heads. The key point of our method lies in the application of Procrustes analysis to the attention heads, which enhances the similarity among attention heads while preserving computational invariance, thereby improving the model's post-training performance. Subsequently, we employ mathitL0 regularization to prune redundant parameters. The model after pruning can be adapted to the standard GQA framework. Experimental results show that our strategy can compress up to 87.5% KV heads of LLaMA2-7B model and 75% KV heads of Sheared-LLaMA-1.3B with acceptable performance degradation. Our code is released at https://github.com/fpcsong/mha2gqa.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 41 of its 52 references that are in the map. First posted on arXiv 30 Dec 2024.

Builds on

41 of 52 references.

References · 41

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2022Training language models to follow instructions with human feedbackcited by 15,712
  4. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  5. 2024The Llama 3 Herd of Modelscited by 14,192
  6. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  7. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  8. 2020Measuring Massive Multitask Language Understandingcited by 7,768
  9. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
  10. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  11. 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
  12. 2023Mistral 7Bcited by 3,065
29 more
  1. 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
  2. 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
  3. 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
  4. 2024Qwen2 Technical Reportcited by 2,076
  5. 2020Knowledge Distillation: A Surveycited by 1,578
  6. 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
  7. 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,093
  8. 2023SparseGPT: Massive Language Models Can Be Accurately Pruned in One-Shotcited by 1,090
  9. 2023A Simple and Effective Pruning Approach for Large Language Modelscited by 776
  10. 2023The Flan Collection: Designing Data and Methods for Effective Instruction Tuningcited by 734
  11. 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 700
  12. 2024TinyLlama: An Open-Source Small Language Modelcited by 604
  13. 2017Learning Sparse Neural Networks through L0 Regularizationcited by 571
  14. 2024KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantizationcited by 571
  15. 2024Sora: A Review on Background, Technology, Limitations, and Opportunities of Large Vision Modelscited by 467
  16. 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Timecited by 428
  17. 2023Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruningcited by 408
  18. 2024SliceGPT: Compress Large Language Models by Deleting Rows and Columnscited by 378
  19. 2023Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Timecited by 247
  20. 2019Structured Pruning of Large Language Modelscited by 201
  21. 2022Structured Pruning Learns Compact and Accurate Modelscited by 167
  22. 2024Keyformer: KV Cache Reduction through Key Tokens Selection for Efficient Generative Inferencecited by 124
  23. 2024No Token Left Behind: Reliable KV Cache Compression via Importance-Aware Mixed Precision Quantizationcited by 99
  24. 2024RazorAttention: Efficient KV Cache Compression Through Retrieval Headscited by 99
  25. 2024WKVQuant: Quantizing Weight and Key/Value Cache for Large Language Models Gains Morecited by 69
  26. 2024Effectively Compress KV Heads for LLMcited by 30
  27. 2024BiLD: Bi-directional Logits Difference Loss for Large Language Model Distillationcited by 16
  28. 2024Optimised Grouped-Query Attention Mechanism for Transformerscited by 11
  29. 2024DHA: Learning Decoupled-Head Attention from Transformer Checkpoints via Adaptive Heads Fusioncited by 6

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 5; 2026: 1.

6 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026GQLA: Group-Query Latent Attention for Hardware-Adaptive Large Language Model Decoding
  2. 2024QCQA: Quality and Capacity-aware grouped Query Attention
  3. 2025Towards Economical Inference: Enabling DeepSeek's Multi-Head Latent Attention in Any Transformer-based LLMs
  4. 2025Knocking-Heads Attention
  5. 2024Reducing Transformer Key-Value Cache Size with Cross-Layer Attention
  6. 2025GTA: Grouped-head latenT Attention
  7. 2024Beyond KV Caching: Shared Attention for Efficient LLMs
  8. 2025EG-MLA: Embedding-Gated Multi-head Latent Attention for Scalable and Efficient LLMs