A study of 450 scripts found that code that worked technically could still contain flawed safety calculations.
Researchers tested scripts generated from 150 prompts written in the styles of construction safety managers, foremen and workers. They ran the scripts in an isolated sandbox and assessed their structure, error handling and construction-safety logic using an automated review process with human involvement.
About 85% of the scripts ran successfully, but execution did not reliably mean that the calculations were correct. Among scripts that ran, about 45% contained a hidden logic failure, and less formal prompts were more likely to lead the models to invent missing safety variables.
When working code fails
The study examined 450 Python scripts produced by Claude 3.5 Haiku, GPT-4o Mini and Gemini 2.5 Flash. Of these, 384 scripts, or 85.3%, ran successfully; 66 failed because of syntax errors, timeouts or other execution problems. Error handling appeared in only 16% of the scripts.
Running code was not a dependable sign that the safety logic was correct. Among the scripts that ran, researchers identified an overall silent-failure rate of about 45%—meaning the code produced an output while using incorrect safety logic. GPT-4o Mini produced mathematically inaccurate results in about 56% of its functional scripts. Prompts written in less formal, less specific styles associated with field roles were more likely to cause the models to invent missing safety variables.
Why safety decisions are different
Construction-safety tools can influence decisions about whether conditions meet required safety thresholds. The findings indicate that an AI-generated tool can appear to work while giving an incorrect result, making raw, unreviewed scripts unsuitable as standalone safety instruments.
The researchers recommend using AI for language-based tasks, such as interpreting descriptions or extracting variables, while placing safety-critical calculations in pre-checked, deterministic software. They also call for clear organizational rules governing AI-generated tools.
Evidence and caveats
This was an empirical evaluation of 450 scripts generated from 150 prompts and tested in an isolated Python sandbox. The scripts were assessed for execution, structure and safety logic through dynamic testing and an LLM-based judging system with human involvement. The study found associations between user persona and invented variables, but it did not test the tools in live construction operations or measure real-world injuries or decisions.
The evaluation covered three models at a particular point in time, and the personas were synthetic. Actual construction-site language may differ across companies, trades and regions, so the reported failure rates may not apply directly to every setting. The models and their failure patterns may also change as newer systems are released.
// Source
Journal of Information Technology in Construction · 2026 · DOI: 10.36680/j.itcon.2023.058
Authors: S M Jamil Uddin
Institutions: Colorado State University