Search papers, labs, and topics across Lattice.
This paper trains Code LLMs to simulate program execution by fine-tuning on natural language execution traces and using reinforcement learning with verifiable rewards. The approach combines output prediction given code and inputs with solving competitive programming tasks using execution feedback. Results show consistent improvements on competitive programming benchmarks, demonstrating the effectiveness of execution simulation for self-verification and self-fixing.
LLMs can learn to "debug" their own code by simulating execution, leading to significant gains in competitive programming performance.
A promising research direction in enabling LLMs to generate consistently correct code involves addressing their inability to properly estimate program execution, particularly for code they generate. In this work, we demonstrate that Code LLMs can be trained to simulate program execution in a step-by-step manner and that this capability can be leveraged to improve competitive programming performance. Our approach combines supervised fine-tuning on natural language execution traces, textual explanations grounded in true execution, with reinforcement learning using verifiable rewards. We introduce two complementary objectives: output prediction given code and inputs, and solving competitive programming tasks with either ground-truth or self-predicted execution feedback. These objectives enable models to perform self-verification over multiple candidate solutions, and iterative self-fixing by simulating test execution. Across multiple competitive programming benchmarks, our method yields consistent improvements over standard reasoning approaches. We further present ablations and analysis to elucidate the role of execution simulation and its limitations.