IdBench: Evaluating Semantic Representations of Identifier Names in Source Code
Yaza Wainakh, Moiz Rauf, Michael Pradel
摘要
Identifier names convey useful information about the intended semantics of code. Name-based program analyses use this information, e.g., to detect bugs, to predict types, and to improve the readability of code. At the core of name-based analyses are semantic representations of identifiers, e.g., in the form of learned embeddings. The high-level goal of such a representation is to encode whether two identifiers, e.g., len and size, are semantically similar. Unfortunately, it is currently unclear to what extent semantic representations match the semantic relatedness and similarity perceived by developers. This paper presents IdBench, the first benchmark for evaluating semantic representations against a ground truth created from thousands of ratings by 500 software developers. We use IdBench to study state-of-the-art embedding techniques proposed for natural language, an embedding technique specifically designed for source code, and lexical string distance functions. Our results show that the effectiveness of semantic representations varies significantly and that the best available embeddings successfully represent semantic relatedness. On the downside, no existing technique provides a satisfactory representation of semantic similarities, among other reasons because identifiers with opposing meanings are incorrectly considered to be similar, which may lead to fatal mistakes, e.g., in a refactoring tool. Studying the strengths and weaknesses of the different techniques shows that they complement each other. As a first step toward exploiting this complementarity, we present an ensemble model that combines existing techniques and that clearly outperforms the best available semantic representation.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 8 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- StateFormer: fine-grained type recovery from binaries using generative state modeling 引用了 TypeWriter: neural type prediction with search-based validation
- Thinking Like a Developer? Comparing the Attention of Humans with Neural Models of Code 引用了 Semantic bug seeding: a learning-based approach for creating realistic bugs
- Thinking Like a Developer? Comparing the Attention of Humans with Neural Models of Code 引用了 TypeWriter: neural type prediction with search-based validation
引用它的顶会 Paper8
- Semantic bug seeding: a learning-based approach for creating realistic bugsJibesh Patra, Michael PradelFSE 2021 · 63 次引用
- StateFormer: fine-grained type recovery from binaries using generative state modelingKexin Pei, Jonas Guan, Matthew Broughton, Zhongtian Chen 等FSE 2021 · 53 次引用
- Lightweight global and local contexts guided method name recommendation with prior knowledgeShangwen Wang, Ming Wen, Bo Lin, Xiaoguang MaoFSE 2021 · 38 次引用
- VarCLR: Variable Semantic Representation Pre-training via Contrastive LearningQibin Chen, Jeremy Lacomis, Edward J. Schwartz, Graham Neubig 等ICSE 2022 · 23 次引用
- Thinking Like a Developer? Comparing the Attention of Humans with Neural Models of CodeMatteo Paltenghi, Michael PradelASE 2021 · 21 次引用
它引用的 Paper2
相关 Paper
- EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence CheckingAnjiang Wei, Jiannan Cao, Ran Li, Hongyu Chen 等EMNLP 2025
- You Are What You Annotate: Towards Better Models through Annotator RepresentationsNaihao Deng, Xinliang Frederick Zhang, Siyang Liu, Winston Wu 等EMNLP Findings 2023 · 5 次引用
- Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 次引用
- ODASim: Ordered, Distinctive and Absolute Semantic Similarity for Code Explanation EvaluationPrince Kumar, Vitobha Munigala, Jaydeep Sen, Ashish R. Mittal 等ACL Findings 2026
- SrcMarker: Dual-Channel Source Code Watermarking via Scalable Code TransformationsBorui Yang, Wei Li, Liyao Xiang, Bo LiS&P 2024 · 21 次引用
