From Hazard Identification to Controller Design: Proactive and LLM-Supported Safety Engineering for ML-Powered Systems

Yining Hong, Christopher Steven Timperley, Christian Kästner

Modern software engineering is facing a growing crisis: the "unintended consequences" of machine learning (ML) systems. While developers often treat model failures—such as social bias, privacy leaks, or hallucinations—as unpredictable "black swan" events, researchers at Carnegie Mellon University argue that these harms are often foreseeable. In this position paper, the authors propose a shift from reactive patching to proactive safety engineering, utilizing Large Language Models (LLMs) to bridge the gap between rigorous safety frameworks and fast-paced software development.

The Problem: Reactive and Model-Centric Safety

Most current ML safety efforts focus almost exclusively on the model itself—for example, by cleaning training data or fine-tuning weights. However, this "model-centric" approach ignores the broader system-level controls that can prevent a flawed model output from becoming a real-world harm.

Traditional safety engineering frameworks, such as System-Theoretic Process Analysis (STPA), are designed to look at the entire system. Yet, STPA has historically seen little adoption in the ML world due to three primary barriers:

  1. Expertise Gap: It requires specialized safety engineers that most software teams lack.
  2. Resource Intensity: The process is labor-intensive and slow, clashing with agile development cycles.
  3. Scope: Traditional safety often focuses on physical harm, whereas ML systems frequently cause "soft" harms like polarization or loss of user trust.

Methodology: LLM-Supported STPA

The authors propose a lightweight version of STPA, augmented by GPT-4o, to help developers identify and mitigate risks proactively. The methodology follows a four-step top-down approach:

  1. Define Purpose: Identify direct and indirect stakeholders and potential "losses." This expands the definition of safety to include social and ethical harms.
  2. Model Control Structure: Map the system's control hierarchy, including the model, data scientists, automated safeguards, and the user interface.
  3. Identify Unsafe Control Actions (UCAs): Analyze how control actions might fail—for instance, what happens if a safety filter is absent or triggered too late?
  4. Identify Loss Scenarios: Determine the root causes of these unsafe actions to guide the design of system-level mitigations.

The "LLM-as-Copilot" Twist

By using GPT-4o to brainstorm stakeholders, losses, and hazards, the authors demonstrate that a developer can generate a massive "risk surface" map in minutes. This allows the LLM to handle the high-volume brainstorming, while the human developer focuses on refining and prioritizing the results.

Case Study: AllTrails GPT Assistant

To demonstrate the framework, the authors applied it to a customized GPT assistant based on AllTrails, a trail recommendation service. The goal was to identify potential hazards in a system that recommends outdoor activities to users.

Key Results: * Scale: The LLM identified 20 stakeholders and 145 distinct losses. * Granularity: The process generated 1,159 potential hazards across those losses. * Efficiency: The entire analysis was completed in minutes for under $2 USD in API costs. * Actionability: Human oversight condensed the raw LLM output into 50 distinct, manageable categories, leading to concrete design requirements, such as "The system must not recommend trails in ecologically sensitive areas."

Key Insights and Ideas

"Unintended" is not "Unpredictable"

Many social and ethical harms of ML can be anticipated if developers use a structured "backward-looking" approach—starting from the potential harm and working back to the system design. The authors argue that the industry must stop treating these failures as surprises.

The Power of the "Controller"

Safety is not just about making a "perfect" model; it is about building a system that can safely handle an imperfect model. This includes system-level controllers like UI constraints (e.g., "Are you sure?" prompts), trend monitoring, and human-in-the-loop checkpoints.

Broadening the Scope of Loss

By applying STPA to an ML context, the researchers successfully moved beyond physical safety to address "soft" harms. Their analysis included risks such as community polarization, deskilling of outdoor enthusiasts, and the loss of personalization.

Limitations and Future Work

While promising, the authors note that LLMs are not a total replacement for human judgment. There is a risk of over-reliance, where developers might treat LLM-generated lists as exhaustive. Furthermore, LLMs can perform superficial analyses if not prompted correctly.

Future research will focus on creating a "Pattern Catalog" of common system-level controllers—standardized mitigation strategies that developers can easily integrate into their designs once a hazard is identified. This would further lower the barrier to entry for rigorous safety engineering in the ML era.

Summary updated

BibTeX
@inproceedings{hong2025from,
  author = {Yining Hong and Christopher Steven Timperley and Christian Kästner},
  title = {{From Hazard Identification to Controller Design: Proactive and LLM-Supported Safety Engineering for ML-Powered Systems}},
  booktitle = {CAIN},
  year = {2025},
  doi = {10.1109/cain66642.2025.00021},
}
Figure