Building Code Question-Answering Systems Enhanced by Large Language Models and Knowledge-Graph-Based Retrieval-Augmented Generation
Abstract Building codes are complex documents that pose significant challenges for consistent interpretation and efficient compliance checking in the construction industry. Existing automated methods often overlook the interrelationships between provisions and lack comprehensive evaluation support from practical engineering perspectives. In this study, we develop a retrieval-augmented generation (RAG) system enhanced with a knowledge graph to interpret building codes by leveraging both the semantic content and structural relationships within the documents. We evaluated the system using 661 query-context-answer triplets from a particular building code. The RAG-enhanced model outperformed state-of-the-art pretrained transformer models and general-purpose large language models (LLMs) in answer quality. Shorter text chunks led to higher semantic relevance, while longer chunks improved precision. The closed-source model achieved better accuracy and speed than the open-source alternative. These findings demonstrate the potential of knowledge-graph-based RAG systems to support accurate, efficient, and scalable regulatory interpretation in real-world engineering contexts.
Authors
- Fan Yang (ORCID: https://orcid.org/0000-0001-9842-719X)
- Jiansong Zhang (ORCID: https://orcid.org/0000-0001-5225-5943)
Institutions
- Purdue University West Lafayette (US)
- University of Tennessee at Knoxville (US)
Publication Details
- Journal
- Journal of Computing in Civil Engineering
- Published
- 2026-10-14
- DOI
- https://doi.org/10.1061/jccee5.cpeng-7400
- Primary Topic
- Topic Modeling
- Type
- article
- Field-Weighted Citation Impact
- 0.00