Revolutionising Interaction with Building Codes using AI (LLM+Advanced RAG)

Alexey Mokhov, MArch
Operations Research Bit
5 min readJan 21, 2024
Human and AI share information load in architecture and construction. Image by Author and Dall-E 3

Introduction

In the complex and dynamic realm of architectural design and construction, the formidable task of interpreting and navigating building codes consistently poses a challenge for professionals. Recognizing this, I embarked on an ambitious journey last year with the inception of “Arcue,” a project with an aim to fundamentally transform our approach to this perennial challenge through the application of artificial intelligence. This article provides an insightful exploration into the nuanced problem of analyzing and retrieving building code requirements. More importantly, it sheds light on the elegant solution that Arcue offers, harnessing the capabilities of Large Language Models (LLMs) alongside advanced information processing and retrieval technique called RAG (Retrieval Augmented Generation). This combination marks a significant leap in our ability to efficiently and accurately decode the complexities of building codes.

Arcue — AI-assisted query over building codes. Video by author

Understanding the Problem

The intricacies of building codes represent a significant and multifaceted challenge. These documents, critical to the field of architecture and construction, are characteristically extensive and densely packed with complex details. Their content is not only voluminous but also organized in a hierarchical manner, akin to a system of building elements and their sub-elements. This organization can be overwhelming, even for the most experienced professionals. The core challenge extends beyond the sheer volume of information; it lies in the nuanced and scattered nature of the content, dispersed across various sections and subsections.

Furthermore, the sophisticated terminology and the specific language structure used in building codes often lead to interpretational ambiguities. The meaning within these documents can be elusive, requiring a deep understanding of the context and a solid grasp of the technical terminology and language used. It’s a landscape where mere surface-level reading does not suffice; one needs to delve into the underlying layers of meaning to truly comprehend the codes.

In this context, the Large Language Models (LLMs, the tech behind ChatGPT) present a potential solution with their advanced natural language processing capabilities. They are capable of analysing content that ranges from simple text bodies to complex, extensive documents. However, the unique characteristics of building codes — their extensive length, hierarchical structure, the dispersion of knowledge throughout, and specialized terminology — render basic LLM queries (like simple document processing and questioning in platforms like ChatGPT) both ineffective and inefficient. This situation calls for a more sophisticated and tailored approach, one that can navigate the intricate maze of building codes with precision and clarity. This approach needs to not only process the information but also understand and interpret it in the context of the complex framework that building codes present.

Both volume and structure of information in building codes can be a headache even for skilled professional. Generated by Author with Dall-E 3

Arcue Project

The project is underpinned by the advanced Retrieval Augmented Generation (RAG) technique, representing a significant evolution in the realm of document analysis. RAG ingeniously melds the strengths of Large Language Models (LLMs) with sophisticated retrieval methods, thereby facilitating a nuanced understanding of complex documents.

The concept of RAG lies in enhancing the capabilities of LLMs by augmenting their responses with information retrieved from external databases. It works by dynamically retrieving relevant pieces of information from a vast repository, which the LLM then incorporates into its responses. This technique has been successfully applied in various fields, addressing complex problems ranging from legal document analysis to medical research, where accuracy and context-specific information are paramount.

For instance, in healthcare, RAG-based systems help in providing more accurate medical information by retrieving data from up-to-date medical journals and research papers. Similarly, in legal tech, RAG is used to parse through extensive legal texts, enabling more precise and context-aware responses to legal queries.

Arcue leverages this RAG technology to process publicly available building codes (currently it handles UAE building codes, such as the Dubai Building Code and the UAE Civil Defence Code, but its application can be extended). The process starts by breaking down these extensive documents into smaller, manageable text pieces, subsequently stored in a database. When a query is made, the system identifies and retrieves the most pertinent text segments from this database, providing the LLM at Arcue’s core with a rich context for generating informed responses. This approach ensures that the LLM’s responses are not solely based on its internal knowledge base, which might be outdated or irrelevant, but are instead grounded in current and specific data.

Basic RAG: User sends Question (query) to Retriever (system) that coordinates with Context (database) and LLM to come up with the response. Illustration by Snorkel.ai

Advancing Beyond Basic RAG

Recognizing the limitations of traditional chunking methods based on character count, particularly for the complex, layered structure of building codes, Arcue adopts more sophisticated techniques across its RAG pipeline. For instance, it uses regular expressions (regex) for document chunking, segmenting texts into sections and subsections while preserving essential metadata like name of section, sequence of parent sections (highlighting section’s place within the document’s hierarchy), page number, etc. This context-rich document processing dramatically enhances the LLM’s ability to generate valid and comprehensive responses.

Further refining the retrieval mechanism, Arcue incorporates filtering and re-ranking methods typical of “advanced RAG” systems. These enhancements, though they may slightly increase response times, drastically improve the relevance and accuracy of responses in the context of building code queries.

Basic vs Advanced RAG comparison (created by M K Pavan Kumar)

User Interaction and Experience

Upon generating a response, Arcue doesn’t merely present the answer to the user. It enriches the interaction by including links to the retrieved sections of the building code within the response. This feature is more than a convenience; it validates the LLM’s responses and empowers users to explore the codes further. Such a design not only fosters a deeper understanding and application of the codes but also helps mitigate potential issues of interpretation, thereby ensuring that users can rely on the information with confidence. See example below:

Query and response by Arcue

Conclusion

Arcue represents a pioneering step in utilizing AI for the analysis and retrieval of building codes. By marrying the capabilities of LLMs with advanced RAG and thoughtful preprocessing, it offers a powerful tool for architects and construction professionals. This project is not just about simplifying a complex task; it’s about empowering professionals with the knowledge and confidence to navigate the labyrinth of building codes efficiently and accurately.

To learn more, please visit www.arcue.org. If interested to support project, extend it to your problem or just provide a feedback, feel free to reach out to me directly. Thanks for reading! 😉

--

--

Alexey Mokhov, MArch
Operations Research Bit

Design Manager @ IHG | Fulbright Alumnus | Passionate about Buildings, Hotels and AI