Table of Contents
Fetching ...

Unseen-Codebases-Domain Data Synthesis and Training Based on Code Graphs

Guangsheng Ou, Qiming Zhang, Sirong Chen, Anji Li, Dong Xu, Tiancheng Luo, Dekun Dai, Cuiyun Gao, Long Wang, Jun Zhou, Mingwei Liu, Zibin Zheng

TL;DR

UCD-Training is proposed, a two-stage training framework for reasoning-aware data synthesis grounded in a code graph constructed from unseen codebases and introduces a new benchmark, UnseenCodeBench, for code generation on unseen codebases and conducts comprehensive experiments across multiple codebases.

Abstract

In the context of newly release software frameworks, large language models (LLMs) often exhibit poor performance and a high rate of hallucination, as they are not exposed to such environments during training. Although inference-time augmentation techniques such as retrieval-augmented generation (RAG) can partially mitigate hallucinations, knowledge injection through prompting alone is insufficient to enable models to fully understand the intrinsic relationships among different components of a codebase, or to reason about the correct compositions and apply. Although explicit knowledge injection can be achieved through post-training, compared with public code domains, unseen codebases typically provide only source code and lack large volumes of high-quality, usage-oriented code that can be directly leveraged as training data. Consequently, existing data synthesis approaches are insufficient to adequately capture unseen codebases usage scenarios when restricted to source code alone. To address these challenges, we propose UCD-Training, a two-stage training framework for reasoning-aware data synthesis grounded in a code graph constructed from unseen codebases. UCD-Training first parses the source code to build a code graph, then conducts dependency-preserving continued pretraining (CPT) using file-level dependency data, followed by graph-grounded supervised fine-tuning (SFT) on three types of synthesized data augmented with explicit reasoning traces: (1) single-hop relation reasoning data, (2) compositional API reasoning data, and (3) codebase utilization data. We further introduce a new benchmark, UnseenCodeBench, for code generation on unseen codebases and conduct comprehensive experiments across multiple codebases.

Unseen-Codebases-Domain Data Synthesis and Training Based on Code Graphs

TL;DR

UCD-Training is proposed, a two-stage training framework for reasoning-aware data synthesis grounded in a code graph constructed from unseen codebases and introduces a new benchmark, UnseenCodeBench, for code generation on unseen codebases and conducts comprehensive experiments across multiple codebases.

Abstract

In the context of newly release software frameworks, large language models (LLMs) often exhibit poor performance and a high rate of hallucination, as they are not exposed to such environments during training. Although inference-time augmentation techniques such as retrieval-augmented generation (RAG) can partially mitigate hallucinations, knowledge injection through prompting alone is insufficient to enable models to fully understand the intrinsic relationships among different components of a codebase, or to reason about the correct compositions and apply. Although explicit knowledge injection can be achieved through post-training, compared with public code domains, unseen codebases typically provide only source code and lack large volumes of high-quality, usage-oriented code that can be directly leveraged as training data. Consequently, existing data synthesis approaches are insufficient to adequately capture unseen codebases usage scenarios when restricted to source code alone. To address these challenges, we propose UCD-Training, a two-stage training framework for reasoning-aware data synthesis grounded in a code graph constructed from unseen codebases. UCD-Training first parses the source code to build a code graph, then conducts dependency-preserving continued pretraining (CPT) using file-level dependency data, followed by graph-grounded supervised fine-tuning (SFT) on three types of synthesized data augmented with explicit reasoning traces: (1) single-hop relation reasoning data, (2) compositional API reasoning data, and (3) codebase utilization data. We further introduce a new benchmark, UnseenCodeBench, for code generation on unseen codebases and conduct comprehensive experiments across multiple codebases.
Paper Structure (27 sections, 1 equation, 7 figures, 4 tables, 1 algorithm)

This paper contains 27 sections, 1 equation, 7 figures, 4 tables, 1 algorithm.

Figures (7)

  • Figure 1: Overview of UCD-Training
  • Figure 2: Example for Generating Codebase Utilization Data
  • Figure 3: A Comparative Example Illustrating the Outputs on the Same Problem Using Baselines and UCD-Training. The example is the task with ID limit_recent_events from the sqlgen in UnseenCodeBench. The complete model outputs can be found on GitHub.
  • Figure 4: Generality of Different Models. \ref{['fig:reaction']} shows performance on reaction and \ref{['fig:leann']} on leann.
  • Figure 5: Model performance under different synthetic data scales. Base model is Qwen3-14B-Base. \ref{['fig:hexi_scale']} is model's performance under different scales of synthetic data on reaction, \ref{['fig:leann_scale']} is model's performance under different scales of synthetic data on leann.
  • ...and 2 more figures