arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.05771cs.SE
收藏

使用上下文感知提示微调自动化方法优化

Automating Method Naming with Context-Aware Prompt-Tuning

Jie Zhu, Lingwei Li, Li Yang, Xiaoxiao Ma, Chun Zuo

摘要:

方法名对于程序的理解和维护至关重要。最近,已经提出了许多方法来自动推荐方法名称和检测不一致的名称。尽管有希望,但考虑到以下三个缺点,它们的结果仍然是次优的:1)这些模型大多是从头开始训练的,同时学习两个不同的目标。两个目标之间的不一致将对训练效率和模型性能产生负面影响。2)封闭类上下文没有得到充分利用,这使得学习方法的抽象函数变得困难。3)目前的方法名一致性检查方法遵循生成然后比较的过程,这限制了准确性,因为它们高度依赖于生成的名称的质量,并且难以测量语义一致性。在本文中,我们提出了一种名为AUMENA的方法来自动命名方法与上下文感知的提示微调任务。与现有的基于深度学习的方法不同,我们的模型首先学习情境化表示(即,类属性),然后充分利用大语言模型的能力和知识,通过提示微调精确检测不一致的方法名,推荐更准确的方法名。为了更好地识别语义一致的名称,我们建模的方法名称一致性检查任务作为两个类的分类问题,避免了以前的基于相似性的一致性检查方法的局限性。实验结果表明,AUMENA在四个方法名称推荐数据集上的得分分别为68.6%、72.0%、73.6%、84.7%,分别超过最新基线的8.5%、18.4%、11.0%、12.0%。我们的方法在方法名称一致性检查上的准确率为80.8%,达到了5.5%的优异表现。所有数据和训练模型都是公开的。

英文摘要:

Method names are crucial to program comprehension and maintenance. Recently, many approaches have been proposed to automatically recommend method names and detect inconsistent names. Despite promising, their results are still sub-optimal considering the three following drawbacks: 1) These models are mostly trained from scratch, learning two different objectives simultaneously. The misalignment between two objectives will negatively affect training efficiency and model performance. 2) The enclosing class context is not fully exploited, making it difficult to learn the abstract function of the method. 3) Current method name consistency checking methods follow a generate-then-compare process, which restricts the accuracy as they highly rely on the quality of generated names and face difficulty measuring the semantic consistency. In this paper, we propose an approach named AUMENA to AUtomate MEthod NAming tasks with context-aware prompt-tuning. Unlike existing deep learning based approaches, our model first learns the contextualized representation(i.e., class attributes) of PL and NL through the pre-training model, then fully exploits the capacity and knowledge of large language model with prompt-tuning to precisely detect inconsistent method names and recommend more accurate names. To better identify semantically consistent names, we model the method name consistency checking task as a two-class classification problem, avoiding the limitation of previous similarity-based consistency checking approaches. The experimental results reflect that AUMENA scores 68.6%, 72.0%, 73.6%, 84.7% on four datasets of method name recommendation, surpassing the state-of-the-art baseline by 8.5%, 18.4%, 11.0%, 12.0%, respectively. And our approach scores 80.8% accuracy on method name consistency checking, reaching an 5.5% outperformance. All data and trained models are publicly available.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑