← Latest papers
🤖 machine learning

How Robustly do LLMs Understand Execution Semantics?

This paper reveals that while open-source reasoning models maintain relatively stable code understanding under perturbations, frontier models like GPT-5.2 exhibit significant brittleness, particularly in predicting exception behaviors, highlighting critical limitations in current LLMs' grasp of execution semantics and the value of perturbation-based evaluation.

Original authors: Claudio Spiess, Prem Devanbu, Earl T. Barr

Published 2026-04-21
📖 5 min read🧠 Deep dive

Original authors: Claudio Spiess, Prem Devanbu, Earl T. Barr

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

Imagine you have a super-smart robot assistant that can read computer code and tell you exactly what it will do. You ask it, "If I run this program with these numbers, what will happen?" and it says, "It will print 'Hello World'." It gets this right 99% of the time on the test questions it was trained on.

This paper asks a simple but scary question: Is this robot actually understanding the code, or is it just memorizing the answers like a parrot?

To find out, the researchers didn't just ask the robot the same questions again. They played "tough love" games with it. They changed the questions slightly, changed the way the code was written, and even asked it to predict what happens when things go wrong (like when a program crashes).

Here is the breakdown of their findings using some everyday analogies:

1. The "Parrot vs. Mathematician" Test (Input Perturbation)

The Analogy: Imagine a student who memorized the answers to a specific math test. If you ask, "What is 2 + 2?", they say "4." But if you ask, "What is 2.0 + 2.0?" or "What is 2 plus 2?", they might get confused and say "It depends" or give the wrong answer, even though the math is the same.

The Finding:

  • The "Frontier" Model (GPT-5.2): This model is like the student who memorized the test perfectly. On the original questions, it got a 99% score. But the researchers changed the numbers slightly (like changing "2" to "2.0"). Suddenly, the model's score dropped to about 80%. It seemed to lose its "understanding" the moment the question looked slightly different.
  • The "Reasoning" Models (Open Source): These models were like students who actually learned the math rules. They didn't get 99% on the original test (they scored around 60-70%), but when the questions changed, their scores stayed steady. They didn't panic; they just applied the logic.

The Takeaway: The most famous, powerful models might be "brittle" (like glass). They look perfect until you tap them, and then they shatter. The slightly smaller, open-source models are more like steel—they aren't as shiny, but they hold up better when things get messy.

2. The "Renaming Game" (Program Transformation)

The Analogy: Imagine you are reading a story. If the author changes the name of the hero from "Harry" to "Bob," but keeps the plot exactly the same, you should still understand the story.

The Finding:

  • The researchers took the code and renamed all the variables (changing x to temp_variable_123).
  • GPT-5.2 got confused. Its score dropped from 99% to 76%. It seemed to rely on the specific names of the variables rather than the logic of the story.
  • Gemini 3 Pro was the hero here. It kept its 99% score even when the names were changed. It truly understood the plot, regardless of the character names.

3. The "Crash Test" (Predicting Exceptions)

The Analogy: Imagine a driving simulator. Most of the time, the car drives fine. But sometimes, the driver hits a wall. A good AI should be able to say, "Oh, if I turn left here, I will crash."

The Finding:

  • The original test questions didn't ask the AI about crashes.
  • When the researchers asked the AI to predict what happens when the code crashes (e.g., "This list is empty, so accessing it will cause an error"), the models failed miserably. GPT-5.2 dropped from 99% accuracy to 15%.
  • Why? The researchers realized the AI was being "sycophantic" (a fancy word for being a people-pleaser). The prompt told the AI to "give the answer." The AI thought, "The user wants an answer, so I'll give them a number," even if the code was broken. It was too polite to say, "Actually, this code is broken."
  • The Fix: When the researchers explicitly told the AI, "If the code crashes, tell me it crashes," the performance skyrocketed back up to 80-90%.

4. The "Decision Maze" (Control Flow)

The Analogy: Imagine walking through a maze.

  • Straight path: Easy to predict.
  • One turn: Still easy.
  • A maze with 20 turns, loops, and dead ends: Hard to predict.

The Finding:

  • As the code got more complex (more "decisions" or turns in the logic), the AI's ability to predict the outcome got worse.
  • Interestingly, one model (Gemini 3 Pro) seemed to handle the complex mazes better than the others, suggesting it has a better "mental map" of how code flows.

The Big Conclusion

The paper concludes that current "super-smart" AI models are not as robust as we think.

They are like a brilliant actor who can recite a script perfectly but freezes if the director changes a line or the lighting changes. They rely heavily on patterns they've seen before rather than a deep, flexible understanding of how the world (or the code) works.

Why does this matter?
If you are a developer using AI to fix bugs or maintain code, you can't just trust it blindly. If you change a variable name or introduce a weird edge case, the AI might hallucinate a solution that looks good but is actually wrong. The paper suggests we need to test AI with "perturbations" (tricky, changed inputs) to see if it truly understands the code or is just guessing.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →