arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.21430cs.AIcs.SE
收藏

DomAgent:利用知识图谱和基于案例的推理进行领域特定代码生成

DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generation

Chalmers University of Technology(楚德斯大学)

Shuai Wang, Dhasarathy Parthasarathy, Robert Feldt, Yinan Yu

AI总结:

DomAgent通过结合知识图谱和基于案例的推理,提升领域特定代码生成能力,通过结构化推理和定向检索实现领域适应,实验表明其能显著提升复杂真实应用场景的代码生成性能。

摘要:

大型语言模型(LLMs)在代码生成方面表现出色,但因其训练数据多为公共领域文本,直接应用于真实软件开发往往效果不佳,因为这些场景通常需要领域特定知识。特别是领域特定任务通常需要高度专业化的解决方案,这些在通用LLMs的训练数据中往往不足或完全缺失。为解决这一挑战,我们提出了DomAgent,一种自主编码代理,通过结构化推理和定向检索使LLMs能够生成领域适应的代码。DomAgent的核心组件是DomRetriever,一个新颖的检索模块,通过结合概念理解与经验示例,模拟人类学习领域知识的方式。它动态整合自上而下的知识图谱推理与自下而上的基于案例的推理,实现迭代检索和合成结构化知识和代表性案例,以确保上下文相关性和广泛的任务覆盖。DomRetriever可以作为DomAgent的一部分或独立于任何LLM使用,以实现灵活的领域适应。我们评估了DomAgent在数据科学领域(DS-1000)的开放基准数据集上,并进一步将其应用于现实中的卡车软件开发任务。实验结果表明,DomAgent显著提升了领域特定代码生成能力,使小型开源模型在复杂、真实的应用场景中能够缩小与大型专有LLMs的性能差距。代码可在:https://github.com/Wangshuaiia/DomAgent 获取。

英文摘要:

Large language models (LLMs) have shown impressive capabilities in code generation. However, because most LLMs are trained on public domain corpora, directly applying them to real-world software development often yields low success rates, as these scenarios frequently require domain-specific knowledge. In particular, domain-specific tasks usually demand highly specialized solutions, which are often underrepresented or entirely absent in the training data of generic LLMs. To address this challenge, we propose DomAgent, an autonomous coding agent that bridges this gap by enabling LLMs to generate domain-adapted code through structured reasoning and targeted retrieval. A core component of DomAgent is DomRetriever, a novel retrieval module that emulates how humans learn domain-specific knowledge, by combining conceptual understanding with experiential examples. It dynamically integrates top-down knowledge-graph reasoning with bottom-up case-based reasoning, enabling iterative retrieval and synthesis of structured knowledge and representative cases to ensure contextual relevance and broad task coverage. DomRetriever can operate as part of DomAgent or independently with any LLM for flexible domain adaptation. We evaluate DomAgent on an open benchmark dataset in the data science domain (DS-1000) and further apply it to real-world truck software development tasks. Experimental results show that DomAgent significantly enhances domain-specific code generation, enabling small open-source models to close much of the performance gap with large proprietary LLMs in complex, real-world applications. The code is available at: https://github.com/Wangshuaiia/DomAgent.

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

↑