Jadwal Sholat

Memuat jadwal sholatโ€ฆ

Ilmu Komputer & AI editorial

Open AccessOA2026

Predicting Program Exit Code with LLMs and Programming Language Semantics

Do LLMs Apply Formal Semantics or Rely on Pre-training Priors?
Lara Marinov; Aditya Thimmaiah; Jayanth Srinivasa; Junyi Jessy Li; Milos Gligoricยท 2026ยท DOI 10.48550/arXiv.2609.00579

The core problem

Large language models (LLMs) have demonstrated proficiency in software engineering tasks such as code generation and translation. However, their understanding of programming-language semantics remains a key limitation. Even when explicit semantics are provided, it is unclear whether LLMs apply those rules or rely on priors learned during pre-training. This paper introduces Program Executability Prediction (PrEx), a novel task that asks models to predict whether a program is semantically valid or invalid, and if invalid, which formal rule it violates, given the program's syntax and operational semantics. PrEx requires both valid and invalid programs, so the authors build a dataset with systematically generated invalid transformations derived from valid programs. They evaluate open-source coding LLMs under two semantic formalisms and two semantic shifts across Human-Written, LLM-Translated, and Fuzzer-Generated program splits.

Innovation

The findings reveal that LLMs lean on pre-training priors rather than systematically applying the given rules. Performance is especially poor on modified semantics, and degrades further as program complexity increases. Specifically, under the original semantics, models achieve moderate accuracy, but when semantics are shifted, accuracy drops significantly. For instance, on the Human-Written split, accuracy decreases from to under semantic shift (exact values not provided in the abstract). Similarly, on LLM-Translated and Fuzzer-Generated splits, the degradation is even more pronounced. The models also struggle to identify the specific violated rule when predicting invalid programs. These results hold across both big-step and small-step formalisms, indicating a general tendency to rely on priors. The study highlights that LLMs do not effectively use provided semantics, which is a critical limitation for tasks requiring precise semantic understanding.
Large language models (LLMs) have demonstrated proficiency in software engineering tasks such as code generation and translation. However, their understanding of programming-language semantics remains a key limitation. Even when explicit semantics are provided, it is unclear whether LLMs apply those rules or rely on priors learned during pre-training. This paper introduces Program Executability Prediction (PrEx), a novel task that asks models to predict whether a program is semantically valid or invalid, and if invalid, which formal rule it violates, given the program's syntax and operational semantics. PrEx requires both valid and invalid programs, so the authors build a dataset with systematically generated invalid transformations derived from valid programs. They evaluate open-source coding LLMs under two semantic formalisms and two semantic shifts across Human-Written, LLM-Translated, and Fuzzer-Generated program splits.

The PrEx task is formalized as follows: given a program with syntax and operational semantics

, the model must predict a label indicating executability, and if , identify the violated rule from a set of formal rules . The dataset construction involves generating valid programs and applying systematic invalid transformations. For example, a valid program might be transformed by altering variable scope or type consistency. The authors evaluate LLMs under two semantic formalisms: (1) big-step operational semantics and (2) small-step operational semantics. They also introduce two semantic shifts: (a) modifying the semantics of a core construct (e.g., changing the evaluation order of expressions) and (b) altering the syntax-semantics mapping (e.g., redefining the meaning of a keyword). The evaluation spans three program splits: Human-Written, LLM-Translated, and Fuzzer-Generated. The overall workflow is depicted below:

Why it matters

The authors analyze why LLMs fail to apply given semantics. One hypothesis is that pre-training data contains abundant code with standard semantics, leading models to memorize patterns rather than reason about formal rules. When semantics are modified, the models cannot adapt because they lack the ability to systematically apply the new rules. This is problematic for applications where semantics may vary or be domain-specific. The study also shows that performance degrades with program complexity, suggesting that models struggle to track multiple semantic constraints. The implications are significant: for reliable software engineering tasks, LLMs need to be trained to apply formal semantics explicitly, perhaps through fine-tuning or prompting strategies that encourage rule-based reasoning. The PrEx task and dataset provide a benchmark for future research. The authors make PrEx available at https://github.com/EngineeringSoftware/prex.

Who should read this

CS practitioners and researchers

Opening member contentโ€ฆ