How SP-AI works
The quality of answers on building codes depends less on the model or the prompt than on how the data is structured. This page explains why the usual approach does not work here and what that changes in the answers you get.
Where a standard RAG pipeline breaks
The standard pipeline looks like this: split documents into chunks, compute embeddings, store them in a vector database and put a model on top. It works in a demo. On building codes it starts to fail quickly.
The reason is that the smallest unit of storage and the smallest unit of meaning in a code do not match. The user asks about a specific requirement; semantic search finds a clause with similar wording — but next to it there is a sub-clause, a note or a reference to another document without which the answer is wrong. The model sees one matching piece of text and answers as if that were enough.
Small chunks lose context, large ones make search noisy. The problem is not that the model is not smart enough, but that the document is represented too flatly.
What we built instead of flat search
In SP-AI a code is not a set of text fragments but a connected structure. Requirements are addressable by clause, tables and formulas exist as separate objects, and links between requirements are recorded, including mandatory ones.
In practice this means the system does not answer from a single “similar” piece of text. Having found a relevant requirement, it checks what has to be taken into account with it — a qualifying sub-clause, a note, a table, a mandatory reference to another document — and assembles the minimum sufficient context before forming the answer.
Several search strategies run on top of this structure: the same question may need search by meaning, an exact match on a clause number and a lookup in a table. The results are combined into one answer context.
Verifiable answers
An answer must cite a specific clause in a form that can be opened and read — for example, “EN 1991-1-1, clause 6.3.1.2”. This is a requirement of the system, not a wish addressed to the model.
If no relevant context is found in the corpus, the right behaviour is to say so, not to assemble a plausible answer from the model’s memory. The engineer must be able to open the document and confirm that nothing was made up.
How we measure quality
We maintain our own evaluation set — real queries selected from usage logs and labelled by question type, discipline and difficulty. The same set is run through several systems: SP-AI with our retrieval pipeline and general-purpose models without a code corpus.
Each answer is assessed independently against one rubric, not by overall impression. The criteria:
The main finding of these runs was not about how “smart” the models are. A general-purpose model often explains the engineering logic just as well or better, but loses where you need to open the code and confirm what was said. The difference between systems lies not in the quality of reasoning but in verifiability.
Where the limits are
- The corpus depends on the jurisdiction. The main design disciplines are structured: fire safety, general building regulations, ventilation, water supply and drainage, power supply, urban planning. The codes of a new country are loaded under contract; the indexing architecture is designed to scale, so a larger corpus does not require changes to the core.
- Retrieval does not remove the problem, it moves it. When search finds several similar codes, or a question needs engineering analysis across several documents at once, quality drops. We track this with a separate error taxonomy.
- An honest refusal is better than a confident answer. If the required document is not in the corpus, the system says so.