Designing Safer LLM Architectures for Industrial Control Systems

Designing Safer LLM Architectures for Industrial Control Systems

Every vendor deck now promises "AI-powered plant optimization". The pressure to connect a language model to live process data is real, and the temptation is to give the agent a tool like write_tag(name, value) and let it optimize. That design is a category error. In a chat app, a hallucination produces a wrong sentence. In a plant, the same failure can produce a wrong setpoint: a tank over-filled, a motor over-driven, a temperature outside its safe band. Industrial engineering already has a strong culture for this problem. Safety systems are independent of control systems, networks are segmented into zones, and changes go through authorization. The goal of this article is to show how to fit an LLM into that culture, not to bypass it. The Core Principle The plant must remain safe, and keep running as designed, with the AI layer completely unplugged. If removing the AI breaks safety, the AI is in the wrong place. This principle drives every decision below: The model advises; deterministic layers decide. Every write passes through independent checks, and the final check lives in the PLC. Failure of the AI layer must be "fail-static": the process keeps its current, last-known-good behavior. Why LLMs Are a Special Risk in OT LLM failures differ from classic software failures in ways that matter for control systems. Hallucination. The model can produce a confident, well-formatted, entirely wrong value. Prompt injection. Anything the model reads is a potential instruction channel. In an industrial setting that includes maintenance notes, work orders, vendor PDFs, alarm descriptions, and operator comments. If an attacker, or a careless colleague, can influence that text, they can influence the model. Non-determinism. The same input can yield different outputs, which makes commissioning-style validation harder. Opacity. You can't inspect a chain of reasoning the way you can read ladder logic or a function block. None of this means "never use LLMs". It means treating the model like an untrusted, talented, occasionally confused junior engineer who is not allowed to touch the controls, only to recommend. A Layered Architecture IT / analytics side OT / control side ───────────────────────────────────────────────────────────────────────── Historian (read-only copy) ─► LLM advisor │ structured proposal (schema-validated) ▼ Proposal validator (deterministic: allowlist, bounds, │ rate limits, plant-state checks) ▼ Human approval (required above a risk threshold) │ ▼ Write gateway (narrow, authenticated, logged) ─────────────────────── zone boundary / firewall ─────────────────────── ▼ PLC setpoint guard (final clamp, in controller logic) ▼ Control loop ◄── independent safety system (untouched) Each layer assumes the one above it may be wrong. Layer 1: Read-only access to a copy of the data Give the model data from the historian or a replicated data store, not a live connection to the control network. Data should flow outward from the control side, and a unidirectional or tightly firewalled path is preferable. Segmenting networks into zones and controlling the conduits between them is the core idea behind industrial cybersecurity standards such as IEC 62443. The model then has nothing to write to. Layer 2: A narrow, structured proposal format The model's output is not free text and not a command. It is a small structured proposal: from dataclasses import dataclass @dataclass class Proposal: tag: str # which setpoint value: float # proposed new value rationale: str # human-readable only, never parsed or executed The rationale field is for the human reviewer. Software never interprets it as instructions. Layer 3: A deterministic validator This is plain code you can test exhaustively. It should be boring, and it should say no by default. import math, time from dataclasses import dataclass @dataclass(frozen=True) class TagPolicy: lo: float # hard lower limit hi: float # hard upper limit max_step: float # max change allowed per write min_interval_s: float # minimum time between writes auto_band: float # changes this small may auto-apply POLICY = { 'TIC_101.SP': TagPolicy(lo=60.0, hi=85.0, max_step=2.0, min_interval_s=300, auto_band=0.5), } @dataclass class Decision: verdict: str # 'reject' | 'needs_approval' | 'auto_apply' reasons: list def validate(p, plant, last_write, now=None): now = now if now is not None else time.time() pol = POLICY.get(p.tag) if pol is None: return Decision('reject', ['tag is not on the allowlist']) if not isinstance(p.value, (int, float)) or not math.isfinite(p.value): return Decision('reject', ['value is not a finite number']) if not plant['auto_mode']: return Decision('reject', ['loop is not in automatic mode']) if plant['alarm_active'] or not plant['safety_ok']: return Decision('reject', ['abnormal plant state']) if not (pol.lo pol.max_step: return Decision('reject', [f'step {step:.2f} exceeds max {pol.max_step}']) if now - last_write.get(p.tag, 0.0) HiLimit) OR (ABS(Requested - Active) > MaxStep) THEN Rejected := TRUE; // keep the previous Active value ELSE Active := Requested; END_IF; The Python validator and this function block deliberately duplicate each other. Redundancy is the point: the validator gives fast, descriptive feedback, and the PLC logic gives you a guarantee that survives a bug or compromise in the software above it. Treat this as a sketch. Test any real implementation in simulation, and follow your site's change-management and commissioning procedures before it goes near a live process. Independent safety, untouched Notice what is not in the diagram's data path: the safety system. Functional safety standards (IEC 61508 and, for the process industry, IEC 61511) are built on the idea that safety instrumented functions are independent of the basic process control system. An AI advisor must not be wired into, depend on, or be able to modify that layer. Whatever the AI does, the safety layer must still do its job on its own. Defending Against Prompt Injection in Plant Data Because the model reads plant-adjacent text, treat that text as hostile: Separate instructions from data. Maintenance notes, tag descriptions, and external documents are data. Never let them be interpreted as commands. Limit what text reaches the model. Don't feed in free-form content from untrusted sources just because it is available. Don't let the model's output trigger anything on its own. It is routed through the validator no matter what the text says. Remember the architecture is your real defense. If the model is successfully tricked into proposing something dangerous, the validator, the approval step, and the PLC guard should each independently refuse. You are designing for the case where the model has been fooled. Rolling It Out Safely Shadow mode first. The AI generates proposals that are logged, but nothing is applied. Compare them with what experienced operators actually did. Measure before trusting. Track how often proposals are valid, how often operators approve them, and how often they would have been harmful or useless. Start with the lowest-risk loops, where limits are wide and consequences are mild, and expand slowly. Keep a human-visible audit trail. Every proposal, verdict, approval, and write is recorded, so incidents can be reconstructed. Rehearse failure. Disable the AI layer on purpose and confirm the plant carries on normally. This is the "unplugged" test from the core principle. Where the Model Does Add Value Plenty of useful work needs no write access at all: Summarizing alarm floods into a readable shift summary Drafting maintenance reports and handover notes Explaining historical trends in plain language Searching manuals and procedures Suggesting setpoint changes for a human to evaluate These deliver real value with a far smaller blast radius. Start there. Conclusion The question isn't whether AI belongs in industrial automation. It's where the trust boundary sits. Treat the LLM as an advisor on the far side of a hard line, force every proposal through deterministic checks, make the PLC the final authority, and keep safety systems completely independent. Do that, and the model's mistakes become annoying proposals that get rejected, instead of incidents. In control systems, that difference is the whole game.

Original Source

Read the full article at Hackernoon →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.