Cloud software code generation via knowledge graphs and multi-modal learning - Fanlong Zhang; Huanming Chen; Quan Chen; Jianqi Liu (Journal of Cloud Computing: Advances, Systems and Applications)
Abstract As cloud computing continues to experience rapid growth, the demand for cloud-native applications is escalating, leading to more complex and diverse development requirements. In this context, automated code generation plays a pivotal role in accelerating cloud-native application development. However, existing studies often overlook the full potential of leveraging multiple program representations, typically focusing on a single form derived from well-structured programs. In this paper, we demonstrate that integrating multiple program representations, specifically, code snippets and their associated ASTs can significantly enhance code generation for cloud-native applications. We construct a code knowledge graph (CodeKG) to retrieve related programs based on textual and structural similarities, enabling richer contextual information for generation. To realize this integration, we design a framework that employs shared-retentive networks (shared-RetNet) and an AST-based Transformer to extract and align features from natural language, code tokens, and ASTs. By applying contrastive loss and cross-attention mechanisms, our method effectively fuses diverse modalities to strengthen code generation performance. Experiments on two processed open-source datasets demonstrate that our method, without relying on extensive pre-training, achieves superior results compared to existing pretrained models across BLEU-4, CodeBLEU, and ROUGE-L metrics, paving the way for more efficient and intelligent cloud-native software development.