Predicting Program Exit Code with LLMs and Programming Language Semantics

Lara Marinov, Aditya Thimmaiah, Jayanth Srinivasa, Junyi Jessy Li, Milos Gligoric
9/1/2026
cs.PLcs.AIcs.CL

Official code: EngineeringSoftware/prex (2 stars, Python, last commit 2026-09-29).

Abstract

Large language models (LLMs) have shown proficiency in various software engineering tasks, such as code generation and translation. However, a key limitation in their performance may be their (lack of) understanding of programming-language semantics.

Show full abstract

Even when explicit semantics are given, it remains unclear whether LLMs apply those rules or lean on priors learned during pre-training instead. We study if LLMs lean on priors or given semantics with a novel task--Program Executability Prediction (PrEx)--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. Because PrEx requires both valid and invalid programs, we build a dataset with systematically generated invalid transformations derived from valid programs. We evaluate open-source coding LLMs under two semantic formalisms and two semantic shifts across Human-Written, LLM-Translated, and Fuzzer-Generated program splits. Our findings show that LLMs lean on pre-training priors rather than systematically applying the given rules, performing especially poorly on modified semantics and degrading further as program complexity increases. PrEx is available at https://github.com/EngineeringSoftware/prex.

View on arXivView PDF

Code Implementations(1)

Predicting Program Exit Code with LLMs and Programming Language Semantics

20Python, ShellSep 2, 20262 months ago
exit-codellmllmspl-semanticssemantics

Similar Papers

Cite this paper

@article{marinov2026predicting,
  title  = {Predicting Program Exit Code with LLMs and Programming Language Semantics},
  author = {Lara Marinov and Aditya Thimmaiah and Jayanth Srinivasa and Junyi Jessy Li and Milos Gligoric},
  year   = {2026},
  eprint = {2609.00579},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.00579v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.00579.svg)](https://codeofpaper.com/paper/2609.00579)

Discussion