arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2512.00380cs.SE
收藏

基于知识图谱的数据合成用于低资源软件开发:一个HarmonyOS案例研究

Knowledge-Graph-Driven Data Synthesis for Low-Resource Software Development: A HarmonyOS Case Study

Sun Yat-sen University(中山大学);Fudan University(复旦大学)

Mingwei Liu, Zheng Pei, Yanlin Wang, Zihao Wang, Zikang Li, Enci Lin, Xin Peng, Zibin Zheng

AI总结:

本文提出APIKG4Syn框架,利用API知识图谱生成API导向的问题-代码对,提升低资源框架下的代码生成性能,通过HarmonyOS案例验证其有效性。

摘要:

在低资源框架开发(如HarmonyOS)中,大语言模型(LLMs)通常缺乏足够的预训练暴露,导致代码生成性能不佳。尽管它们通常能跨语言保留编程逻辑,但频繁在框架特定的API和语法上失败,揭示了学习的算法知识与不熟悉的框架约定之间的差距。因此,即使先进的模型如GPT-4o在没有先验暴露的情况下也难以生成正确的代码。受这些挑战的启发,我们提出APIKG4Syn框架,该框架利用API知识图谱来合成API导向的问题-代码对,而无需可执行环境。它结合了单API和多API信息,后者由不确定性估计(UE)和蒙特卡洛树搜索(MCTS)引导,以构建高质量的微调数据。为了评估,我们选择HarmonyOS作为案例研究,因其文档易于获取且生态系统日益增长,并构建了其代码生成的第一个基准。实验结果表明,使用APIKG4Syn微调Qwen2.5-Coder-7B达到25.00%的pass@1,优于未微调的GPT-4o(17.59%)。我们进一步观察到,由APIKG4Syn生成的更大数据量始终导致更好的微调性能,并且最佳的单API到多API比例为8:2。消融研究也证实了我们框架中每个组件的必要性和有效性。这些发现突显了API导向数据在提升LLM性能以应对低资源软件开发场景中的有效性。

英文摘要:

In low-resource framework development (e.g., HarmonyOS), large language models (LLMs) often lack sufficient pre-training exposure, resulting in poor code generation performance. Although they generally preserve programming logic across languages, they frequently fail on framework-specific APIs and syntax, revealing a gap between learned algorithmic knowledge and unfamiliar framework conventions. Consequently, even advanced models such as GPT-4o struggle to produce correct code without prior exposure. Inspired by these challenges, we propose APIKG4Syn, a framework that leverages API knowledge graphs to synthesize API-oriented question-code pairs without requiring executable environments. It incorporates both single-API and multi-API information, with the latter guided by uncertainty estimation (UE) and Monte Carlo Tree Search (MCTS), to construct high-quality fine-tuning data. For evaluation, we select HarmonyOS as a case study due to its accessible documentation and growing ecosystem, and build the first benchmark for its code generation. Experimental results show that fine-tuning Qwen2.5-Coder-7B with APIKG4Syn achieves a pass@1 of 25.00%, outperforming untuned GPT-4o (17.59%). We further observe that larger volumes of data generated by APIKG4Syn consistently lead to better fine-tuning performance, and that the optimal Single-API to Multi-API ratio is 8:2. Ablation studies also confirm the necessity and effectiveness of each component in our framework. These findings highlight the effectiveness of API-oriented data in enhancing LLM performance for low-resource software development scenarios.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑