Context2Name: A Deep Learning-Based Approach to Infer Natural Variable Names from Usage Contexts
arXiv:1809.05193
Abstract
Most of the JavaScript code deployed in the wild has been minified, a process in which identifier names are replaced with short, arbitrary and meaningless names. Minified code occupies less space, but also makes the code extremely difficult to manually inspect and understand. This paper presents Context2Name, a deep learningbased technique that partially reverses the effect of minification by predicting natural identifier names for minified names. The core idea is to predict from the usage context of a variable a name that captures the meaning of the variable. The approach combines a lightweight, token-based static analysis with an auto-encoder neural network that summarizes usage contexts and a recurrent neural network that predict natural names for a given usage context. We evaluate Context2Name with a large corpus of real-world JavaScript code and show that it successfully predicts 47.5% of all minified identifiers while taking only 2.9 milliseconds on average to predict a name. A comparison with the state-of-the-art tools JSNice and JSNaughty shows that our approach performs comparably in terms of accuracy while improving in terms of efficiency. Moreover, Context2Name complements the state-of-the-art by predicting 5.3% additional identifiers that are missed by both existing tools.
References in corpus (8)
- Distributed Representations of Words and Phrases and their Compositionality
- Sequence to Sequence Learning with Neural Networks
- Semi-supervised Sequence Learning
- Learning Natural Coding Conventions
- DeepCoder: Learning to Write Programs
- DeepSign: Deep Learning for Automatic Malware Signature Generation and Classification
- Automated Correction for Syntax Errors in Programming Assignments using Recurrent Neural Networks
- SmartPaste: Learning to Adapt Source Code
Cited by in corpus (13)
- Neural Reverse Engineering of Stripped Binaries using Augmented Control Flow Graphs
- Maybe Deep Neural Networks are the Best Choice for Modeling Source Code
- SCELMo: Source Code Embeddings from Language Models
- Modeling Vocabulary for Big Code Machine Learning
- DOBF: A Deobfuscation Pre-Training Objective for Programming Languages
- Neural Bug Finding: A Study of Opportunities and Challenges
- In Nomine Function: Naming Functions in Stripped Binaries with Neural Networks
- Self-Supervised Learning to Prove Equivalence Between Straight-Line Programs via Rewrite Rules
- Variable Name Recovery in Decompiled Binary Code using Constrained Masked Language Modeling
- Do Names Echo Semantics? A Large-Scale Study of Identifiers Used in C++'s Named Casts
- Equivalence of Dataflow Graphs via Rewrite Rules Using a Graph-to-Sequence Neural Model
- Proving Equivalence Between Complex Expressions Using Graph-to-Sequence Neural Models
- Towards Top-Down Automated Development in Limited Scopes: A Neuro-Symbolic Framework from Expressibles to Executables