Fine-tuning large language models and evaluating retrieval methods for improved question answering on building codes
1 Department of Civil & Environmental Engineering, University of Alberta, Edmonton, Alberta, Canada
2 Department of Electrical Engineering, Aligarh Muslim University, Aligarh, Uttar Pradesh, India
  • Volume
  • Citation
    Aqib M, Hamza M, Mei Q, Chui Y. Fine-tuning large language models and evaluating retrieval methods for improved question answering on building codes. Smart Constr. 2025(3):0021, https://doi.org/10.55092/sc20250021. 
  • DOI
    10.55092/sc20250021
  • Copyright
    Copyright2025 by the authors. Published by ELSP.
Abstract

Building codes establish standards for the design, construction, and safety of buildings, ensuring structural integrity, fire protection, and accessibility. However, their extensiveness, complexity, and frequent updates make manual querying difficult, requiring users to navigate large volumes of text, interpret technical language, and locate relevant clauses across sections. A potential solution is to build a Question-Answering (QA) system that answers user queries and among the various methods for building a QA system, Retrieval-Augmented Generation (RAG) stands out in performance. RAG consists of two components: a retriever and a language model. This study focuses on identifying a suitable retriever method for building codes and optimizing the generational capability of the language model using fine-tuning techniques. We conducted a detailed evaluation of various retrieval methods by performing the retrieval on the National Building Code of Canada (NBCC) and explored the impact of domain-specific fine-tuning on several language models using the dataset derived from NBCC. Experimental results showed that Elasticsearch proved to be the most robust retriever among all. The findings also indicate that fine-tuning language models on an NBCC-specific dataset can enhance their ability to generate contextually relevant responses.

Keywords

question answering system; natural language processing (NLP); National Building Code of Canada (NBCC); large language models (LLMs); multi-modal models; retrieval algorithms; parameter efficient fine tuning (PEFT); low-rank adaptation (LoRa)

Preview