Large Language Models Are Not (Yet) Robust in Understanding Code Against Semantics-Preserving Mutations @ EPIA 2026

Sep 4, 2026·
Pedro Orvalho
Pedro Orvalho
· 0 min read
Image credit: EPIA
Abstract
Large Language Models (LLMs) are increasingly used for programming tasks, particularly with the widespread adoption of practices such as vibe coding. While these models can achieve impressive performance on code understanding and program output prediction, high accuracy does not necessarily imply that their predictions are supported by sound reasoning. Understanding how LLMs reason about code, and how robust that reasoning is to changes in syntax, is therefore critical for their reliable use in software development. In this talk, we will present an empirical study investigating whether state-of-the-art LLMs can genuinely reason about Python programs or are simply guessing. We introduce five semantics-preserving code mutations—including variable renaming, mirroring comparison expressions, swapping if-else branches, converting for loops to while loops, and loop unrolling—that alter the syntax of a program while preserving its behavior. We use these transformations to test whether model predictions remain stable when the underlying program semantics are unchanged. We evaluate nine open-source and closed-access LLMs using LiveCodeBench and CruxEval, complemented by a human expert analysis of whether correct predictions are supported by sound reasoning. While proprietary models generally achieve the strongest predictive accuracy and reasoning quality, our analysis reveals substantial fragility across the evaluated models. Code-specialised LLMs can produce correct predictions based on flawed reasoning in up to 45% of cases, while semantics-preserving transformations can lead to performance drops of up to 70%. Our findings demonstrate that strong predictive accuracy alone is not sufficient evidence of reliable program reasoning. More broadly, they highlight the importance of evaluating not only whether LLMs produce correct answers, but also whether those answers arise from stable, semantically grounded reasoning—an increasingly important consideration as LLM-generated and LLM-assisted code becomes more prevalent.
Date
Sep 4, 2026 9:55 AM — 10:20 AM
Event
Location

EPIA 2026

Funchal, Madeira, Portugal.