Self-Execution Simulation Improves Coding Models
Abstract
Code large language models can be trained to simulate program execution step-by-step, improving competitive programming performance through supervised fine-tuning and reinforcement learning with verifiable rewards.
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.
Community
🚨New paper🚨 Self-Execution Simulation Improves Coding Models
Current reasoning CodeLMs before providing an answer to programming tasks.
We show that CodeLMs can be post-trained to explicitly simulate execution of tests in order to verify and fix their proposed solutions, leading to additional gains!
Get this paper in your agent:
hf papers read 2604.03253 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper