--- license: apache-2.0 tags: - code-generation - plc - iec-61131-3 - structured-text - gemma - phi - industrial-automation --- # PLC Code Generation Models (IEC 61131-3) This repository contains fine-tuned checkpoints for generating Programmable Logic Controller (PLC) code in **Structured Text (IEC 61131-3)** format. These models have been explicitly trained and benchmarked for air-gapped, edge-hardware deployments in industrial settings. ## Models Included This repository hosts weights for two distinct model families: ### 1. Gemma 3 (4B) - `Gemma3-PLC-4B/` A fine-tuned version of Google's Gemma 3 (4B parameter) model. It was fine-tuned for high-accuracy complex logic generation and benchmarked for latency and throughput on edge GPUs (e.g., NVIDIA A4000). - **Folders Included**: `model_merged`, `model_merged_hacked`, and intermediate `checkpoints_*`. ### 2. Phi - `Phi-PLC-Lora/` A highly efficient fine-tune of Microsoft's Phi model. Provided as both merged weights and standalone LoRA adapters. - **Folders Included**: `model_phi_merged`, `model_phi_lora`. ## Intended Use - **Task**: Natural Language to PLC Structured Text (IEC 61131-3). - **Environment**: Optimized for local, on-premise edge inference where internet access is restricted (air-gapped factory environments). - **Users**: Control Systems Engineers, Automation Programmers, and Robotics Researchers. ## Training Data The models were trained on a highly curated dataset consisting of: - Standardized open-source PLC libraries (e.g., OSCAT). - Custom verified industrial control logic datasets. ## Benchmarking & Performance These models were evaluated against zero-shot baselines for both generation accuracy and inference speed. They achieve state-of-the-art performance for localized IEC 61131-3 generation, significantly outperforming base models on complex automation tasks. Detailed benchmarking scripts and data parsing logic can be found in the associated GitHub repository.