Static Prediction of Runtime Errors by Learning to Execute Programs with External Resource Descriptions
David Bieber, Rishab Goel, Daniel Zheng, Hugo Larochelle, Daniel Tarlow
Abstract
The execution behavior of a program often depends on external resources, such as program inputs or file contents, and so cannot be run in isolation. Nevertheless, software developers benefit from fast iteration loops where automated tools identify errors as early as possible, even before programs can be compiled and run. This presents an interesting machine learning challenge: can we predict runtime errors in a "static" setting, where program execution is not possible? Here, we introduce a real-world dataset and task for predicting runtime errors, which we show is difficult for generic models like Transformers. We approach this task by developing an interpreter-inspired architecture with an inductive bias towards mimicking program executions, which models exception handling and "learns to execute" descriptions of the contents of external resources. Surprisingly, we show that the model can also predict the location of the error, despite being trained only on labels indicating the presence/absence and kind of error. In total, we present a practical and difficult-yet-approachable challenge problem related to learning program execution and we demonstrate promising new capabilities of interpreter-inspired machine learning models for code.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
10 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- PLUR: A Unifying, Graph-Based View of Program Learning, Understanding, and Repair cites Global Relational Models of Source Code
- NExT: Teaching Large Language Models to Reason about Code Execution cites Can Large Language Models Reason about Program Invariants?
- NExT: Teaching Large Language Models to Reason about Code Execution cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
- LExecutor: Learning-Guided Execution cites Global Relational Models of Source Code
- LExecutor: Learning-Guided Execution cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
- TRACED: Execution-aware Pre-training for Source Code cites LExecutor: Learning-Guided Execution
- TRACED: Execution-aware Pre-training for Source Code cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
- Can Large Language Models Reason about Program Invariants? cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
- Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks cites Global Relational Models of Source Code
Cited by top-tier papers10
- Can Large Language Models Reason about Program Invariants?Kexin Pei, David Bieber, Kensen Shi, Charles Sutton et al.ICML 2023 · 128 citations
- NExT: Teaching Large Language Models to Reason about Code ExecutionAnsong Ni, Miltiadis Allamanis, Arman Cohan, Yinlin Deng et al.ICML 2024 · 73 citations
- Code Representation Learning at ScaleDejiao Zhang, Wasi Uddin Ahmad, Ming Tan, Hantian Ding et al.ICLR 2024 · 32 citations
- TRACED: Execution-aware Pre-training for Source CodeYangruibo Ding, Benjamin Steenhoek, Kexin Pei, Gail E. Kaiser et al.ICSE 2024 · 29 citations
- LExecutor: Learning-Guided ExecutionBeatriz Souza, Michael PradelFSE 2023 · 16 citations
Builds on3
- Global Relational Models of Source CodeVincent J. Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis et al.ICLR 2020 · 252 citations
- Learning to Execute Programs with Instruction Pointer Attention Graph Neural NetworksDavid Bieber, Charles Sutton, Hugo Larochelle, Daniel TarlowNeurIPS 2020 · 51 citations
- PLUR: A Unifying, Graph-Based View of Program Learning, Understanding, and RepairZimin Chen, Vincent J. Hellendoorn, Pascal Lamblin, Petros Maniatis et al.NeurIPS 2021 · 29 citations
Related papers
- Planning a Large Language Model for Static Detection of Runtime Errors in Code SnippetsSmit Patel, Aashish Yadavally, Hridya Dhulipala, Tien N. NguyenICSE 2025 · 1 citation
- Blended Analysis for Predictive ExecutionYi Li, Hridya Dhulipala, Aashish Yadavally, Xiaokai Rong et al.FSE 2025 · 1 citation
- SelfPiCo: Self-Guided Partial Code Execution with LLMsZhipeng Xue, Zhipeng Gao, Shaohua Wang, Xing Hu et al.ISSTA 2024 · 8 citations
- T-REX: Teaching Large Language Models to Reason with Verbalized Execution SemanticsYan Wang, Ling Ding, Jiechen Sun, Tien N. Nguyen et al.OOPSLA 2026
- IrEne: Interpretable Energy Prediction for TransformersQingqing Cao, Yash Kumar Lal, Harsh Trivedi, Aruna Balasubramanian et al.ACL 2021
