Neural Code Comprehension: A Learnable Representation of Code Semantics
Tal Ben-Nun, Alice Shoshana Jakobovits, Torsten Hoefler

TL;DR
This paper introduces inst2vec, a language-independent code embedding learned from an intermediate representation, which effectively captures program semantics and improves performance prediction and algorithm classification tasks.
Contribution
It proposes a novel code embedding space based on IR and contextual flow, enabling robust semantic understanding across programming languages.
Findings
Embeddings outperform specialized approaches in performance prediction.
State-of-the-art results in algorithm classification from raw code.
Effective qualitative analysis of embeddings through analogies and clustering.
Abstract
With the recent success of embeddings in natural language processing, research has been conducted into applying similar methods to code analysis. Most works attempt to process the code directly or use a syntactic tree representation, treating it like sentences written in a natural language. However, none of the existing methods are sufficient to comprehend program semantics robustly, due to structural features such as function calls, branching, and interchangeable order of statements. In this paper, we propose a novel processing technique to learn code semantics, and apply it to a variety of program analysis tasks. In particular, we stipulate that a robust distributional hypothesis of code applies to both human- and machine-generated programs. Following this hypothesis, we define an embedding space, inst2vec, based on an Intermediate Representation (IR) of the code that is independent…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Ferroelectric and Negative Capacitance Devices · Adversarial Robustness in Machine Learning
