跳到正文
arXiv cs.CY· Hsi Chang, Irfan Khan·· 9 小时前AI 评分34

Trace2ST:用 LLM 生成与验证从 I/O 轨迹恢复 PLC 结构化文本

Trace2ST: Recovering PLC Structured Text from I/O Traces with LLM Generation and Verification

AI 导读

Trace2ST 提出“生成-回放-反馈”流水线,让 LLM 仅凭 PLC 的 I/O 轨迹记录、在不见源码的情况下写出可执行的 Structured Text 程序,并通过逐扫描周期回放比对、最多三轮修订来验证。

正文 · 原文

View PDF HTML (experimental)

Abstract:Programmable logic controllers (PLCs), the industrial computers that operate power and process plants, often run programs whose source code is no longer available; however, every input and output of the controller is logged continuously. This paper therefore asks whether a large language model (LLM) can recover an executable program in Structured Text (ST), the standard PLC language of IEC 61131-3, from such input/output records (traces) alone and, equally important, how the recovered program can be verified. To answer this question, we build a generate-replay-feedback pipeline. First, the LLM writes a candidate program from a compressed summary of the trace, without ever seeing the original program. The candidate is then executed one control cycle (scan) at a time and compared with the recording, and whenever a mismatch occurs the corresponding part of the trace is returned to the LLM, for at most three revisions. Because every result depends on the software that executes the candidates, we first validate it against two independent open-source PLC runtimes and find no unexplained difference. On this basis, we evaluate 47 third-party programs from two public benchmarks. The recovered programs reproduce the recorded trace exactly in 43 cases and agree with the original on 94% of scans for unseen inputs. The remaining errors, however, lie mostly in program branches that the trace never exercised; once a trace that targets these branches is added, agreement on unseen adversarial inputs rises from 0.80 to 0.98. By contrast, a classical automata-learning baseline without an LLM fits the recording but falls to 0.40 on unseen inputs, which indicates that recovering program structure is the hard part. Finally, on real data from a public water-treatment testbed, the recovered control laws match unseen measurements closely ($R^2 > 0.99$) and expose the only actuator attack in the dataset.
Comments: 6 pages, 3 figures, 4 tables. Submitted to the 2027 IEEE Texas Power and Energy Conference (TPEC 2027)
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Computers and Society (cs.CY); Programming Languages (cs.PL); Systems and Control (eess.SY)
Cite as: arXiv:2611.24979 [cs.SE]
  (or arXiv:2611.24979v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2611.24979

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Hsi Chang [view email]
[v1] Tue, 17 Nov 2026 19:57:11 UTC (36 KB)

来源:arXiv cs.CY · arxiv.org