Lune

ICML2024顶会

Emergent Representations of Program Semantics in Language Models Trained on Programs

Charles Jin, Martin C. Rinard

摘要

We present evidence that language models (LMs) of code can learn to represent the formal semantics of programs, despite being trained only to perform next-token prediction. Specifically, we train a Transformer model on a synthetic corpus of programs written in a domain-specific language for navigating 2D grid world environments. Each program in the corpus is preceded by a (partial) specification in the form of several input-output grid world states. Despite providing no further inductive biases, we find that a probing classifier is able to extract increasingly accurate representations of the unobserved, intermediate grid world states from the LM hidden states over the course of training, suggesting the LM acquires an emergent ability to interpret programs in the formal sense. We also develop a novel interventional baseline that enables us to disambiguate what is represented by the LM as opposed to learned by the probe. We anticipate that this technique may be generally applicable to a broad range of semantic probing experiments. In summary, this paper does not propose any new techniques for training LMs of code, but develops an experimental framework for and provides insights into the acquisition and representation of formal semantics in statistical models of code. Our code is available at https://github.com/charlesjin/emergent-semantics.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis 引用了 InCoder: A Generative Model for Code Infilling and Synthesis
  • CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis 引用了 The Curious Case of Neural Text Degeneration
  • InCoder: A Generative Model for Code Infilling and Synthesis 引用了 The Curious Case of Neural Text Degeneration
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper9

  1. Do LLMs Build World Representations? Probing Through the Lens of State AbstractionZichao Li, Yanshuai Cao, Jackie CK CheungNeurIPS 2024 · 22 次引用
  2. A Theory of Response Sampling in LLMs: Part Descriptive and Part PrescriptiveSarath Sivaprasad, Pramod Kaushik, Sahar Abdelnabi, Mario FritzACL 2025 · 12 次引用
  3. Rethinking LLM-as-a-Judge: Representation-as-a-Judge with Small Language Models via Semantic Capacity AsymmetryZhuochun Li, Yong Zhang, Ming Li, Yuelyu Ji 等ICLR 2026 · 8 次引用
  4. Composing Global Solutions to Reasoning Tasks via Algebraic Objects in Neural NetsYuandong TianNeurIPS 2025 · 4 次引用
  5. Can LLMs Learn to Map the World from Local Descriptions?Sirui Xia, Aili Chen, Xintao Wang, Tinghui Zhu 等ACL 2026 · 2 次引用

它引用的 Paper12

  1. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes 等ICLR 2020 · 4,112 次引用
  2. Climbing towards NLU: On Meaning, Form, and Understanding in the Age of DataEmily M. Bender, Alexander KollerACL 2020 · 914 次引用
  3. CodeGen: An Open Large Language Model for Code with Multi-Turn Program SynthesisErik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu 等ICLR 2023 · 234 次引用
  4. Mapping Language Models to Grounded Conceptual SpacesRoma Patel, Ellie PavlickICLR 2022 · 197 次引用
  5. InCoder: A Generative Model for Code Infilling and SynthesisDaniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang 等ICLR 2023 · 140 次引用

相关 Paper

  1. Mechanisms vs. Outcomes: Probing for Syntax Fails to Explain Performance on Targeted Syntactic EvaluationsAnanth Agarwal, Jasper Jian, Christopher D. Manning, Shikhar MurtyEMNLP 2025 · 5 次引用
  2. AST-Probe: Recovering abstract syntax trees from hidden representations of pre-trained language modelsJosé Antonio Hernández López, Martin Weyssow, Jesús Sánchez Cuadrado, Houari A. SahraouiASE 2022 · 18 次引用
  3. What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source CodeYao Wan, Wei Zhao, Hongyu Zhang, Yulei Sui 等ICSE 2022 · 66 次引用
  4. How could Neural Networks understand Programs?Dinglan Peng, Shuxin Zheng, Yatao Li, Guolin Ke 等ICML 2021 · 75 次引用
  5. Probing for Incremental Parse States in Autoregressive Language ModelsTiwalayo Eisape, Vineet Gangireddy, Roger Levy, Yoon KimEMNLP Findings 2022 · 6 次引用
黄昏的海面,两侧是细线勾勒的悬崖