Lune

ICSE2022顶会

VarCLR: Variable Semantic Representation Pre-training via Contrastive Learning

Qibin Chen, Jeremy Lacomis, Edward J. Schwartz, Graham Neubig, Bogdan Vasilescu, Claire Le Goues

摘要

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. INTRODUCTION Variable names convey key information about code structure and developer intention. They are thus central for code comprehension, readability, and maintainability [7, 46]. A growing array of

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 13 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning 引用了 Language Models are Few-Shot Learners
  • ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Unsupervised Learning of Visual Features by Contrasting Cluster Assignments 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Unsupervised Learning of Visual Features by Contrasting Cluster Assignments 引用了 Supervised Contrastive Learning
  • Distinguishing Look-Alike Innocent and Vulnerable Code by Subtle Semantic Representation Learning and Explanation 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Demo2Code: From Summarizing Demonstrations to Synthesizing Code via Extended Chain-of-Thought 引用了 CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
  • Bootstrap Your Own Latent - A New Approach to Self-Supervised Learning 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Supervised Contrastive Learning 引用了 A Simple Framework for Contrastive Learning of Visual Representations
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper13

  1. CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement LearningHung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese 等NeurIPS 2022 · 571 次引用
  2. Demo2Code: From Summarizing Demonstrations to Synthesizing Code via Extended Chain-of-ThoughtYuki Wang, Gonzalo Gonzalez-Pumariega, Yash Sharma, Sanjiban ChoudhuryNeurIPS 2023 · 67 次引用
  3. ContraBERT: Enhancing Code Pre-trained Models via Contrastive LearningShangqing Liu, Bozhi Wu, Xiaofei Xie, Guozhu Meng 等ICSE 2023 · 56 次引用
  4. Distinguishing Look-Alike Innocent and Vulnerable Code by Subtle Semantic Representation Learning and ExplanationChao Ni, Xin Yin, Kaiwen Yang, Dehai Zhao 等FSE 2023 · 42 次引用
  5. Ahoy SAILR! There is No Need to DREAM of C: A Compiler-Aware Structuring Algorithm for Binary DecompilationZion Leonahenahe Basque, Ati Priya Bajaj, Wil Gibbs, Jude O'Kain 等USENIX Security 2024 · 32 次引用

它引用的 Paper17

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 次引用
  3. Bootstrap Your Own Latent - A New Approach to Self-Supervised LearningJean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec 等NeurIPS 2020 · 9,171 次引用
  4. Supervised Contrastive LearningPrannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna 等NeurIPS 2020 · 7,049 次引用
  5. Unsupervised Learning of Visual Features by Contrasting Cluster AssignmentsMathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal 等NeurIPS 2020 · 5,249 次引用

相关 Paper

  1. IdBench: Evaluating Semantic Representations of Identifier Names in Source CodeYaza Wainakh, Moiz Rauf, Michael PradelICSE 2021 · 2 次引用
  2. "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 等S&P 2024 · 30 次引用
  3. Generating Variable Explanations via Zero-shot Prompt LearningChong Wang, Yiling Lou, Junwei Liu, Xin PengASE 2023 · 7 次引用
  4. RefBERT: A Two-Stage Pre-trained Framework for Automatic Rename RefactoringHao Liu, Yanlin Wang, Zhao Wei, Yong Xu 等ISSTA 2023 · 19 次引用
  5. CLEAR: Contrastive Learning for API RecommendationMoshi Wei, Nima Shiri Harzevili, Yuchao Huang, Junjie Wang 等ICSE 2022 · 43 次引用
黄昏的海面,两侧是细线勾勒的悬崖