DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generation Conference: Proc. of the 25th International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2026); May 25 – 29, 2026; Paphos, Cyprus
Shuai Wang, Dhasarathy Parthasarathy, Robert Feldt, Yinan Yu · 2026
Read DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generation Conference: Proc. of the 25th International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2026); May 25 – 29, 2026; Paphos, Cyprus by Shuai Wang, Dhasarathy Parthasarathy, Robert Feldt, Yinan Yu (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-21430.txt.
Introduction
Wang and co-authors present DomAgent, a coding agent for tasks that need specialized domain knowledge. General language models often fail such tasks because the knowledge is rare in their training data. DomAgent retrieves help through DomRetriever, which mixes top-down knowledge-graph reasoning with bottom-up case-based reasoning. The loop gathers structured facts and past cases before code is written. On the DS-1000 benchmark and on real truck software tasks, DomAgent let small open models close much of the gap with large closed ones.
Catalog record
| CREATOR | Shuai Wang, Dhasarathy Parthasarathy, Robert Feldt, Yinan Yu |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 45447 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2603.21430
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
DomAgent: Leveraging Knowledge Graphs and Case-Based Reasoning for Domain-Specific Code Generation Conference: Proc. of the 25th International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2026); May 25 – 29, 2026; Paphos, Cyprus Shuai Wang, Dhasarathy Parthasarathy, Robert Feldt, Yinan Yu Abstract . 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 . C. Amato, L. Dennis, V. Mascardi, J. Thangarajah (eds.) 1. Introduction Recently, large language models (LLMs) have made remarkable progress in the field of code generation. Both closed-source models such as GPT-4o and Claude Sonnet 4.5, and open-source models like CodeLlama ( 29 ) , Mistral ( 16 ) , DeepSeek-Coder ( 11 ) , and Qwen-Coder ( 15 ) have demonstrated impressive capabilities, and some of them even surpass human performance in general benchmark tasks. Tools like GitHub Copilot now leverage these models to provide adaptive, real-time coding assistance across various programming environments. Figure 1 . Example of a domain-specific code generation task in truck software development: reading the CAN signal OverspeedWarningStat and adapting the function with context-specific mapping to fit the workflow. In real-world applications, programming tasks are often highly domain-specific ( 20 ; 35 ) . Software development across different industries, such as truck control systems or database management ( 14 ) , typically requires code that is tailored to the distinct requirements and constraints of each domain. While existing LLMs perform well on general-purpose, open-domain tasks, their performance degrades significantly when faced with specialized, domain-specific problems ( 9 ) . One key reason is that LLMs often lack the required information to accomplish specialized tasks. Domain-specific programming demands not only domain knowledge , such as understanding how to use industry-specific libraries, but also the ability to produce specialized solutions aligned with the operational logic of the target system. Figure 1 illustrates an example from truck software development: generating Python code to read the CAN signal OverspeedWarningStat and adapting the function with context-specific mapping to fit the workflow. Directly using general LLMs poses two challenges: (1) a lack of knowledge about third-party libraries, and (2) insufficient capability for context-specific adaptation to the workflow. A straightforward way to address this challenge is to fine-tune LLMs with domain-specific data ( 1 ; 8 ) . However, relying on fine-tuning to equip LLMs with domain-specific knowledge is often impractical, as fine-tuning introduces high development and maintenance costs ( 5 ) . The resulting models often struggle to adapt to constantly updated libraries. A more efficient and flexible solution is Retrieval-Augmented Generation (RAG) ( 18 ) , which augments existing LLMs with external knowledge without modifying model weights. Popular software development frameworks such as AutoGen ( 41 ) , LangChain and TaskWeaver ( 27 ) leverage this strategy to quickly integrate LLMs with domain knowledge at low cost. Moreover, recent studies ( 26 ; 32 ) show that combining lightweight fine-tuning with RAG, using only a small number of domain examples, can substantially enhance model adaptability and accuracy for specialized programming tasks, achieving results comparable to much larger, fully fine-tuned systems. In practice, RAG-based solutions dominate many real-world applications, accounting for over half (about 51%) of deployed LLM-powered software systems ( 34 ) . To provide domain knowledge efficiently, recent work has shown that even basic retrieval methods like BM25 can significantly enhance performance by appending top-K results from external knowledge bases to prompts ( 42 ) . Using sentence embeddings for retrieval can also improve the retrieval accuracy ( 19 ; 43 ) . However, excessively long retrieved content can negatively impact performance, as extended contexts may obscure key information and mislead the model ( 3 ) . Segmenting candidate texts into smaller chunks of 200–800 tokens is a way to solve this issue ( 38 ) . Zhu et al. ( 46 ) improved the segmenting by using structural cues such as abstract syntax trees (ASTs) to produce more meaningful splits ( 46 ) . Using another LLMs to filter out irrelevant information and compress the retrieved content also mitigate it ( 7 ) . To introduce structured and concise knowledge, knowledge graphs (KGs) have also been explored as retrieval sources for code repair ( 25 ) . KGs also contain the dependencies between software modules, supporting repository-level code generation ( 2 ) . However, as these methods largely depend on plain textual similarity and neglect explicit links to relevant packages and functions, precisely retrieving relevant knowledge remains a fundamental challenge in complex real-world settings. Bottom-up retrieval: For domain-specific tasks that require specialized knowledge and domain logic, a common approach is to leverage case-based reasoning (CBR), where a few-shot examples is included in the prompt to guide LLMs toward solving domain-adapted tasks ( 13 ; 39 ) . Studies have shown that a fixed set of examples often fails to cover diverse scenarios. A more effective approach is to dynamically select examples based on the given task, using text embeddings to compute similarity scores ( 4 ) . Subsequent work refined the retrieval process by re-ranking candidates through AST analysis to better capture code-level relationships ( 24 ) . To broaden the case coverage, Tan et al. ( 33 ) queried multiple information sources and integrated these retrieved contents through a segmented prompting strategy. Constructing high-quality case libraries from large training datasets is an effective way to improve case coverage ( 12 ) . However, in real-world scenarios, creating a large and comprehensive case base is labor-intensive and time-consuming. Achieving high coverage with a small set of examples is still an important and practical challenge. Top-down retrieval: Just as human learning also relies on structured understanding, rules, relationships, and conceptual hierarchies, LLMs require top-down knowledge to complement bottom-up example learning. KGs provide such structure by representing packages, functions, and their interrelations as nodes and edges. This structure makes it straightforward to link code examples to KG based on the package calling. For instance, as shown in Figure 1 , a code snippet calling utils.can.read can