指导神经元的代码LLM解释:在哪里、为什么和如何?
Neuron-Guided Interpretation of Code LLMs: Where, Why, and How?
AI总结:
研究通过分析代码LLM的神经元层面,发现语言特定神经元和概念层在多语言生成中的作用,提出基于神经元的微调、克隆检测和跨语言总结方法。
摘要:
代码语言模型在代码智能任务上表现出色,但其内部可解释性研究不足。现有NLP神经元可解释性技术在源代码上效果不佳,因编程语言具有形式化、层次化和可执行的特性。本文通过实证研究,定位语言特定神经元和概念层,分析Llama-3.1-8B和Qwen2.5-Coder-32B在多语言输入中的神经元选择性和层间贡献。发现神经元专门针对个别语言,同时存在支持通用生成的通用子集;底层主要编码语言特定语法,中层捕获跨语言共享的语义抽象,形成概念层。通过三个任务验证:神经元引导的代码生成微调、基于概念层嵌入的克隆检测、概念层引导的代码总结迁移,均在多语言场景中取得一致提升。
英文摘要:
Code language models excel on code intelligence tasks, yet their internal interpretability is underexplored. Existing neuron interpretability techniques from NLP are suboptimal for source code due to programming languages formal, hierarchical, and executable nature. We empirically investigate code LLMs at the neuron level, localizing language-specific neurons (selectively responsive to one language) and concept layers (feed-forward layers encoding language-agnostic code representations). We analyze Llama-3.1-8B and Qwen2.5-Coder-32B on multilingual inputs in C++, Java, Python, Go, and JavaScript, measuring neuron selectivity and layerwise contributions during generation. We find (1) neurons specialized for individual languages alongside a universal subset supporting general-purpose generation; and (2) lower layers mainly encode language-specific syntax, while middle layers capture semantic abstractions shared across languages, emerging as concept layers. We demonstrate utility on three tasks: neuron-guided fine-tuning for code generation, clone detection via concept-layer embeddings, and concept-layer-guided transfer for code summarization, each yielding consistent gains in multilingual settings.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。