发现预训练大模型中12%以上注意力头无效,可安全删减而不影响性能。
Identifying and Evaluating Inactive Heads in Pretrained LLMs
- 用12种评分函数检测注意力头是否失效,结合阈值筛选潜在无效头。
- 平均12%以上注意力头可被删除,且在MMLU上精度下降不足1%。
- 基于输出均值范数的评分更有效,能发现传统权重方法遗漏的无效头。
注意力是大语言模型的核心机制,使不同注意力头能聚焦于相关输入标记。然而,如首标记接收过多注意力(尽管语义重要性低)等学习行为表明部分头可能处于无效状态,构成显著的计算冗余。本文评估了12种衡量头无效性的评分函数,通过阈值筛选潜在无效头。通过模型干预验证,发现平均超过12%的注意力头为无效,在特定情境下可被移除而保持MMLU准确率与预训练模型相差不超过1%。在3个模型家族中,基于输出均值范数的评分函数比仅依赖注意力权重的函数更能识别无效头。仅依赖首标记注意力集中的评分函数会低估无效头比例,平均遗漏超7%。此外,分析评分分布揭示微调对注意力行为影响极小,同一模型族内大模型规模也表现出不同的注意力模式。
原文摘要 · Abstract (English)
Attention is foundational to large language models (LLMs), enabling different heads to have diverse focus on relevant input tokens. However, learned behaviors like attention sinks, where the first token receives the most attention despite limited semantic importance, suggest some heads may be inactive, and point to a significant source of computational redundancy. To analyze this phenomenon, we evaluate 12 score functions that measure different ways a head can be inactive. Thresholding these scores allows us to analyze different sets of potentially inactive attention heads. We evaluate whether identified heads are inactive through model interventions, finding that more than 12% of attention heads are inactive on average, and can be ablated in specific contexts while maintaining MMLU accuracy to within 1% of the pretrained LLM. Across 3 model families, our score functions that measure the average norm of a head's output consistently identify inactive heads that would not have been found by score functions that rely solely on attention weights. We establish that relying on a score function that measures a first token attention sink would underestimate the prevalence of inactive heads, failing to identify more than 7% of inactive heads on average. We also show how measuring score distributions can provide insights into attention behavior. For instance, we find evidence that finetuning causes little to no change in attention behavior, and that even within the same model family, large model scales present different attention behaviors.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。