arXiv:2506.13727cs.LGcs.AI2025-06被引 3

用归因引导剪枝,精准定位并修复小模型的不良行为

Attribution-Guided Pruning for Insight and Control: Circuit Discovery and Targeted Correction in Small-scale LLMs

  • 通过归因分析识别影响输出的关键神经元和权重
  • 剪掉0.3%神经元可大幅降低有毒内容,仅0.03%权重剪枝即减少重复生成
  • 适用于调试与修正小模型,尤其适合关注可控性的研究者

大型语言模型虽广泛应用,但其内部机制难以解释与控制,限制了对异常行为的诊断与修正。机制可解释性通过识别负责特定行为的“电路”(即模型组件子集)来应对这一挑战。然而,由于模型规模与复杂度高,电路发现仍具难度。本文将电路发现建模为识别在特定任务输入下对输出贡献最大的参数,并利用带参考样本的层间相关性传播(LRP)进行归因与剪枝提取。在此基础上,引入对比相关性以分离与不良行为相关的电路,同时保留通用能力,实现针对性修正。在OPT-125M上,剪除约0.3%的神经元显著减少毒性输出,剪除约0.03%的权重元素即可缓解重复文本生成,且不损害整体性能。该方法在多个小型语言模型上验证有效,具备跨架构迁移能力。代码已开源。

原文摘要 · Abstract (English)

Large Language Models (LLMs) are widely deployed in real-world applications, yet their internal mechanisms remain difficult to interpret and control, limiting our ability to diagnose and correct undesirable behaviors. Mechanistic interpretability addresses this challenge by identifying circuits -- subsets of model components responsible for specific behaviors. However, discovering such circuits in LLMs remains difficult due to their scale and complexity. We frame circuit discovery as identifying parameters that contribute most to model outputs on task-specific inputs, and use Layer-wise Relevance Propagation (LRP) with reference samples to attribute and extract these components via pruning. Building on this, we introduce contrastive relevance to isolate circuits associated with undesired behaviors while preserving general capabilities, enabling targeted model correction. On OPT-125M, we show that pruning as little as ~0.3% of neurons substantially reduces toxic outputs, while pruning approximately 0.03% of weight elements mitigates repetitive text generation without degrading general performance. These results establish attribution-guided pruning as an effective mechanism for identifying and intervening on behavior-specific circuits in LLMs. We further validate our findings on additional small-scale language models, demonstrating that the proposed approach transfers across architectures. Our code is publicly available at https://github.com/erfanhatefi/SparC3.

模型可解释性剪枝小模型行为控制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。