paperbot · PL 论文追踪

全部论文 待读 收藏

P1 From Syntactic Mimicry to Semantic Correctness: Behavioral Understanding in LLM Code Generation

从语法模仿到语义正确:LLM 代码生成中的行为理解
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 5/10 · 论文聚焦于通过行为理解与语义属性约束提升 LLM 代码生成的正确性,属于将程序语言/语义分析技术应用于 AI 系统(PL→AI)的范畴,与用户对 PL 与 LLM 交叉的兴趣部分重合。但其核心目标是改进 LLM 代码生成本身,而非用户主攻的“对 ML/Agentic 程序做静态分析”或“用 LLM 改进静态分析/形式化验证”,因此匹配度中等。引用 0 inbox
Ajmain Inqiad Alam
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出以行为理解为核心的 LLM 代码生成框架,通过使用模式检索、跨语境实践迁移与语义属性约束提升生成正确性。

大语言模型虽已广泛用于代码生成,但常产出语法正确而行为错误的代码:不遵循仓库约定、跨语境误用实践、违反语义性质。作者指出其根源在于模型只学到语法模式,缺乏对代码在具体上下文中如何执行的行为理解。为此,该工作围绕三个相互关联的挑战展开:(1)不仅检索符号是什么,还要通过使用模式检索其行为方式;(2)将行为意图与实现细节分离,从而把实践迁移到新语境;(3)在生成过程中施加语义性质约束,同时避免过高的运行时开销。初步结果显示显著提升:仓库补全的精确匹配率从 29.05% 提升到 48.2%,跨框架实践迁移的一致率从 0% 提升到 100%。目标是让 LLM 从模式匹配系统转变为理解代码“做什么”而非仅“长什么样”的行为感知生成系统。

问题
现有 LLM 代码生成模型只掌握语法模式,缺乏行为理解,因此在仓库约定遵循、跨语境实践迁移与语义性质保持上频繁出错。
方法
从三个方向构建行为基础的生成:基于使用模式的行为检索、将行为意图与实现细节分离的跨语境实践迁移,以及在生成中低成本地施加语义性质约束。
评估
在仓库代码补全与跨框架实践迁移任务上报告初步结果,分别以精确匹配率与一致性率对比基线。
原文摘要(Abstract)

Large Language Models (LLMs) have transformed software engineering by automating code generation, yet they frequently produce code that is syntactically correct but behaviorally incorrect—failing to respect repository conventions, misapplying practices across contexts, or violating semantic properties. These failures come from a fundamental limitation: current LLMs learn syntactic patterns but lack behavioral understanding of how code executes in context. This work addresses three interconnected challenges in building behaviorally-grounded code generation: (1) retrieving not just what symbols are, but how they behave through usage patterns; (2) adapting practices across contexts by separating behavioral intent from implementation details; and (3) enforcing semantic properties during generation without prohibitive runtime costs. Preliminary results demonstrate substantial improvements: 48.2% exact match on repository completion (vs. 29.05% baseline) and 100% conformance on cross-framework practice transfer (vs. 0% baseline). This work aims to transform LLMs from pattern-matching systems into behaviorally-aware generation system that understand what code does, not just what it looks like.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{Alam26,
  title = {From Syntactic Mimicry to Semantic Correctness: Behavioral Understanding in LLM Code Generation},
  author = {Ajmain Inqiad Alam},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3804873}
}