CoRE: A Fine-Grained Code Reasoning Benchmark Beyond Output Prediction

Jun Gao, Yun Peng, Qian Qiao, Changhai Zhou, Yuhua Zhou, Shiyang Zhang, Shichao Weng, Zhenchang Xing, Xiaoxue Ren

TL;DR

While Large Language Models (LLMs) excel at predicting the final outputs of code, new research reveals they often do so without truly understanding the underlying execution logic. The authors introduce CoRE, a fine-grained benchmark that evaluates code reasoning through implementation invariance (consistency across coding styles) and process transparency (tracking intermediate states). Their findings expose a critical robustness gap and show that models frequently "hallucinate" intermediate steps even when guessing the correct final answer.

What Problem Does This Paper Address?

Existing code reasoning benchmarks treat LLMs like a black box: they provide a single canonical implementation of a problem, feed it an input, and check if the model predicts the correct final output. The authors argue this approach is fundamentally flawed for two reasons:

  1. Lack of Implementation Invariance: Models are highly sensitive to style. If you change the syntax or structure of a piece of code without altering its functionality, an LLM's reasoning often falls apart.
  2. Lack of Process Transparency: Models can achieve high output accuracy by relying on superficial shortcuts and heuristics rather than actually simulating code execution.

To bridge this gap, the paper introduces a holistic evaluation protocol that forces models to maintain consistency across diverse code implementations and accurately track intermediate execution states.

Standard vs. Holistic Evaluation Protocol

Methods

The authors constructed the CoRE benchmark using a rigorous two-stage pipeline:

  • Stage 1: Constructing Diverse Code Implementations. Starting with base programming problems, the authors used seven different LLMs to generate multiple syntactically distinct but functionally identical solutions. They filtered these candidates using execution validation, cyclomatic complexity metrics, and token-based Jaccard similarity to ensure high structural diversity.
  • Stage 2: Formulating Intermediate State Probes. Using Python execution tracing, the exact runtime values of all variables were captured as ground truth. An ensemble of LLMs then generated targeted questions probing four critical dimensions of program behavior: Arithmetic (numerical precision), Logic (nested conditions), State (variable history accumulation), and Boundary (loop transitions).
The Four Dimensions of Intermediate Execution Probing

To tie it all together, they proposed the Reasoning Consistency Score (RCS). This composite metric multiplies strict output consistency (requiring the model to get the final answer right across all equivalent implementations) by its process fidelity weight (the accuracy of its intermediate answers). If a model fails to remain invariant to code style, its overall score is completely nullified.

Datasets

The CoRE benchmark is built on top of 60 core coding problems sourced from HumanEval and LiveCodeBench. Through their pipeline, this expands into:

  • 255 unique code candidates (an average of 4.3 implementations per problem) generated across five major model families (OpenAI, DeepSeek, Gemini, Claude, Qwen).
  • 243 intermediate state probes (averaging 4.1 probes per problem).
  • A total of 1,978 evaluation samples for inference.

Key Insights and Ideas

  • Style Overfitting: LLMs suffer from a strong familiarity bias. Heatmap evaluations show a clear diagonal dominance: models consistently perform best when evaluating code generated by their own model family, proving they overfit to specific stylistic patterns rather than understanding pure logic.
  • Superficial Execution: Getting the right answer does not mean the model simulated the code. Models frequently predict the correct final output while completely hallucinating the intermediate variable states.
  • The Arithmetic Blind Spot: Without explicit reasoning prompts, native models are shockingly bad at exact arithmetic precision within code (such as complex indexing or composite operations), often bypassing exact simulation entirely.
  • The Fragility of Reflection: Iterative reflection frameworks (like RHDA) can sometimes backfire. If a model receives erroneous feedback on a final output, it will readily rewrite its previously correct intermediate reasoning steps just to match the wrong conclusion.

Key Results

  • The Execution Gap: Under standard Input-Output (IO) prompting, GPT-5 achieves a high strict output accuracy ($I = 84.62\%$) but a dismal process fidelity weight ($W_s = 18.96\%$), resulting in a low composite RCS of $15.93$.
  • Prompting to the Rescue: Advanced prompting techniques like Chain-of-Thought (CoT) and Chain-of-Code (CoC) drastically bridge this gap. For GPT-5, CoT boosts process fidelity ($W_s$) to $64.93\%$ and pushes the RCS up to $55.75$.
  • Structural Fragility: Across all tested models, direct IO prompting resulted in poor performance on tracking State (average $W_s = 46.02\%$) and Boundary transitions (average $W_s = 47.17\%$), proving that tracking long execution paths remains a major challenge.

Limitations and Future Work

While rigorous, the CoRE benchmark has a few limitations:

  • Language Constraint: The current implementation and execution tracing are strictly limited to the Python programming language.
  • Data Leakage Risks: Because CoRE builds on top of popular datasets like HumanEval and LiveCodeBench, frontier models may suffer from training data leakage.
  • Scalability: The heavy reliance on human expert verification to ensure logical validity and complexity limits how quickly the benchmark can be scaled up automatically.
  • Non-Uniform Probes: The distribution of questions across the four dimensions isn't perfectly uniform due to the inherent structural differences in intermediate execution paths.

Summary updated

BibTeX
@inproceedings{gao2026core,
  author = {Jun Gao and Yun Peng and Qian Qiao and Changhai Zhou and Yuhua Zhou and Shiyang Zhang and Shichao Weng and Zhenchang Xing and Xiaoxue Ren},
  title = {{CoRE: A Fine-Grained Code Reasoning Benchmark Beyond Output Prediction}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.460},
}

Loading related content...

Figure