Dependency-Guided Code Generation: Structured Matrix Decomposition and Consistency-Guided Refinement
Mingqiao Mo, Yangchen Zeng, Zikai Xiao, Xin Xiao, Wenhua Nie, Zhaolu Kang, Guangyuan Dong, Kai Shu, Hao Zhang, Xiaodong Fan
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.
Create a lesson
Related papers
Structural Validation of LLM-Generated Microservice Decompositions Using Source-Code Dependencies
Shared title terminology · Daniel Silva, Renan Alves, Emanuel Dantas Filho et al.
PerfAgent: Profiler-Guided Iterative Refinement for Repository-Level Code Optimization
Shared title terminology · Ryan Deng, Yuanzhe Liu, Bastian Lipka et al.
Tool-Guided Retrieval-Augmented Repair for Securing LLM-Generated C Code
Shared title terminology · Vidyut Sriram, Saatvik Pradhan, Suman Saha
Static Analysis Guidance for Secure LLM Code Generation
Shared title terminology · Daniele Lunghi, Alberick Euraste Djiré, Zacharie Chenail-Larcher et al.
Trace2ST: Recovering PLC Structured Text from I/O Traces with LLM Generation and Verification
Shared title terminology · Hsi Chang, Irfan Khan
Option-GRPO: Hierarchical RL Against AI Slop in Code Generation for Unseen SDKs
Shared title terminology · Prashank Kadam