Trace2ST:结合大语言模型生成与验证,从I/O轨迹中恢复PLC结构化文本
Trace2ST: Recovering PLC Structured Text from I/O Traces with LLM Generation and Verification
AI总结:
本文提出Trace2ST流水线,结合LLM生成与验证,从PLC的I/O轨迹恢复结构化文本程序,在基准测试与真实水处理数据中表现优异,优于经典自动机学习方法。
摘要:
可编程逻辑控制器(PLC)是运行电力与过程工厂的工业计算机,其程序源代码往往不再可用,但控制器的每一项输入和输出都会被持续记录。因此本文探究:大语言模型(LLM)能否仅通过此类输入/输出记录(轨迹)恢复出IEC 61131-3标准的PLC标准语言结构化文本(ST)可执行程序,以及同等重要的是,如何对恢复出的程序进行验证。为回答该问题,本文构建了生成-重放-反馈流水线:首先,LLM从轨迹的压缩摘要中编写候选程序,全程不查看原始程序;随后,该候选程序按单个控制周期(扫描)执行并与记录比对,每当出现不匹配时,就将轨迹的对应部分返回给LLM,最多进行三次修正。由于所有结果依赖于执行候选程序的软件,本文先针对两个独立的开源PLC运行时验证该流水线,未发现无法解释的差异。在此基础上,本文评估了两个公共基准中的47个第三方程序:恢复出的程序在43个案例中完全复现了记录的轨迹,对于未见过的输入,在94%的扫描中与原始程序一致;剩余错误大多出现在轨迹从未执行过的程序分支中,一旦添加针对这些分支的轨迹,未见过的对抗性输入的一致性就从0.80提升至0.98。相比之下,不含LLM的经典自动机学习基线虽能拟合记录,但在未见过的输入上仅达到0.40,这表明恢复程序结构才是难点。最后,在来自公共水处理测试台的真实数据中,恢复出的控制律与未见过的测量值高度匹配(R²>0.99),并检测出数据集中唯一的执行器攻击。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。