Behavioral Embeddings of Programs: A Quasi-Dynamic Approach for Optimization Prediction
Haolin Pan, Dong Jinyuan, Hongbin Zhang, Hongyu Lin, Mingjie Xing, Yanjun Wu
Abstract
Learning effective numerical representations, or embeddings, of programs is a fundamental prerequisite for applying machine learning to automate and enhance compiler optimization. Prevailing paradigms, however, present a dilemma. Static representations, derived from source code or intermediate representation (IR), are efficient and deterministic but offer limited insight into how a program will behave or evolve under complex code transformations. Conversely, dynamic representations, which rely on runtime profiling, provide profound insights into performance bottlenecks but are often impractical for large-scale tasks due to prohibitive overhead and inherent non-determinism. This paper transcends this trade-off by proposing a novel quasi-dynamic framework for program representation. The core insight is to model a program's optimization sensitivity. We introduce the Program Behavior Spectrum, a new representation generated by probing a program's IR with a diverse set of optimization sequences and quantifying the resulting changes in its static features. To effectively encode this high-dimensional, continuous spectrum, we pioneer a compositional learning approach. Product Quantization is employed to discretize the continuous reaction vectors into structured, compositional sub-words. Subsequently, a multi-task Transformer model, termed PQ-BERT, is pre-trained to learn the deep contextual grammar of these behavioral codes. Comprehensive experiments on two representative compiler optimization tasks---Best Pass Prediction and -Oz Benefit Prediction---demonstrate that our method outperforms strong static baselines. Our code is publicly available at https://github.com/Panhaolin2001/PREP/.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 85236b72-d80b-4627-baf6-5808edbca8d4Builds on6
- Global Relational Models of Source CodeVincent J. Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis et al.ICLR 2020 · 252 citations
- ProGraML: A Graph-based Program Representation for Data Flow Analysis and Compiler OptimizationsChris Cummins, Zacharias V. Fisches, Tal Ben-Nun, Torsten Hoefler et al.ICML 2021 · 140 citations
- Efficient Compiler Autotuning via Bayesian OptimizationJunjie Chen, Ningxin Xu, Peiqi Chen, Hongyu ZhangICSE 2021 · 73 citations
- Compiler-R1: Towards Agentic Compiler Auto-tuning with Reinforcement LearningHaolin Pan, Hongyu Lin, Haoran Luo, Yang Liu et al.NeurIPS 2025 · 14 citations
- PEM: Representing Binary Program Semantics for Similarity Analysis via a Probabilistic Execution ModelXiangzhe Xu, Zhou Xuan, Shiwei Feng, Siyuan Cheng et al.FSE 2023 · 8 citations
Related papers
- FAIR: Flow Type-Aware Pre-Training of Compiler Intermediate RepresentationsChangan Niu, Chuanyi Li, Vincent Ng, David Lo et al.ICSE 2024 · 5 citations
- Unleashing the Power of Compiler Intermediate Representation to Enhance Neural Program EmbeddingsZongjie Li, Pingchuan Ma, Huaijin Wang, Shuai Wang et al.ICSE 2022 · 25 citations
- Phaedrus: Predicting Dynamic Application Behavior with Lightweight Generative Models and LLMsBodhisatwa Chatterjee, Neeraj Jadhav, Santosh PandeOOPSLA 2026
- Evaluating Representation Learning of Code Changes for Predicting Patch Correctness in Program RepairHaoye Tian, Kui Liu, Abdoul Kader Kaboré, Anil Koyuncu et al.ASE 2020 · 81 citations
- PERFOGRAPH: A Numerical Aware Program Graph Representation for Performance Optimization and Program AnalysisAli TehraniJamsaz, Quazi Ishtiaque Mahmud, Le Chen, Nesreen K. Ahmed et al.NeurIPS 2023 · 12 citations
