代码训练语言模型的冗余与概念分析
Redundancy and Concept Analysis for Code-trained Language Models
AI总结:
本文对源代码模型进行首次神经元级分析,通过冗余分析发现超过95%的神经元可被消除而不显著降低准确率,并通过概念分析追踪特定代码属性对应的神经元,为模型压缩和迁移学习提供依据。
摘要:
代码训练的语言模型已被证明在各种代码智能任务中非常有效。然而,由于计算瓶颈和内存限制,对于许多软件工程应用来说,它们的训练和部署可能具有挑战性。实施有效的策略来解决这些问题需要更好地理解这些“黑盒”模型。在本文中,我们对源代码模型进行了首次神经元级别的分析,以识别潜在表示中的“重要”神经元。我们通过消除与给定任务高度相似或无关的神经元来实现这一目标。这种方法帮助我们了解哪些神经元和层可以被消除(冗余分析),以及重要的代码属性在网络中的位置(概念分析)。利用冗余分析,我们得出了与知识转移和模型优化应用相关的观察结果。我们发现,超过95%的神经元相对于我们的代码智能任务是冗余的,可以在准确率没有显著损失的情况下被消除。我们还发现了几个神经元子集,它们可以以基线准确率进行预测。通过概念分析,我们探索了潜在代码表示中人类可识别概念的可追溯性和分布,这些概念可用于影响模型预测。我们将单个和子集的重要神经元追溯到特定的代码属性,并识别出用于token级任务的“number”神经元、“string”神经元和更高层次的“text”神经元,以及用于句子级下游任务的重要更高层次概念。这也帮助我们理解了任务相关特征的可分解性和可转移性,并有助于为迁移学习、模型压缩以及将深度神经网络分解为模块设计更好的技术。
英文摘要:
Code-trained language models have proven to be highly effective for various code intelligence tasks. However, they can be challenging to train and deploy for many software engineering applications due to computational bottlenecks and memory constraints. Implementing effective strategies to address these issues requires a better understanding of these 'black box' models. In this paper, we perform the first neuron-level analysis for source code models to identify \textit{important} neurons within latent representations. We achieve this by eliminating neurons that are highly similar or irrelevant to the given task. This approach helps us understand which neurons and layers can be eliminated (redundancy analysis) and where important code properties are located within the network (concept analysis). Using redundancy analysis, we make observations relevant to knowledge transfer and model optimization applications. We find that over 95\% of the neurons are redundant with respect to our code intelligence tasks and can be eliminated without significant loss in accuracy. We also discover several subsets of neurons that can make predictions with baseline accuracy. Through concept analysis, we explore the traceability and distribution of human-recognizable concepts within latent code representations which could be used to influence model predictions. We trace individual and subsets of important neurons to specific code properties and identify 'number' neurons, 'string' neurons, and higher-level 'text' neurons for token-level tasks and higher-level concepts important for sentence-level downstream tasks. This also helps us understand how decomposable and transferable task-related features are and can help devise better techniques for transfer learning, model compression, and the decomposition of deep neural networks into modules.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。