paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code Comprehension

同一枚硬币的两面:利用标识符在神经代码理解中的影响
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 3/10 · 论文研究神经代码理解模型对标识符命名的鲁棒性,属于机器学习与程序语言交叉中的代码理解方向,但与画像核心的静态分析、Agentic 程序分析、LLM/Agent 改进静态分析/形式化验证等方向无直接关联;也未涉及浮点程序分析或贝叶斯程序分析。引用 30 inbox
Shuzheng Gao, Cuiyun Gao, Chaozheng Wang, Jun Sun, David Lo, Yue Yu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:从因果视角提出反事实推理框架CREAM,通过多任务学习与反事实推断抑制标识符误导,提升神经代码理解的鲁棒性与准确率。

已有研究表明,神经代码理解模型对标识符命名高度敏感:仅重命名一个标识符即可使模型输出完全无关的结果,说明标识符可能误导模型预测。然而标识符并非完全有害,其名称语义与程序语义存在关联。如何同时利用标识符的正反两面影响,以提升神经代码理解的鲁棒性与准确性,仍缺乏深入探索。本文从因果视角对标识符影响进行建模,提出反事实推理框架CREAM:训练阶段通过多任务学习显式捕获标识符中的误导信息,推理阶段则利用反事实推断削弱误导影响。作者在函数命名、缺陷检测和代码分类三个主流神经代码理解任务上评估CREAM,实验表明其鲁棒性显著优于基线(如函数命名任务F1提升37.9%),同时在原始数据集上也取得更优结果(如函数命名任务F1提升0.5%)。

问题
神经代码理解模型易受标识符命名干扰,少量重命名即可导致预测完全失效;但标识符语义又与程序语义相关,如何利用标识符的双面影响以增强模型鲁棒性和准确性仍未被充分探索。
方法
从因果视角建模标识符影响,提出反事实推理框架CREAM:训练阶段用多任务学习显式捕获标识符的误导信息,推理阶段通过反事实推断降低误导影响。
评估
在函数命名、缺陷检测和代码分类三个主流神经代码理解任务上评估,表明CREAM在鲁棒性(如函数命名F1提升37.9%)与原始数据集准确率(如F1提升0.5%)上均优于基线。
原文摘要(Abstract)

Previous studies have demonstrated that neural code comprehension models are vulnerable to identifier naming. By renaming as few as one identifier in the source code, the models would output completely irrelevant results, indicating that identifiers can be misleading for model prediction. However, identifiers are not completely detrimental to code comprehension, since the semantics of identifier names can be related to the program semantics. Well exploiting the two opposite impacts of identifiers is essential for enhancing the robustness and accuracy of neural code comprehension, and still remains under-explored. In this work, we propose to model the impact of identifiers from a novel causal perspective, and propose a counterfactual reasoning-based framework named CREAM. CREAM explicitly captures the misleading information of identifiers through multi-task learning in the training stage, and reduces the misleading impact by counterfactual inference in the inference stage. We evaluate CREAM on three popular neural code comprehension tasks, including function naming, defect detection and code classification. Experiment results show that CREAM not only significantly outperforms baselines in terms of robustness (e.g., +37.9% on the function naming task at F1 score), but also achieve improved results on the original datasets (e.g., +0.5% on the function naming task at F1 score).

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{GaoGWSLY23,
  title = {Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code Comprehension},
  author = {Shuzheng Gao and Cuiyun Gao and Chaozheng Wang and Jun Sun and David Lo and Yue Yu},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00164}
}