基于深度学习的不一致方法名识别:我们进展如何?
Deep Learning-Based Identification of Inconsistent Method Names: How Far Are We?
AI总结:
本研究通过新基准评估五种深度学习不一致方法名识别方法,发现性能大幅下降,并提出对比学习与LLM改进方向。
摘要:
简洁且有意义的方法名对于程序理解和维护至关重要。然而,方法名可能与其对应的实现变得不一致,从而引发混乱和错误。已有多种基于深度学习(DL)的方法被提出用于识别此类不一致性,初步评估显示出有前景的结果。然而,这些评估通常使用平衡数据集,其中不一致和一致名称的数量相等。这种设置,加上有缺陷的数据集构建,导致了误报,使得所报告的性能在现实场景中(大多数方法名是一致的)不太可靠。在本文中,我们提出了一项实证研究,评估了最先进的基于深度学习的方法用于识别不一致方法名。我们通过结合从提交历史中的自动识别和人工开发者检查,创建了一个新的基准,减少了误报。我们在此基准上评估了五种具有代表性的深度学习方法(一种基于检索的和四种基于生成的)。我们的结果表明,从平衡数据集转移到新基准时,性能大幅下降。我们进一步进行了定量和定性分析,以理解这些方法的优缺点。基于检索的方法在简单方法和具有流行名称子令牌的方法上表现良好,但由于低效的表示技术而失败。基于生成的方法在相似性计算不准确和名称生成不成熟方面存在困难。基于这些发现,我们提出了使用对比学习和大型语言模型(LLMs)的改进。我们的研究表明,在这些深度学习方法能够有效应用于现实世界的软件系统之前,还需要显著的改进。
英文摘要:
Concise and meaningful method names are crucial for program comprehension and maintenance. However, method names may become inconsistent with their corresponding implementations, causing confusion and errors. Several deep learning (DL)-based approaches have been proposed to identify such inconsistencies, with initial evaluations showing promising results. However, these evaluations typically use a balanced dataset, where the number of inconsistent and consistent names are equal. This setup, along with flawed dataset construction, leads to false positives, making reported performance less reliable in real-world scenarios, where most method names are consistent. In this paper, we present an empirical study that evaluates state-of-the-art DL-based methods for identifying inconsistent method names. We create a new benchmark by combining automatic identification from commit histories and manual developer inspections, reducing false positives. We evaluate five representative DL approaches (one retrieval-based and four generation-based) on this benchmark. Our results show that performance drops substantially when moving from the balanced dataset to the new benchmark. We further conduct quantitative and qualitative analyses to understand the strengths and weaknesses of the approaches. Retrieval-based methods perform well on simple methods and those with popular name sub-tokens but fail due to inefficient representation techniques. Generation-based methods struggle with inaccurate similarity calculations and immature name generation. Based on these findings, we propose improvements using contrastive learning and large language models (LLMs). Our study suggests that significant improvements are needed before these DL approaches can be effectively applied to real-world software systems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。