Saved in:
Bibliographic Details
Main Authors: Fakih, Mohamad, Dharmaji, Rahul, Moghaddas, Yasamin, Araya, Gustavo Quiros, Ogundare, Oluwatosin, Faruque, Mohammad Abdullah Al
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2401.05443
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911754497294336
author Fakih, Mohamad
Dharmaji, Rahul
Moghaddas, Yasamin
Araya, Gustavo Quiros
Ogundare, Oluwatosin
Faruque, Mohammad Abdullah Al
author_facet Fakih, Mohamad
Dharmaji, Rahul
Moghaddas, Yasamin
Araya, Gustavo Quiros
Ogundare, Oluwatosin
Faruque, Mohammad Abdullah Al
contents Although Large Language Models (LLMs) have established pre-dominance in automated code generation, they are not devoid of shortcomings. The pertinent issues primarily relate to the absence of execution guarantees for generated code, a lack of explainability, and suboptimal support for essential but niche programming languages. State-of-the-art LLMs such as GPT-4 and LLaMa2 fail to produce valid programs for Industrial Control Systems (ICS) operated by Programmable Logic Controllers (PLCs). We propose LLM4PLC, a user-guided iterative pipeline leveraging user feedback and external verification tools including grammar checkers, compilers and SMV verifiers to guide the LLM's generation. We further enhance the generation potential of LLM by employing Prompt Engineering and model fine-tuning through the creation and usage of LoRAs. We validate this system using a FischerTechnik Manufacturing TestBed (MFTB), illustrating how LLMs can evolve from generating structurally flawed code to producing verifiably correct programs for industrial applications. We run a complete test suite on GPT-3.5, GPT-4, Code Llama-7B, a fine-tuned Code Llama-7B model, Code Llama-34B, and a fine-tuned Code Llama-34B model. The proposed pipeline improved the generation success rate from 47% to 72%, and the Survey-of-Experts code quality from 2.25/10 to 7.75/10. To promote open research, we share the complete experimental setup, the LLM Fine-Tuning Weights, and the video demonstrations of the different programs on our dedicated webpage.
format Preprint
id arxiv_https___arxiv_org_abs_2401_05443
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LLM4PLC: Harnessing Large Language Models for Verifiable Programming of PLCs in Industrial Control Systems
Fakih, Mohamad
Dharmaji, Rahul
Moghaddas, Yasamin
Araya, Gustavo Quiros
Ogundare, Oluwatosin
Faruque, Mohammad Abdullah Al
Software Engineering
Artificial Intelligence
Computation and Language
Programming Languages
D.2.4; I.2.7; I.2.2
Although Large Language Models (LLMs) have established pre-dominance in automated code generation, they are not devoid of shortcomings. The pertinent issues primarily relate to the absence of execution guarantees for generated code, a lack of explainability, and suboptimal support for essential but niche programming languages. State-of-the-art LLMs such as GPT-4 and LLaMa2 fail to produce valid programs for Industrial Control Systems (ICS) operated by Programmable Logic Controllers (PLCs). We propose LLM4PLC, a user-guided iterative pipeline leveraging user feedback and external verification tools including grammar checkers, compilers and SMV verifiers to guide the LLM's generation. We further enhance the generation potential of LLM by employing Prompt Engineering and model fine-tuning through the creation and usage of LoRAs. We validate this system using a FischerTechnik Manufacturing TestBed (MFTB), illustrating how LLMs can evolve from generating structurally flawed code to producing verifiably correct programs for industrial applications. We run a complete test suite on GPT-3.5, GPT-4, Code Llama-7B, a fine-tuned Code Llama-7B model, Code Llama-34B, and a fine-tuned Code Llama-34B model. The proposed pipeline improved the generation success rate from 47% to 72%, and the Survey-of-Experts code quality from 2.25/10 to 7.75/10. To promote open research, we share the complete experimental setup, the LLM Fine-Tuning Weights, and the video demonstrations of the different programs on our dedicated webpage.
title LLM4PLC: Harnessing Large Language Models for Verifiable Programming of PLCs in Industrial Control Systems
topic Software Engineering
Artificial Intelligence
Computation and Language
Programming Languages
D.2.4; I.2.7; I.2.2
url https://arxiv.org/abs/2401.05443