NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Evaluating Large Language Models with Runtime Behavior of Program Execution

Junkai Chen, Zhiyuan Pan, Xing Hu, Zhenhao Li, Ge Li, Xin Xia · DOI

Introduction

The rapid advancement of Large Language Models (LLMs) in code generation has led to impressive performance on benchmarks like HumanEval. However, these evaluations are primarily "black-box," focusing only on whether the final output matches the expected result. This approach fails to determine if a model truly understands the underlying logic or is simply performing sophisticated pattern matching. To address this, we introduce $\mathcal{R}$Eval, a framework designed to evaluate the "white-box" reasoning capabilities of LLMs by testing their ability to predict intermediate runtime behaviors.

The $\mathcal{R}$Eval Framework

$\mathcal{R}$Eval shifts the focus from final output to the execution process. It decomposes program execution into four hierarchical reasoning tasks:

  1. Code Coverage Prediction (CCP): Determining if a specific statement is reached during execution.
  2. Program State Prediction (PSP): Predicting the value and type of a variable after a specific statement.
  3. Execution Path Prediction (EPP): Identifying the next line of code to be executed.
  4. Output Prediction (OP): Generating the final program output.
The four code reasoning tasks in $\mathcal{R}$Eval compared to traditional I/O benchmarks.

By requiring models to perform these tasks, $\mathcal{R}$Eval exposes the "lucky guess" phenomenon, where a model correctly predicts the final output despite failing to understand the intermediate steps.

Methodology and Consistency

The framework is built by "upcycling" existing benchmarks like HumanEval and ClassEval. Using a custom program tracer, we extract ground-truth execution traces to create a dataset of over 3,000 reasoning problems.

A core innovation of $\mathcal{R}$Eval is the Incremental Consistency (IC) Score. This metric evaluates whether a model's reasoning follows a logical flow. A model only receives credit for a "harder" task (like Output Prediction) if it also correctly predicted all prerequisite "easier" tasks (CCP, PSP, and EPP). This ensures that the model's success is grounded in a consistent mental simulation of the code.

Overview of the $\mathcal{R}$Eval framework construction and evaluation flow.

Key Findings

Our evaluation of various LLMs, including GPT-4 and open-source alternatives, revealed several critical insights:

  • Path Prediction is the Primary Bottleneck: Execution Path Prediction (EPP) proved to be the most difficult task. Models often struggle to determine the next branch even when they have correctly tracked variable states.
  • The Consistency Gap: While GPT-4-Turbo leads with an average accuracy of 75%, its IC score drops to 42.5%. This indicates that even the most advanced models fail to maintain logical consistency in more than half of the execution traces.
  • Open-Source Struggles: Open-source models show a significant performance gap, with an average IC score of only 10.3. This suggests that current training paradigms do not sufficiently teach models the mechanics of program execution.
  • Instruction Tuning and CoT: While instruction tuning generally helps, Chain-of-Thought (CoT) prompting is a double-edged sword. It can improve intermediate reasoning but may lead to cascading errors that ruin the final output prediction.

Conclusion

$\mathcal{R}$Eval highlights a fundamental weakness in current code LLMs: a lack of robust runtime reasoning. Moving forward, improving model performance will likely require "execution-aware" training, where models are explicitly taught to simulate program behavior. Expanding the framework to include complex dynamic behaviors like exception handling and multi-threading will further push the boundaries of LLM code understanding.

Summary updated

BibTeX
@inproceedings{chen2025evaluating,
  author = {Junkai Chen and Zhiyuan Pan and Xing Hu and Zhenhao Li and Ge Li and Xin Xia},
  title = {{Evaluating Large Language Models with Runtime Behavior of Program Execution}},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00012},
}
Figure