CoRE: A Fine-Grained Code Reasoning Benchmark Beyond Output Prediction
The paper introduces CoRE, a fine-grained code reasoning benchmark that evaluates large language models on implementation invariance and process transparency, revealing that current models often lack robustness across equivalent code implementations and rely on superficial execution rather than genuine intermediate state reasoning.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Idea: Are AI Coders Actually "Thinking"?
Imagine you hire a brilliant student to solve a math problem. They write down the final answer, and it's correct. You give them a gold star.
But then, you ask them to explain how they got there. They start making up numbers, mixing up steps, and getting confused about the middle of the process. Yet, somehow, they still landed on the right final number.
The Problem: Current tests for AI (Large Language Models or LLMs) are like that gold star. They only check the final answer. If the AI gets the right output, we assume it "understood" the code. The authors of this paper argue that this is a trap. The AI might be guessing or using shortcuts (heuristics) rather than actually simulating how the code runs in its "mind."
The Solution: CoRE (The "Honesty Test" for Code)
The authors created a new benchmark called CoRE (Code Reasoning). Instead of just asking, "What is the answer?", CoRE asks two much harder questions:
- Does it matter how you ask? (Implementation Invariance)
- Do you know what happened in the middle? (Process Transparency)
Analogy 1: The "Same Cake, Different Recipes" (Implementation Invariance)
Imagine you ask a chef to bake a chocolate cake.
- Standard Test: You give them one specific recipe (Recipe A). They bake it. It tastes good. Pass.
- CoRE Test: You give them four different recipes for the exact same chocolate cake.
- Recipe 1: Uses cocoa powder.
- Recipe 2: Uses melted chocolate bars.
- Recipe 3: Uses a different mixing bowl order.
- Recipe 4: Uses a different oven temperature.
If the chef is truly a master, they should be able to bake a perfect cake regardless of which recipe they use.
The Paper's Finding: The AI models failed this. They were great at baking the cake when using a recipe that looked like the one they usually write (their own "style"). But when given a recipe written by a different AI (a different "style"), they often messed up, even though the math was identical. They were "style-obsessed" rather than logic-obsessed.
Analogy 2: The "Movie Director" vs. The "Spoiler" (Process Transparency)
Imagine you are watching a movie.
- Standard Test: The AI is asked, "Who wins the movie?" It says, "The hero wins." Correct!
- CoRE Test: The AI is asked, "At minute 45, when the hero is hiding in the closet, what is the villain holding? And at minute 60, what is the hero's score?"
This is checking the intermediate states.
The Paper's Finding: The AI models often got the "Who wins?" question right, but they hallucinated the details in the middle. They guessed the ending based on patterns, but they didn't actually "watch" the movie step-by-step. They were superficially executing the code without truly understanding the journey.
How They Built CoRE
To make this test fair and hard, the researchers did two main things:
- Generated Many Versions: They used different AI models to write code for the same 60 problems. This created a library of 255 different code versions. Some were long and messy; some were short and clever. But they all did the exact same thing.
- Created "Pop Quiz" Questions: For every piece of code, they generated questions about the middle of the process.
- Arithmetic: "What is the exact number in this variable right now?"
- Logic: "Is this condition true or false?"
- State: "How many times has this loop run so far?"
- Boundary: "What happens right when the loop stops?"
What They Found (The Results)
They tested 8 of the smartest AI models available (like GPT-5, Claude, DeepSeek, etc.) using this new benchmark. The results were surprising:
- The "Style Bias" Gap: The models were much better at understanding code written by their own "family" (e.g., OpenAI models understood OpenAI code best) than code written by others. This suggests they are memorizing styles, not learning universal logic.
- The "Superficial Execution" Gap: Many models got the final answer right but failed the "pop quiz" about the middle steps. They were guessing the destination without knowing the path.
- The "RCS" Score: The authors created a new score called Reasoning Consistency Score (RCS). This score punishes models that get the right answer for the wrong reasons. If you get the answer right but fail the middle steps, your score drops to zero.
The Conclusion
The paper concludes that getting the right answer isn't enough. Just because an AI can predict the final output of a code snippet doesn't mean it understands how the code works.
Current AI models are like actors who memorize the final line of a play but forget the dialogue in between. CoRE is the new test that forces them to show their work, proving that they are actually "thinking" through the code, not just guessing the ending.
In short: CoRE exposes that today's smartest code-writing AIs are often "faking it" by relying on patterns and styles rather than genuine, step-by-step reasoning.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.