paperbot · PL 论文追踪

全部论文 待读 收藏

P2 RefBERT: A Two-Stage Pre-trained Framework for Automatic Rename Refactoring

RefBERT:一个用于自动重命名重构的两阶段预训练框架
ISSTA Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis2023匹配度 2/10 · 该论文属于机器学习与程序语言交叉,但聚焦变量重命名重构的命名生成,未涉及静态分析/形式化验证、Agentic 程序、浮点程序分析或贝叶斯程序分析,也未将 LLM/Agent 用于改进静态分析,与用户核心研究方向关联较弱。引用 27 inbox
Hao Liu, Yanlin Wang, Zhao Wei, Yong Xu, Juhong Wang, Hui Li, Rongrong Ji
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出两阶段预训练框架 RefBERT,为命名不佳的变量自动生成更准确、可读的新名称。

重命名重构是软件演化中最常见的重构之一,但现有工作多只识别两个版本间的重命名活动,很少关注如何为标识符建议新名称。本文研究变量名的自动重命名重构,指出其与主流学习范式及自然语言文本生成之间的差异。为此提出 RefBERT:先预测新名称包含的子词数量,再据此生成子词;并引入约束掩码语言建模、对比学习和 bag-of-tokens 损失,使其适配变量重命名任务。在自建重构数据集上的大量实验表明,RefBERT 生成的变量名比现有方法更准确、更有意义。

问题
现有重命名重构研究主要识别重命名活动,缺乏自动为命名不佳的变量建议新名称的方法;变量名重命名比其它重命名更具挑战。
方法
提出两阶段预训练框架 RefBERT,先预测新名称的子词数量,再生成子词,并采用约束掩码语言建模、对比学习和 bag-of-tokens 损失。
评估
在作者构建的重构数据集上进行大量实验,与现有方法比较生成变量名的准确性与意义。
原文摘要(Abstract)

Refactoring is an indispensable practice of improving the quality and maintainability of source code in software evolution. Rename refactoring is the most frequently performed refactoring that suggests a new name for an identifier to enhance readability when the identifier is poorly named. However, most existing works only identify renaming activities between two versions of source code, while few works express concern about how to suggest a new name. In this paper, we study automatic rename refactoring on variable names, which is considered more challenging than other rename refactoring activities. We first point out the connections between rename refactoring and various prevalent learning paradigms and the difference between rename refactoring and general text generation in natural language processing. Based on our observations, we propose RefBERT, a two-stage pre-trained framework for rename refactoring on variable names. RefBERT first predicts the number of sub-tokens in the new name and then generates sub-tokens accordingly. Several techniques, including constrained masked language modeling, contrastive learning, and the bag-of-tokens loss, are incorporated into RefBERT to tailor it for automatic rename refactoring on variable names. Through extensive experiments on our constructed refactoring datasets, we show that the generated variable names of RefBERT are more accurate and meaningful than those produced by the existing method. Our implementation and data are available at https://github.com/KDEGroup/RefBERT.

链接与引用

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

BibTeX
@inproceedings{LiuWWXWLJ23,
  title = {RefBERT: A Two-Stage Pre-trained Framework for Automatic Rename Refactoring},
  author = {Hao Liu and Yanlin Wang and Zhao Wei and Yong Xu and Juhong Wang and Hui Li and Rongrong Ji},
  booktitle = {ISSTA},
  year = {2023},
  doi = {10.1145/3597926.3598092}
}