Effect of hierarchical prompt engineering on convolutional neural networks generated by large language models for helmet wearing compliance classification

Abstract Non-compliance with Personal Protective Equipment (PPE) use regulations, particularly helmet wearing, remains a critical occupational safety challenge in high-risk industrial environments. This study investigates how hierarchical prompt engineering shapes the quality of Convolutional Neural Networks (CNNs) generated by Large Language Models (LLMs) for image-level helmet-wearing compliance classification (helmet vs. no-helmet) as a mechanism for PPE compliance monitoring. Four LLMs (ChatGPT, Claude, Gemini, and Grok) produced executable PyTorch scripts across three prompt tiers of increasing specificity. These configurations were evaluated over 20 independent runs on a purpose-built dataset of 972 balanced images, using six classification metrics, four prompt quality metrics, and three resource efficiency dimensions. Ten of the twelve configurations converged to a high-performance plateau (accuracy 0.957-−0.967, AUC 0.985-−0.993). Claude at Tier 1 achieved the highest accuracy (0.967) and the lowest CPU usage (12.2%), whereas the best-calibrated (lowest-loss) pipelines were produced by Gemini and Grok at Tier 1 (test loss 0.127 and 0.142), reflecting an accuracy–calibration dissociation that we analyze in detail. However, Gemini and Grok experienced catastrophic convergence failures at Tier 3 (accuracy $$\approx $$ 0.58), revealing that over-specification of architectural and training constraints can destabilize CNN generation even when the produced scripts are syntactically valid. Higher prompt specificity does not consistently improve accuracy or validity rate. Instead, LLM identity interacts strongly with the prompt tier and emerges as a more critical factor than prompt design alone, although each LLM–tier condition is represented by a single generated script. Within the scope of this controlled, image-level evaluation, basic and structured prompting represent the recommended operating range for developing PPE compliance classifiers, delivering competitive accuracy and full validity rate across all models without the convergence failures observed at Tier 3. Validation in real industrial settings remains necessary.

Authors

Institutions

Publication Details

Journal
Discover Artificial Intelligence
Published
2026-10-17
DOI
https://doi.org/10.1007/s44163-026-02501-8
Primary Topic
Advanced Neural Network Applications
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Effect of hierarchical prompt engineering on convolutional neural networks generated by large language models for helmet wearing compliance classification

Jorge Rodas‐Silva, Jorge Antonio Párraga Álava
Discover Artificial Intelligence
Advanced Neural Network Applications
article

Effect of hierarchical prompt engineering on convolutional neural networks generated by large language models for helmet wearing compliance classification

Jorge Rodas‐Silva, Jorge Antonio Párraga Álava
article en

Abstract

Abstract Non-compliance with Personal Protective Equipment (PPE) use regulations, particularly helmet wearing, remains a critical occupational safety challenge in high-risk industrial environments. This study investigates how hierarchical prompt engineering shapes the quality of Convolutional Neural Networks (CNNs) generated by Large Language Models (LLMs) for image-level helmet-wearing compliance classification (helmet vs. no-helmet) as a mechanism for PPE compliance monitoring. Four LLMs (ChatGPT, Claude, Gemini, and Grok) produced executable PyTorch scripts across three prompt tiers of increasing specificity. These configurations were evaluated over 20 independent runs on a purpose-built dataset of 972 balanced images, using six classification metrics, four prompt quality metrics, and three resource efficiency dimensions. Ten of the twelve configurations converged to a high-performance plateau (accuracy 0.957-−0.967, AUC 0.985-−0.993). Claude at Tier 1 achieved the highest accuracy (0.967) and the lowest CPU usage (12.2%), whereas the best-calibrated (lowest-loss) pipelines were produced by Gemini and Grok at Tier 1 (test loss 0.127 and 0.142), reflecting an accuracy–calibration dissociation that we analyze in detail. However, Gemini and Grok experienced catastrophic convergence failures at Tier 3 (accuracy $$\approx $$ 0.58), revealing that over-specification of architectural and training constraints can destabilize CNN generation even when the produced scripts are syntactically valid. Higher prompt specificity does not consistently improve accuracy or validity rate. Instead, LLM identity interacts strongly with the prompt tier and emerges as a more critical factor than prompt design alone, although each LLM–tier condition is represented by a single generated script. Within the scope of this controlled, image-level evaluation, basic and structured prompting represent the recommended operating range for developing PPE compliance classifiers, delivering competitive accuracy and full validity rate across all models without the convergence failures observed at Tier 3. Validation in real industrial settings remains necessary.

Discover Artificial IntelligenceVol. 6(1)
Universidad Estatal de Milagro (EC), Universidad Técnica de Manabí (EC)
Good health and well-being
Openalex Percentile: Top 16%
Advanced Neural Network Applications
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.