paper-with-me

Papers

Embedding Java Classes with code2vec: Improvements from Variable Obfuscation

2020-04-06 · Rhys Compton, Eibe Frank, Panos Patros, Abigail Koay

Automatic source code analysis in key areas of software engineering, such as code security, can benefit from Machine Learning (ML). However, many standard ML approaches require a numeric representation of data and cannot be applied directly to source code. Thus, to enable ML, we need to embed source code into numeric feature vectors while maintaining the semantics of the code as much as possible. code2vec is a recently released embedding approach that uses the proxy task of method name prediction to map Java methods to feature vectors. However, experimentation with code2vec shows that it learns to rely on variable names for prediction, causing it to be easily fooled by typos or adversarial attacks. Moreover, it is only able to embed individual Java methods and cannot embed an entire collection of methods such as those present in a typical Java class, making it difficult to perform predictions at the class level (e.g., for the identification of malicious Java classes). Both shortcomings are addressed in the research presented in this paper. We investigate the effect of obfuscating variable names during the training of a code2vec model to force it to rely on the structure of the code rather than specific names and consider a simple approach to creating class-level embeddings by aggregating sets of method embeddings. Our results, obtained on a challenging new collection of source-code classification problems, indicate that obfuscating variable names produces an embedding model that is both impervious to variable naming and more accurately reflects code semantics. The datasets, models, and code are shared for further ML research on source code.

📄 PDF Abstract BibTeX arXiv:2004.02942

Code (2)

basedrhys/obfuscated-code2vec 공식 구현 tf
ciselab/lampion

Tasks

Code ClassificationMethod name prediction

Similar Papers 제목 키워드 기반

LLMs for Automated Unit Test Generation and Assessment in Java: The AgoneTest Framework

2025-11-25 · Andrea Lops, Fedelucio Narducci, Azzurra Ragone, Michelantonio Trizio 외 arxiv

Unit testing is an essential but resource-intensive step in software development, ensuring individual code units function correctly. This paper introduces AgoneTest, an automated evaluation framework for Large Language M…

Prompt Engineering

The test set for the TransCoder system

2020-08-01 · Ernest Davis

The TransCoder system translates source code between Java, C++, and Python 3. The test set that was used to evaluate its quality is missing important features of Java, including the ability to define and use classes and …

RAMBO: Enhancing RAG-based Repository-Level Method Body Completion

2024-09-23 · Tuan-Dung Bui, Duc-Thieu Luu-Van, Thanh-Phat Nguyen, Thu-Trang Nguyen 외

Code completion is essential in software development, helping developers by predicting code snippets based on context. Among completion tasks, Method Body Completion (MBC) is particularly challenging as it involves gener…

Code CompletionCode GenerationRAG

SpIDER: Spatially Informed Dense Embedding Retrieval for Software Issue Localization

2025-12-18 · Shravan Chaudhari, Rahul Thomas Jacob, Mononito Goswami, Jiajun Cao 외 arxiv

Retrieving code functions, classes or files relevant to a user query, bug report or feature request from large codebases is a fundamental challenge for Large Language Model (LLM)-based coding agents. Agentic approaches t…

Recovering Variable Names for Minified Code with Usage Contexts

2019-06-08 · Hieu Tran, Ngoc Tran, Son Nguyen, Hoan Nguyen 외

In modern Web technology, JavaScript (JS) code plays an important role. To avoid the exposure of original source code, the variable names in JS code deployed in the wild are often replaced by short, meaningless names, th…

Information RetrievalRetrieval