Code Search based on Context-aware Code Translation
Weisong Sun, Chunrong Fang, Yuchen Chen, Guanhong Tao, Tingxu Han, Quanjun Zhang
摘要
Code search is a widely used technique by developers during software development. It provides semantically similar implementations from a large code corpus to developers based on their queries. Existing techniques leverage deep learning models to construct embedding representations for code snippets and queries, respectively. Features such as abstract syntactic trees, control flow graphs, etc., are commonly employed for representing the semantics of code snippets. However, the same structure of these features does not necessarily denote the same semantics of code snippets, and vice versa. In addition, these techniques utilize multiple different word mapping functions that map query words/code tokens to embedding representations. This causes diverged embeddings of the same word/token in queries and code snippets. We propose a novel context-aware code translation technique that translates code snippets into natural language descriptions (called translations). The code translation is conducted on machine instructions, where the context information is collected by simulating the execution of instructions. We further design a shared word mapping function using one single vocabulary for generating embeddings for both translations and queries. We evaluate the effectiveness of our technique, called TranCS, on the CodeSearchNet corpus with 1,000 queries. Experimental results show that TranCS significantly outperforms state-of-the-art techniques by 49.31% to 66.50% in terms of MRR (mean reciprocal rank).
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 11 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Rethinking Negative Pairs in Code Search 引用了 Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations
- Rethinking Negative Pairs in Code Search 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detection 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- LExecutor: Learning-Guided Execution 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Two Birds with One Stone: Boosting Code Generation and Code Search via a Generative Adversarial Network 引用了 Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations
- Two Birds with One Stone: Boosting Code Generation and Code Search via a Generative Adversarial Network 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- A Joint Learning Model with Variational Interaction for Multilingual Program Translation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
引用它的顶会 Paper11
- An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong DetectionShenao Yan, Shen Wang, Yue Duan, Hanbin Hong 等USENIX Security 2024 · 63 次引用
- Two Birds with One Stone: Boosting Code Generation and Code Search via a Generative Adversarial NetworkShangwen Wang, Bo Lin, Zhensu Sun, Ming Wen 等OOPSLA 2023 · 21 次引用
- LExecutor: Learning-Guided ExecutionBeatriz Souza, Michael PradelFSE 2023 · 16 次引用
- Rethinking Negative Pairs in Code SearchHaochen Li, Xin Zhou, Anh Tuan Luu, Chunyan MiaoEMNLP 2023 · 6 次引用
- A Joint Learning Model with Variational Interaction for Multilingual Program TranslationYali Du, Hui Sun, Ming LiASE 2024 · 6 次引用
它引用的 Paper5
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- Functional code clone detection with syntax and semantics fusion learningChunrong Fang, Zixi Liu, Yangyang Shi, Jeff Huang 等ISSTA 2020 · 125 次引用
- Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving TransformationsNghi D. Q. Bui, Yijun Yu, Lingxiao JiangSIGIR 2021 · 98 次引用
- OCoR: An Overlapping-Aware Code RetrieverQihao Zhu, Zeyu Sun, Xiran Liang, Yingfei Xiong 等ASE 2020 · 28 次引用
- Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related TasksAntonio Mastropaolo, Simone Scalabrino, Nathan Cooper, David Nader-Palacio 等ICSE 2021 · 9 次引用
相关 Paper
- Uncertainty-Aware Contrastive Learning with Hard Negative Sampling for Code Search TasksHan Liu, Jiaqing Zhan, Qin ZhangAAAI 2025 · 1 次引用
- Disentangled Code Representation Learning for Multiple Programming LanguagesJingfeng Zhang, Haiwen Hong, Yin Zhang, Yao Wan 等ACL Findings 2021 · 16 次引用
- Exploring Representation-level Augmentation for Code SearchHaochen Li, Chunyan Miao, Cyril Leung, Yanxian Huang 等EMNLP 2022 · 17 次引用
- Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun 等ICSE 2020 · 242 次引用
- CoDesc: A Large Code-Description Parallel DatasetMasum Hasan, Tanveer Muttaqueen, Abdullah Al Ishtiaq, Kazi Sajeed Mehrab 等ACL Findings 2021 · 20 次引用
