[Paper Review] A Hybrid Approach for Learning Program Representations
This paper proposes Liger, a hybrid deep neural network that learns program representations by combining symbolic and concrete execution traces, achieving state-of-the-art performance in program semantics classification and method name prediction. Liger outperforms syntax-based models like Gated Graph Neural Network and code2vec, and reduces execution requirements by 10x compared to dynamic models like DyPro while covering 74% fewer paths.
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
- Address the limitations of existing program embedding models that rely solely on source code or runtime executions.
- Improve the accuracy and robustness of neural program embeddings by combining symbolic and concrete execution traces.
- Reduce the number of program executions required for training while maintaining or improving model performance.
- Enable effective method name prediction from program code embeddings using a unified representation framework.
Proposed method
- Liger integrates symbolic execution to extract high-level program semantics and concrete execution traces to capture dynamic behavior.
- The model uses a graph neural network to encode control-flow and data-dependency structures derived from symbolic analysis.
- Concrete execution traces are processed through a sequence encoder to model runtime behavior across diverse inputs.
- The symbolic and dynamic representations are fused via a learnable attention mechanism to produce a unified program embedding.
- The final embedding is optimized end-to-end using contrastive learning on program semantics and method name prediction tasks.
- The model is trained on a large-scale dataset of over 170K functions for both semantics classification and method name prediction.
Experimental results
Research questions
- RQ1Can combining symbolic and concrete execution traces improve the accuracy of neural program embeddings compared to purely syntax-based or dynamic approaches?
- RQ2To what extent can Liger reduce the number of required program executions while maintaining or improving model performance?
- RQ3How well does Liger generalize to downstream tasks such as method name prediction compared to existing state-of-the-art models?
- RQ4Does the fusion of symbolic and dynamic program representations lead to more robust and semantically precise embeddings?
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 to achieve comparable performance.
- Liger covers 74% fewer execution paths than DyPro while maintaining high accuracy, indicating improved sample efficiency.
- In method name prediction, Liger significantly outperforms code2seq, the previous state-of-the-art model, on the same dataset of over 170K functions.
- The hybrid approach enables Liger to capture deeper semantic information than syntax-only models and more consistent behavior than execution-only models.
- The model's unified representation framework enables strong zero-shot generalization across diverse program analysis tasks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.