Large language models (LLMs) have transformed software development by enabling automated code generation, yet they frequently suffer from systematic errors that limit practical deployment. We identify two critical failure modes: \textit{logical hallucination} (incorrect control/data-flow reasoning) and \textit{schematic hallucination} (type mismatches, signature violations, and architectural inconsistencies). These errors stem from the absence of explicit, queryable representations of repository-wide semantics. This paper presents \textbf{SemanticForge}, which introduces four fundamental algorithmic advances for semantically-aware code generation: (1) a novel automatic reconciliation algorithm for dual static-dynamic knowledge graphs, unifying compile-time and runtime program semantics; (2) a neural approach that learns to generate structured graph queries from natural language, achieving 73\% precision versus 51\% for traditional retrieval; (3) a novel beam search algorithm with integrated SMT solving, enabling real-time constraint verification during generation rather than post-hoc validation; and (4) an incremental maintenance algorithm that updates knowledge graphs in $O(|ΔR| \cdot \log n)$ time while maintaining semantic equivalence.


翻译:大语言模型(LLMs)通过实现自动化代码生成改变了软件开发方式,但其常因系统性错误而限制实际部署。我们识别出两种关键失效模式:\textit{逻辑幻觉}(错误的控制流/数据流推理)与\textit{架构幻觉}(类型不匹配、签名违规及架构不一致)。这些错误源于缺乏可查询的、显式的仓库级语义表征。本文提出\textbf{SemanticForge},为语义感知的代码生成引入四项基础算法进展:(1)一种新颖的双重静态-动态知识图谱自动对齐算法,统一编译时与运行时程序语义;(2)一种从自然语言学习生成结构化图谱查询的神经方法,达到73%的精确率,而传统检索方法为51%;(3)一种集成SMT求解的新型束搜索算法,支持在生成过程中实时进行约束验证而非事后检验;(4)一种增量维护算法,以$O(|ΔR| \cdot \log n)$时间复杂度更新知识图谱,同时保持语义等价性。

0
下载
关闭预览

相关内容

【NeurIPS2019】图变换网络:Graph Transformer Network
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
相关资讯
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员