paperbot · PL 论文追踪

全部论文 待读 收藏

P2 VarCLR

VarCLR:变量名的对比学习语义表示
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 4/10 · 该论文属于机器学习与程序语言的交叉,用对比学习/BERT学习变量名语义表示以服务变量相似性等程序分析任务,与“AI→PL”方向有间接关联。但未涉及用户核心关注的静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析,且方法不基于当前强LLM/Agent,因此匹配度有限。引用 43 inbox
Qibin Chen, Jeremy Lacomis, Edward J. Schwartz, Graham Neubig, Bogdan Vasilescu, Claire Le Goues
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 VarCLR,用对比学习学习变量名语义表示,显著提升变量相似性任务性能。

变量名对表达程序意图至关重要,已有基于机器学习的程序分析常依赖变量名表示。但此前方法多捕捉“相关”而非严格“相似”。论文提出 VarCLR:将变量名语义表示视为对比学习问题,拉近语义相似的变量名、推远不相似者;并从 GitHub 编辑中挖掘弱监督变量重命名数据集。该方法使 BERT 等通用语言模型可有效用于变量名表示,并支持相似名搜索、拼写纠正等下游任务。在显式评测变量相似性的 IDBENCH 上,VarCLR 显著超越当时最优方法。作者发布数据、代码和预训练模型,可作为依赖变量名的现有或未来程序分析的可替换表示。

问题
已有变量名表示方法主要捕捉变量名之间的“相关”而非真正的语义“相似”,难以支撑变量名相似性搜索、拼写纠正等对语义一致性要求较高的任务。
方法
将变量名表示学习建模为对比学习,构建从 GitHub 编辑中挖掘的弱监督变量重命名数据集,并借此训练或微调 BERT 等通用语言模型以获得变量名语义表示。
评估
在显式衡量变量相似性的 IDBENCH 基准上与当时最优方法比较,并发布数据、代码与预训练模型供下游任务使用。
原文摘要(Abstract)

Variable names are critical for conveying intended program behavior. Machine learning-based program analysis methods use variable name representations for a wide range of tasks, such as suggesting new variable names and bug detection. Ideally, such methods could capture semantic relationships between names beyond syntactic similarity, e.g., the fact that the names average and mean are similar. Unfortunately, previous work has found that even the best of previous representation approaches primarily capture “relatedness” (whether two variables are linked at all), rather than “similarity” (whether they actually have the same meaning). We propose Varclr, a new approach for learning semantic representations of variable names that effectively captures variable similarity in this stricter sense. We observe that this problem is an excellent fit for contrastive learning, which aims to minimize the distance between explicitly similar inputs, while maximizing the distance between dissimilar inputs. This requires labeled training data, and thus we construct a novel, weakly-supervised variable renaming dataset mined from GitHub edits. We show that Varclr enables the effective application of sophisticated, general-purpose language models like BERT, to variable name representation and thus also to related downstream tasks like variable name similarity search or spelling correction. Varclr produces models that significantly outperform the state-of-the-art on IDBENCH, an existing benchmark that explicitly captures variable similarity (as distinct from relatedness). Finally, we contribute a release of all data, code, and pre-trained models, aiming to provide a drop-in replacement for variable representations used in either existing or future program analyses that rely on variable names.

链接与引用

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

BibTeX
@inproceedings{abs-2112-02650,
  title = {VarCLR},
  author = {Qibin Chen and Jeremy Lacomis and Edward J. Schwartz and Graham Neubig and Bogdan Vasilescu and Claire Le Goues},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510162}
}