LLMs Lean on Priors, Not Programming Language Semantics
This paper introduces PLSemanticsBench to demonstrate that contemporary large language models primarily rely on pretrained lexical associations rather than systematically conditioning their reasoning on supplied formal program semantics, as evidenced by their sharp performance degradation when faced with semantic mutations, novel symbols, and long execution traces.
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
The Big Question: Do LLMs Think or Just Guess?
Imagine you are teaching a student how to play a new board game. You hand them the rulebook and say, "In this game, if you roll a 6, you move backward."
A smart student who understands the rules will immediately move backward when they roll a 6, even if they have never played this specific game before.
However, a student who memorized patterns from playing thousands of other board games might hesitate. They might think, "Wait, in Monopoly and Clue, rolling a 6 usually means moving forward. I'll just move forward because that's what usually happens." They are relying on their past experience (their "priors") rather than the specific rules you just gave them.
This paper asks: Do Large Language Models (LLMs) act like the smart student who follows the new rules, or the pattern-memorizing student who ignores the new rules?
The Experiment: A "Magic" Programming Language
To test this, the researchers created a special, lightweight programming language called C⋆. Think of this language as a blank canvas.
They then set up a tricky test with three different scenarios:
- The Standard Test: They gave the model the code and the normal rules (e.g.,
+means add). This is like playing a normal game of chess. - The "Swap" Test (KeywordSwap): They kept the code looking exactly the same, but they swapped the meanings of the symbols in the rulebook.
- The Trick: They told the model, "In this version, the
+sign actually means subtraction." - The Goal: If the model is truly following the rules, it should subtract. If it's relying on memory, it will still add because it's used to
+meaning add.
- The Trick: They told the model, "In this version, the
- The "Alien" Test (KeywordObf): They replaced all the familiar symbols with weird, alien-looking characters (like symbols from an ancient, forgotten script) and gave the model a rulebook defining what those alien symbols mean.
- The Goal: Since the model has never seen these symbols before, it must rely entirely on the new rulebook. It can't cheat by using its memory of what
+usually does.
- The Goal: Since the model has never seen these symbols before, it must rely entirely on the new rulebook. It can't cheat by using its memory of what
The Results: The "Pattern Memorizers" Win (and Lose)
The researchers tested 11 of the smartest AI models available. Here is what happened:
1. When the rules were normal:
The models did great! They could predict the outcome of the code with high accuracy (up to 90%). They looked like geniuses.
2. When the rules were swapped (The "Add" becomes "Subtract"):
The models crashed. Their accuracy dropped by 40% to 60%.
- The Analogy: It's like a chef who has cooked a million burgers. You tell them, "Today, we are making a burger, but the bun is actually a potato." A true chef would use the potato. These models, however, kept trying to use the bun because their brain was so used to "Burger = Bun." They couldn't override their muscle memory to follow your new instruction.
3. When the rules were alien (The "KeywordObf"):
The models did slightly better here than in the swap test, but they still struggled significantly. They couldn't fully trust the new rulebook.
4. The Long Haul (Complex Loops):
When the code got long and complicated (like a story with many chapters and loops), almost all models failed. Even the "smartest" models could only get about 35% of the long, complex sequences right. They got lost in the middle of the story and forgot the rules they were supposed to follow.
The "Reasoning" Models vs. The "Non-Reasoning" Models
The researchers also tested models that are specifically designed to "think step-by-step" (called Reasoning models).
- The Good News: These models were better at following the new rules than the standard models.
- The Bad News: Even the best "Reasoning" models failed when the rules were swapped. They still relied too much on what they had seen before. They could follow the rules for a short time, but as soon as the rules got weird or the task got long, they fell back on their old habits.
The "Chain of Thought" (Talking to Yourself)
The researchers tried a trick called "Chain of Thought," where they asked the models to explain their thinking out loud before giving the answer.
- Result: This helped the models do better on normal tasks. But when the rules were swapped (e.g.,
+means subtract), the "talking out loud" didn't help. The models still got the math wrong because their internal "muscle memory" was too strong.
The Conclusion
The paper concludes that current AI models are not truly "reasoning" based on the rules you give them. Instead, they are statistical guessers that rely heavily on what they have seen in their training data.
- The Metaphor: Imagine an actor who has memorized a script for a play. If you tell them, "Today, we are improvising, and the word 'Hello' actually means 'Goodbye'," they will likely still say "Hello" because that's what they are used to saying. They aren't actually processing the new meaning; they are just reciting the most likely word from their memory.
In short: If you want an AI to follow a brand new set of strict rules (like a new programming language or a new legal contract), current models are not reliable. They will likely ignore your new rules and do what they think you probably meant, based on their past training.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.