RefBERT: A Two-Stage Pre-trained Framework for Automatic Rename Refactoring
Hao Liu, Yanlin Wang, Zhao Wei, Yong Xu, Juhong Wang, Hui Li, Rongrong Ji
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 .
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- EALink: An Efficient and Accurate Pre-Trained Framework for Issue-Commit Link Recovery cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- EALink: An Efficient and Accurate Pre-Trained Framework for Issue-Commit Link Recovery cites GraphCodeBERT: Pre-training Code Representations with Data Flow
- EALink: An Efficient and Accurate Pre-Trained Framework for Issue-Commit Link Recovery cites SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code Representations
- EALink: An Efficient and Accurate Pre-Trained Framework for Issue-Commit Link Recovery cites UniXcoder: Unified Cross-Modal Pre-training for Code Representation
- EALink: An Efficient and Accurate Pre-Trained Framework for Issue-Commit Link Recovery cites Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Tasks
- SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code Representations cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code Representations cites GraphCodeBERT: Pre-training Code Representations with Data Flow
- SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code Representations cites Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Tasks
- UniXcoder: Unified Cross-Modal Pre-training for Code Representation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- UniXcoder: Unified Cross-Modal Pre-training for Code Representation cites GraphCodeBERT: Pre-training Code Representations with Data Flow
Cited by top-tier papers1
Builds on5
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
- SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code RepresentationsChangan Niu, Chuanyi Li, Vincent Ng, Jidong Ge et al.ICSE 2022 · 99 citations
- Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related TasksAntonio Mastropaolo, Simone Scalabrino, Nathan Cooper, David Nader-Palacio et al.ICSE 2021 · 9 citations
- UniXcoder: Unified Cross-Modal Pre-training for Code RepresentationDaya Guo, Shuai Lu, Nan Duan, Yanlin Wang et al.ACL 2022
Related papers
- ContraBERT: Enhancing Code Pre-trained Models via Contrastive LearningShangqing Liu, Bozhi Wu, Xiaofei Xie, Guozhu Meng et al.ICSE 2023 · 56 citations
- "Len or index or count, anything but v1": Predicting Variable Names in Decompilation Output with Transfer LearningKuntal Kumar Pal, Ati Priya Bajaj, Pratyay Banerjee, Audrey Dutcher et al.S&P 2024 · 30 citations
- Program merge conflict resolution via neural transformersAlexey Svyatkovskiy, Sarah Fakhoury, Negar Ghorbani, Todd Mytkowicz et al.FSE 2022 · 33 citations
- VarCLR: Variable Semantic Representation Pre-training via Contrastive LearningQibin Chen, Jeremy Lacomis, Edward J. Schwartz, Graham Neubig et al.ICSE 2022 · 23 citations
- Context-Aware Name Recommendation for Field RenamingChunhao Dong, Yanjie Jiang, Nan Niu, Yuxia Zhang et al.ICSE 2024 · 4 citations
