The Larger They Are, the Harder They Fail: Language Models do not Recognize Identifier Swaps in Python
Antonio Valerio Miceli-Barone, Fazl Barez, Ioannis Konstas, Shay B., Cohen

TL;DR
Large Language Models struggle to recognize identifier swaps in Python code, revealing limitations in their understanding of programming invariances despite their impressive performance.
Contribution
This paper demonstrates that LLMs fail to recognize identifier swaps in Python, highlighting a fundamental gap in their understanding of programming semantics.
Findings
LLMs do not recognize identifier swaps in Python.
Model confidence increases with size even when predictions are incorrect.
Scaling models alone does not improve understanding of programming invariances.
Abstract
Large Language Models (LLMs) have successfully been applied to code generation tasks, raising the question of how well these models understand programming. Typical programming languages have invariances and equivariances in their semantics that human programmers intuitively understand and exploit, such as the (near) invariance to the renaming of identifiers. We show that LLMs not only fail to properly generate correct Python code when default function names are swapped, but some of them even become more confident in their incorrect predictions as the model size increases, an instance of the recently discovered phenomenon of Inverse Scaling, which runs contrary to the commonly observed trend of increasing prediction quality with increasing model size. Our findings indicate that, despite their astonishing typical-case performance, LLMs still lack a deep, abstract understanding of the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Topic Modeling · Computational Physics and Python Applications
Methodsfail
