Thinking & Writing
ADAS Spec Validator: Cyberpunk glassmorphic terminal showing deterministic validation results and AI evidence explanation
AI Safety · Engineering · BIM Compliance

AI Should Explain Engineering Validation, Not Invent It

May 2026 · Damir Andrijanic · 9 min read

The high-stakes validation trap

Most AI applications in 2026 focus on generation: writing code, drafting emails, or producing generic text. While impressive, this generative model falls apart in high-precision engineering workflows like BIM (Building Information Modeling). In CAD/BIM validation, if a compliance reviewer asks if a structural room meets safety codes, a 'hallucinated' or plausible-sounding answer is worse than no answer.

BIM models represent complex spatial elements—levels, rooms, doors, and fire boundaries. Traditional compliance checks are done via strict, deterministic formulas. The moment we inject standard generative AI into this loop, we risk hallucinating metrics, mapping wrong relations, or declaring compliance where it fails. Yet, simple deterministic error codes are cryptic and hard for human architects to review. How do we get the best of both worlds?

Constrained Explanation: The ADAS Spec Validator

I built the ADAS Spec Validator to prove a fundamental design pattern: AI should explain engineering validation, never invent it.

The system splits validation into two isolated layers. First, a client-side deterministic rule engine, built with TypeScript and Zod, parses Revit/CAD JSON models and evaluates strict compliance requirements (e.g. minimum room areas, fire door connectivity, path distances). It emits a strict evidence contract. Second, an AI explanation router (Gemini 2.5 Flash / OpenAI) receives ONLY this verified evidence. It is strictly forbidden by an ADAS System Prompt from inferring missing facts or inventing data, focusing solely on explaining the exact reasoning in natural language.

System Architecture & Data Flow

Loading diagram…

The data flow guarantees complete separation of the AI explainer from raw model geometry. Mathematical calculations and boundaries are executed deterministically.

Core engineering stack

BIM Extractor Boundary

A C# .NET console application modeling the Revit API boundary, extracting levels, rooms, and door relations into a sanitized JSON contract.

Type-Safe Validation

TypeScript and Zod schemas to ingest, validate, and sanitize the normalized CAD/BIM data model, preventing garbage-in-garbage-out errors.

Deterministic Rules

Strict TypeScript rule engines evaluating custom compliance rules (like MinimumRoomAreaRule, MinimumDoorWidthForRoomTypeRule) and producing detailed validation evidence.

AI Explanation Engine

Google Gemini 2.5 Flash API as a fast, high-context explanation engine, with automated provider fallbacks to OpenAI's GPT-4o-mini.

Reliability Testing

Vitest suite verifying type safety, rule engine correctness, fallback mechanics, and strict prompt compliance boundaries.

Visual UI Interface

Next.js 15 (App Router) and Tailwind CSS displaying real-time validation passes, violations, and the natural language explanation panel.

Key architectural breakthroughs

1) Eliminating LLM Hallucinations in Compliance

The Risk: When an LLM is directly asked to read a raw BIM JSON model and assess safety rules, it frequently confuses IDs, fabricates wall thicknesses, and miscalculates simple geometry.

The Solution: I isolated the AI entirely from the raw calculation. The TypeScript rule engine executes the mathematics, compiling a structured array of 'evidence' (observed value, expected threshold, target IDs). The AI is presented with this evidence and a system prompt that mandates returning 'I cannot determine that from the available model evidence' if any fact is missing.

2) Handling Missing and Unknown States Gracefully

The Risk: Real-world CAD exports are incomplete. Missing areas, unmapped doors, or missing level tags usually cause standard rules to crash or AI models to invent missing data.

The Solution: I implemented a three-state validation model: PASS, FAIL, and UNKNOWN. If a room has no area parameter, the rule engine marks it UNKNOWN and outputs precise evidence describing the missing property. The AI respects this state, explaining exactly why the verification is stalled rather than trying to guess it.

3) C# Revit Extraction Normalization

The Risk: Revit objects contain thousands of raw parameters, cyclic structural dependencies, and internal coordinates that are too noisy and heavy for web apps or prompt contexts.

The Solution: I built a C# console extractor that resolves these heavy dependencies using a Revit-inspired DTO structure. It flattens spatial elements into standard Levels, Rooms, and Doors JSON, representing the exact data contract between desktop CAD and web compliance engines.

The UX: Bringing Clarity to Complexity

Human reviewers don't want black boxes. The ADAS interface pairs clean status badges (PASS / FAIL / WARNING) with direct highlights of affected element IDs (e.g. rm-meet-01). The AI explanation acts as a smart, natural-language sidekick—brief, evidence-backed, and directly telling the architect which door parameter to fix in Revit.

Proven Results

By separating deterministic evaluation from prompt-based translation, the system achieves 100% mathematical precision while maintaining natural user interaction.

Validation Accuracy

100% Deterministic

AI Explanation Logic

Evidence-Grounded

This prototype shows that engineering-grade trust is achievable when we treat the AI as a communication interface rather than a calculation engine.

Takeaway

Don't let AI calculate what a 10-line math formula can solve perfectly. Use code for math, logic, and safety guardrails. Use AI for context, translation, and user-centric explanation. That is the architecture of trust.

BIM Compliance & Validation Studio

Experience the evidence-constrained AI system and real-time floor plan editor directly inside your browser. Drag and drop model files, edit sizes live on the floor plan, define specs, and query the cognitive terminal.

BIM Design Automation Studio
PRO BOUNDARY Extractor

ADAS Spec Validator

Deterministic compliance engine mapping Revit / AutoCAD models against strict architectural requirements.

Storey Compliance

6 / 11 Passed

Deterministic requirements satisfied

55%
Valid PassesOUTCOME

6

Detected ViolationsOUTCOME

2

Unknown (Missing Parameters)OUTCOME

3

CAD / BIM Spatial Map

Interactive visual rendering of model boundaries and corridors

Interactive Model Floor Plan

Click elements to inspect; validation errors glow dynamically.

Pass Fail Unknown
Stockroom A18.2 sqmOffice 1019.4 sqmOffice 1026.1 sqmMeeting Room AArea: ?Stockroom BArea: ?Door S1Door O1Door O2Door M1Door S2

BIM / CAD Extract Connector

Drag JSON or .ifc files to ingest Revit boundaries locally.

No-Code Spec Builder

Visually build and inject compliance rules directly into the deterministic validator.

Preset templates

15 sqm

Engine Validation Log
11 specs checked

Deterministic rules evaluate parameters instantly with strict evidence outputs.

pass
critical

Stockroom A satisfies minimum area (18.2 sqm >= 15 sqm).

Rule: Stockrooms must be at least 15 sqm

Technical Evidence Fact

Room area was compared against deterministic threshold.

Observed: 18.2
Expected: 15
Refs: rm-stock-01
unknown
critical

Cannot verify area for Stockroom B; area is missing.

Rule: Stockrooms must be at least 15 sqm

Technical Evidence Fact

Area parameter is not available in normalized model data.

Observed: null
Expected: >= 15
Refs: rm-stock-02
pass
critical

Office 101 satisfies minimum area (9.4 sqm >= 8 sqm).

Rule: Offices must be at least 8 sqm

Technical Evidence Fact

Room area was compared against deterministic threshold.

Observed: 9.4
Expected: 8
Refs: rm-office-01
fail
critical

Office 102 violates minimum area (6.1 sqm < 8 sqm).

Rule: Offices must be at least 8 sqm

Technical Evidence Fact

Room area was compared against deterministic threshold.

Observed: 6.1
Expected: 8
Refs: rm-office-02
fail
warning

Stockroom A has door widths below 0.85m.

Rule: Stockroom doors must be at least 0.85m wide

Technical Evidence Fact

Connected door width is below deterministic threshold.

Observed: dr-05:0.8
Expected: >= 0.85m
Refs: rm-stock-01, dr-01, dr-05
unknown
warning

Cannot verify door widths for Stockroom B; door relationship data is missing.

Rule: Stockroom doors must be at least 0.85m wide

Technical Evidence Fact

Connected door identifiers are required but not available.

Observed: null
Expected: Array of door ids
Refs: rm-stock-02
pass
warning

Stockroom A has at least one connected door.

Rule: Every room must have at least one connected door

Technical Evidence Fact

Room-to-door relationships were checked for minimum connectivity.

Observed: 2
Expected: >= 1
Refs: rm-stock-01
pass
warning

Office 101 has at least one connected door.

Rule: Every room must have at least one connected door

Technical Evidence Fact

Room-to-door relationships were checked for minimum connectivity.

Observed: 1
Expected: >= 1
Refs: rm-office-01
pass
warning

Office 102 has at least one connected door.

Rule: Every room must have at least one connected door

Technical Evidence Fact

Room-to-door relationships were checked for minimum connectivity.

Observed: 1
Expected: >= 1
Refs: rm-office-02
pass
warning

Meeting Room A has at least one connected door.

Rule: Every room must have at least one connected door

Technical Evidence Fact

Room-to-door relationships were checked for minimum connectivity.

Observed: 1
Expected: >= 1
Refs: rm-meet-01
unknown
warning

Cannot verify connected doors for Stockroom B; relationship data is missing.

Rule: Every room must have at least one connected door

Technical Evidence Fact

Connected door relationship is missing in normalized data.

Observed: null
Expected: At least one connected door id
Refs: rm-stock-02

BIM Model Studio

No element selected

Select any room or door on the floor plan to inspect details and edit parameters in real-time.

Model Builder

ADAS AI COGNITIVE CORE

AI-STATUS: ONLINE

Evidence-Constrained Agent

The chatbot is strictly bounded to the generated deterministic rule outcomes. No hallucinated rules.

Agent Persona

Preset Queries

Deterministic Compliance Policy

The chatbot answers are strictly grounded in active spatial facts. Missing properties default to `unknown`, eliminating any AI-hallucinated certification passes.

Explore the underlying prototype source code and design patterns in my portfolio repository or download the schema contract:

Check the Blueprint above