Skip to main content
QUICK REVIEW

[Paper Review] Learning Blended, Precise Semantic Program Embeddings

Ke Wang, Zhendong Su|arXiv (Cornell University)|Jul 3, 2019
Software Engineering ResearchComputer Science26 references17 citations
TL;DR

This paper proposes LiGer, a deep neural network that learns precise program embeddings by blending symbolic and concrete execution traces, significantly improving semantic classification accuracy and reducing execution overhead compared to state-of-the-art static and dynamic models. LiGer achieves state-of-the-art performance in program semantics classification and method name prediction, outperforming Gated Graph Neural Networks, code2vec, and code2seq while requiring 10x fewer executions than DYPRO.

ABSTRACT

Learning neural program embeddings is key to utilizing deep neural networks in program languages research --- precise and efficient program representations enable the application of deep models to a wide range of program analysis tasks. Existing approaches predominately learn to embed programs from their source code, and, as a result, they do not capture deep, precise program semantics. On the other hand, models learned from runtime information critically depend on the quality of program executions, thus leading to trained models with highly variant quality. This paper tackles these inherent weaknesses of prior approaches by introducing a new deep neural network, \liger, which learns program representations from a mixture of symbolic and concrete execution traces. We have evaluated \liger on \coset, a recently proposed benchmark suite for evaluating neural program embeddings. Results show \liger (1) is significantly more accurate than the state-of-the-art syntax-based models Gated Graph Neural Network and code2vec in classifying program semantics, and (2) requires on average 10x fewer executions covering 74\% fewer paths than the state-of-the-art dynamic model \dypro. Furthermore, we extend \liger to predict the name for a method from its body's vector representation. Learning on the same set of functions (more than 170K in total), \liger significantly outperforms code2seq, the previous state-of-the-art for method name prediction.

Motivation & Objective

  • To address the limitations of static models that rely solely on source code and fail to capture deep semantics.
  • To overcome the high variance and execution overhead of dynamic models that depend on concrete program executions.
  • To develop a hybrid approach that combines symbolic and concrete execution traces for more precise and efficient program embeddings.
  • To improve the accuracy of program semantics classification and method name prediction using a unified neural architecture.

Proposed method

  • LiGer employs a dual-branch neural network to process symbolic execution traces and concrete execution traces separately.
  • It uses attention mechanisms to dynamically weigh and fuse features from both symbolic and concrete traces into a unified program embedding.
  • The model is trained end-to-end using contrastive learning to align embeddings of semantically equivalent programs and separate those of different semantics.
  • For method name prediction, LiGer decodes the name as a sequence of words using an autoregressive decoder conditioned on the blended embedding.
  • Symbolic traces are generated via static analysis of control-flow and data-flow information, while concrete traces are collected from actual program runs with diverse inputs.
  • The architecture integrates both trace types through a learnable fusion module that adaptively combines their representations based on relevance and context.

Experimental results

Research questions

  • RQ1Can a blended approach combining symbolic and concrete execution traces improve the precision of program embeddings compared to purely static or dynamic methods?
  • RQ2How does the fusion of symbolic and concrete traces affect the model's ability to classify program semantics accurately?
  • RQ3To what extent can LiGer reduce the number of required program executions while maintaining or improving embedding quality compared to dynamic models?
  • RQ4Can the blended embedding representation generalize well to downstream tasks such as method name prediction?
  • RQ5How does LiGer's performance compare to state-of-the-art models like code2vec, code2seq, and Gated Graph Neural Networks in both semantics classification and name prediction?

Key findings

  • LiGer achieves significantly higher accuracy than Gated Graph Neural Network and code2vec in classifying program semantics on the COSET benchmark.
  • LiGer requires on average 10x fewer program executions than the state-of-the-art dynamic model DYPRO, while covering 74% fewer paths.
  • The model reduces variance in training quality by leveraging symbolic traces, which stabilize learning and reduce dependency on execution quality.
  • For method name prediction, LiGer outperforms code2seq on the same dataset of over 170,000 functions.
  • The blended approach enables LiGer to capture deep semantic similarities (e.g., between different implementations of bubble sort) that static models miss.
  • The attention mechanism effectively coordinates feature fusion between symbolic and concrete traces, leading to more robust and precise embeddings.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.