cs.SEMar 8, 2026

KCoEvo: A Knowledge Graph Augmented Framework for Evolutionary Code Generation

Authors: Jiazhen Kang, Yuchen Lu, Chen Jiang, Jinrui Liu, Tianhao Zhang, Bo Jiang, Ningyuan Sun, Tongtong Wu, 

Organizations: Southeast University, Nanjing, China · ByteDance Ltd., China · Monash University, Melbourne, Australia

Abstract

Code evolution is inevitable in modern software development. Changes to third-party APIs frequently break existing code and complicate maintenance, posing practical challenges for developers. While large language models (LLMs) have shown promise in code generation, they struggle to reason without a structured representation of these evolving relationships, often leading them to produce outdated APIs or invalid outputs. In this work, we propose a knowledge graph-augmented framework that decomposes the migration task into two synergistic stages: evolution path retrieval and path-informed code generation. Our approach constructs static and dynamic API graphs to model intra-version structures and cross-version transitions, enabling structured reasoning over API evolution. Both modules are trained with synthetic supervision automatically derived from real-world API diffs, ensuring scalability and minimal human effort. Extensive experiments across single-package and multi-package benchmarks demonstrate that our framework significantly improves migration accuracy, controllability, and execution success over standard LLM baselines. The source code and datasets are available at: https://github.com/kangjz1203/KCoEvo.

Figures & tables

Explore similar work

CardsList
  1. LibEvoBench: Probing Temporal Knowledge Stratification in Code Generation Models

    Jun 24, 2026Daniele Cipollone, Sergey Titov, Maliheh Izadi +2Software EngineeringTemporal Reasoning in Language Models

  2. Learning from Execution: Self-Evolving Memory for Private-Library Code Generation

    Apr 27, 2026Mofei Li, Taozhi Chen, Guowei Yang +1Memory-Augmented Language ModelsKnowledge Augmentation for Language Models