Programmable logic controllers (PLCs) are the backbone of industrial automation, and while large language models (LLMs) can generate individual program organization units (POUs) for them, ensuring that this logic integrates seamlessly into existing projects and runs correctly has remained a challenge. A new paper introduces SemaPLC, a project-grounded and verification-gated agent harness designed to address this gap.
Unlike conventional approaches that stop when the model deems its output adequate, SemaPLC declares a task complete only after logged external checks confirm the specification, compilation, and behavior on a live runtime. This strict completion rule ensures that generated logic is not just syntactically correct but functionally verified.
In evaluations on 117 independent-POU tasks, SemaPLC achieved the highest strict verified pass rate across all seven tested models, with a mean of 72.6%. On a more challenging project-context track of 65 tasks, where generated logic must compile and run inside a real project, it also attained the highest mean for integrated compilation, static behavior, and dynamic behavior.
The most striking results came from dynamic behavior testing, where generated and reference logic were deployed to a live PLC runtime and their executed traces compared. While all methods fell within 10 static points of each other, dynamic scores separated them sharply: baselines scored between 22.4 and 31.4, while SemaPLC achieved 52.2. This underscores the paper's central claim: execution, not static scoring, is the faithful test of whether generated control logic actually works.
SemaPLC is open-sourced and includes a browser-based IDE for generating, editing, verifying, and simulating programs. The project is available at GitHub with documentation at midea-ai.github.io/SemaPLC.