DeepSim: deep learning code functional similarity
By Gang Zhao, Jeff Huang. 2018
288 citations recorded by the source corpus.
Measuring code similarity is fundamental for many software engineering tasks, e.g., code search, refactoring and reuse. However, most existing techniques focus on code syntactical similarity only, while measuring code functional similarity remains a challenging problem. In this paper, we propose a novel approach that encodes code control flow and data flow into a semantic matrix in which each element is a high dimensional sparse binary feature vector, and we design a new deep learning model that measures code functional similarity based on this representation. By concatenating hidden representations learned from a code pair, this new model transforms the problem of detecting functionally similar code to binary classification, which can effectively learn patterns between functionally similar code with very different syntactics. We have implemented our approach, DeepSim, for Java programs and evaluated its recall, precision and time performance on two large datasets of functionally similar code. The experimental results show that DeepSim significantly outperforms existing state-of-the-art techniques, such as DECKARD, RtvNN, CDLH, and two baseline deep neural networks models.
Subfields: Information Systems, Software, Program Analysis & Verification, Signal Processing
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Information Systems
In Software
In Program Analysis & Verification
In Signal Processing
- Michael Pradel
- Ge Li
- Georgios Gousios
- Satish Chandra
- Jason Liu
- Zhi Jin
- Tien Nhut Nguyen
- Shaohua Wang
Citations in the corpus
- TypeWriter: neural type prediction with search-based validation (2019, background): “Beyond type prediction, others have proposed learning-based techniques to find programming errors [25, 28], predict variable and method names [1, 29, 35], suggest how to improve names [19], search code [10, 31], detect clones [38, 42], classify code [24, 41], predict code edits [33, 40, 43], predict”
- Text2Mesh: Text-Driven Neural Stylization for Meshes (2021, background): “A recent line of work leverages the inductive bias of neural networks for tasks such as image denoising [58], surface reconstruction [18, 19], point cloud consolidation [39], image synthesis, and editing [50, 53, 70].”
- Improving bug detection via context-based code representation learning and attention-based neural networks (2019, methodology): “Comparable Baselines: We compare our code representation with the following state-of-the-art code representations on bug detection: • DeepSim [Zhao and Huang 2018]: DeepSim represents source code for code similarity.”
- Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree (2020, methodology): “Different from other deep-learning based clone detection techniques, the inputs of DeepSim is not code fragments, but semantic matrices with manually extracted semantic features from CFGs.”
- Learning-Based Recursive Aggregation of Abstract Syntax Trees for Code Clone Detection (2019, methodology): “DeepSim [15] represents Java methods by matrices encoding their control flow and data flow graphs.”
- Retrieval-based Neural Source Code Summarization (2020, methodology): “Recently neural models are incorporated to learn vector representations of source code and use these vectors to compute code similarity [56, 57, 65, 67], which can achieve better performance but need additional time-consuming training and labeled data.”
- A Novel Neural Source Code Representation Based on Abstract Syntax Tree (2019, background): “DeepSim [62] encodes code control flow and data flow into a semantic matrix for measuring code functional similarity.”