通过分析注意力模块位置,揭示模型记忆与泛化的权衡机制。
Analyzing Memorization in Large Language Models through the Lens of Model Attribution
- 用归因方法干预不同层的注意力模块,观察其对记忆的影响。
- 深层注意力模块主导记忆,浅层则影响泛化与推理能力。
- 为降低隐私风险提供可操作的模型优化方向。
大型语言模型在现代应用中广泛使用,但常会记忆训练数据,导致隐私泄露和版权问题。现有研究多聚焦于事后分析,如提取记忆内容或构建记忆度量指标,未深入探讨导致记忆的架构因素。本文从架构视角出发,分析不同层注意力模块对记忆与泛化性能的影响。利用归因技术,系统性地绕过特定模块的注意力机制,同时保持层归一化与MLP变换等组件不变。我们从数学角度提出定理,界定了有无归因时各层输出的差异。理论与实证分析表明,深层Transformer块中的注意力模块主要负责记忆,而浅层块对模型的泛化与推理能力至关重要。我们在Pythia和GPTNeo两类模型及五个基准数据集上进行了全面验证。研究结果为在不损害性能的前提下缓解模型记忆问题提供了实用路径,有助于推动更安全、更符合伦理的大模型落地应用。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are prevalent in modern applications but often memorize training data, leading to privacy breaches and copyright issues. Existing research has mainly focused on posthoc analyses, such as extracting memorized content or developing memorization metrics, without exploring the underlying architectural factors that contribute to memorization. In this work, we investigate memorization from an architectural lens by analyzing how attention modules at different layers impact its memorization and generalization performance. Using attribution techniques, we systematically intervene in the LLM architecture by bypassing attention modules at specific blocks while keeping other components like layer normalization and MLP transformations intact. We provide theorems analyzing our intervention mechanism from a mathematical view, bounding the difference in layer outputs with and without our attributions. Our theoretical and empirical analyses reveal that attention modules in deeper transformer blocks are primarily responsible for memorization, whereas earlier blocks are crucial for the models generalization and reasoning capabilities. We validate our findings through comprehensive experiments on different LLM families (Pythia and GPTNeo) and five benchmark datasets. Our insights offer a practical approach to mitigate memorization in LLMs while preserving their performance, contributing to safer and more ethical deployment in real world applications.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。