Dependency-Guided Code Generation: Structured Matrix Decomposition and Consistency-Guided Refinement

📅 2026-07-18
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge that existing code generation methods struggle to effectively model the multi-level dependencies among code entities, often yielding outputs with incomplete logic or inconsistent structure. To overcome this limitation, the paper proposes a graph-constrained code generation framework that explicitly constructs a code dependency graph and leverages it as a structural constraint during generation to ensure both semantic coherence and syntactic consistency. The key innovation lies in decomposing dependency relations into a complementary representation comprising a quantized matrix and sparse low-rank factors, augmented with sparse triplet encodings to capture strong dependencies. This design balances expressive power, memory efficiency, and scalability. Experimental results demonstrate that the proposed approach significantly outperforms current state-of-the-art methods in terms of semantic alignment and structural fidelity.
📝 Abstract
The increasing complexity of modern software systems has made automated code generation a fundamental task in software engineering. However, existing approaches often fail to adequately capture the intricate, multi-level dependencies among code entities, leading to generated code that is logically incomplete or difficult to integrate into real-world systems. To address this limitation, we propose a dependency-aware code generation framework that explicitly models interactions among code entities through a graph-based representation. We decompose dependencies into two complementary components: a quantized matrix that captures strong, explicit relations, and a sparse low-rank factorization that models weaker, implicit interactions. The decomposition is efficiently learned via an alternating optimization procedure. During code generation, the learned dependency structure is incorporated as a constraint, ensuring both semantic coherence and structural consistency of the generated code. Furthermore, we introduce a sparse triplet representation for strong dependencies, significantly improving storage efficiency and computational scalability. Extensive experiments demonstrate that our approach consistently produces code with superior semantic alignment and structural fidelity compared to existing methods.
Problem

Research questions and friction points this paper is trying to address.

code generation
code dependencies
semantic coherence
structural consistency
software engineering
Innovation

Methods, ideas, or system contributions that make the work stand out.

dependency-aware code generation
structured matrix decomposition
sparse low-rank factorization
graph-based representation
consistency-guided refinement