SemanticForge: Repository-Level Code Generation through Semantic Knowledge Graphs and Constraint Satisfaction

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Wuyang, Zhang, Chenkai, Luo, Zhen, Ma, Jianming, Yuan, Wangming, Gu, Chuqiao, Feng, Chenwei
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908641656832000
author Zhang, Wuyang
Zhang, Chenkai
Luo, Zhen
Ma, Jianming
Yuan, Wangming
Gu, Chuqiao
Feng, Chenwei
author_facet Zhang, Wuyang
Zhang, Chenkai
Luo, Zhen
Ma, Jianming
Yuan, Wangming
Gu, Chuqiao
Feng, Chenwei
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2511_07584
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SemanticForge: Repository-Level Code Generation through Semantic Knowledge Graphs and Constraint Satisfaction
Zhang, Wuyang
Zhang, Chenkai
Luo, Zhen
Ma, Jianming
Yuan, Wangming
Gu, Chuqiao
Feng, Chenwei
Software Engineering
Artificial Intelligence
Distributed, Parallel, and Cluster Computing
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.
title SemanticForge: Repository-Level Code Generation through Semantic Knowledge Graphs and Constraint Satisfaction
topic Software Engineering
Artificial Intelligence
Distributed, Parallel, and Cluster Computing
url https://arxiv.org/abs/2511.07584