LLM-generated CNNs for helmet-wearing compliance classification under different prompt tiers

Source article: 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, Gemi…

Effect of hierarchical prompt engineering on convolutional neural networks generated by large language models for helmet wearing compliance classification
"Construction Safety Hard Hat Helmet Edited 2020" by chimpwithcan is licensed under CC BY 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by/2.0/.
Trace impact readingContested
P 66The P score combines the specificity and measured human impact of the grounded problem claim with the strength of this Trace’s cited sources.

Both sides are scored from claims and sources, not community votes.

G 66The G score combines the specificity and measured human impact of the grounded gain claim with the strength of this Trace’s cited sources.

In brief

Researchers asked four large language models, ChatGPT, Claude, Gemini and Grok, to write PyTorch code for convolutional neural networks that sort images into helmet and no-helmet. Each model was prompted at three levels of specificity, and the resulting pipelines were tested over 20 runs on a purpose-built set of 972 balanced images.

The work matters because helmet non-compliance is a persistent occupational safety problem, and LLM-written classifiers could lower the effort of building monitoring tools. The results suggest that which model is used matters more than how detailed the prompt is. Each model-and-tier condition rests on a single generated script, and real industrial validation is still needed.

Main points

  1. Ten of twelve model-and-prompt configurations reached accuracy of 0.957 to 0.967 and AUC of 0.985 to 0.993.
  2. Claude at Tier 1 achieved the highest accuracy (0.967) and the lowest CPU usage (12.2%).
  3. Gemini and Grok at Tier 1 produced the best-calibrated pipelines, with test loss of 0.127 and 0.142.
  4. Gemini and Grok at Tier 3 fell to accuracy of about 0.58 despite syntactically valid scripts.
  5. Higher prompt specificity did not consistently improve accuracy or validity rate.

The gain

Basic and structured prompts led four LLMs to generate working helmet-compliance classifiers that reached high accuracy on a controlled image test set.

The problem

Over-specified Tier 3 prompts caused Gemini and Grok to generate CNNs that failed to converge, so more detailed prompting is not reliably better.

The rundown

The study evaluated four LLMs across three prompt tiers of increasing specificity, giving twelve configurations. Each was scored with six classification metrics, four prompt quality metrics and three resource efficiency dimensions on image-level helmet versus no-helmet classification.

Accuracy and calibration did not coincide. Claude led on accuracy while Gemini and Grok at Tier 1 had the lowest test loss, which the authors describe as an accuracy-calibration dissociation.

The authors found that LLM identity interacts strongly with prompt tier and appears more critical than prompt design alone. They recommend basic and structured prompting, which delivered competitive accuracy and full validity rate across all models.

What this doesn’t fix

Each LLM-tier condition is represented by a single generated script, the evaluation is controlled and image-level, and validation in real industrial settings is still required.

Sources

  1. Peer-reviewedDiscover Artificial Intelligence2026-10-17

The debate