LLMs Lean on Priors, Not Programming Language Semantics

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Thimmaiah, Aditya, Zhang, Jiyang, Srinivasa, Jayanth, Li, Junyi Jessy, Gligoric, Milos
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866910272199852032
author Thimmaiah, Aditya
Zhang, Jiyang
Srinivasa, Jayanth
Li, Junyi Jessy
Gligoric, Milos
author_facet Thimmaiah, Aditya
Zhang, Jiyang
Srinivasa, Jayanth
Li, Junyi Jessy
Gligoric, Milos
contents Recent work asks whether large language models (LLMs) condition their reasoning on explicit rules rather than statistical regularities from pretraining. Program execution provides a canonical instance: formal semantics define behavior through symbolic transition rules that can be systematically altered under distribution shift. We investigate whether LLMs can condition their reasoning on formal semantics through program execution and introduce PLSemanticsBench, pairing featherweight C programs with two semantic systems -- small-step operational semantics and K semantics -- and probing four capabilities: composing rules for final states, selecting rules when state is unmutated, sustaining such conditioning over long traces, and following supplied rules under novel semantics. To decouple semantic reasoning from syntactic familiarity, we redefine familiar operators to induce symbol-meaning conflict and introduce novel symbols defined only through the supplied rules, and stress-test models on Human-Written, LLM-Translated, and Fuzzer-Generated splits with increasing structural complexity. Across 11 frontier LLMs, strong final-state accuracy under standard semantics (up to 90%) drops sharply -- by as much as 40--60% points -- under semantic mutations and increasing structural complexity. Only a handful of models achieve non-zero long-horizon conditioning accuracy, and even the best systems reach just 35%. Together, these results suggest that contemporary LLMs often rely on pretrained lexical associations rather than systematically conditioning on supplied formal rules. PLSemanticsBench is publicly available at https://EngineeringSoftware.github.io/PLSemanticsBench.
format Preprint
id arxiv_https___arxiv_org_abs_2510_03415
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LLMs Lean on Priors, Not Programming Language Semantics
Thimmaiah, Aditya
Zhang, Jiyang
Srinivasa, Jayanth
Li, Junyi Jessy
Gligoric, Milos
Programming Languages
Artificial Intelligence
Computation and Language
Software Engineering
Recent work asks whether large language models (LLMs) condition their reasoning on explicit rules rather than statistical regularities from pretraining. Program execution provides a canonical instance: formal semantics define behavior through symbolic transition rules that can be systematically altered under distribution shift. We investigate whether LLMs can condition their reasoning on formal semantics through program execution and introduce PLSemanticsBench, pairing featherweight C programs with two semantic systems -- small-step operational semantics and K semantics -- and probing four capabilities: composing rules for final states, selecting rules when state is unmutated, sustaining such conditioning over long traces, and following supplied rules under novel semantics. To decouple semantic reasoning from syntactic familiarity, we redefine familiar operators to induce symbol-meaning conflict and introduce novel symbols defined only through the supplied rules, and stress-test models on Human-Written, LLM-Translated, and Fuzzer-Generated splits with increasing structural complexity. Across 11 frontier LLMs, strong final-state accuracy under standard semantics (up to 90%) drops sharply -- by as much as 40--60% points -- under semantic mutations and increasing structural complexity. Only a handful of models achieve non-zero long-horizon conditioning accuracy, and even the best systems reach just 35%. Together, these results suggest that contemporary LLMs often rely on pretrained lexical associations rather than systematically conditioning on supplied formal rules. PLSemanticsBench is publicly available at https://EngineeringSoftware.github.io/PLSemanticsBench.
title LLMs Lean on Priors, Not Programming Language Semantics
topic Programming Languages
Artificial Intelligence
Computation and Language
Software Engineering
url https://arxiv.org/abs/2510.03415