Datasets:
The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
- 1. Three-Layer Verification Pipeline
- 2. Benchmark Dataset & Task Catalog (30 Custom SCL + Academic Subset)
- 3. Empirical Leaderboard (v0.2 Rescored — 468 Colab T4 Evaluations)
- 4. Hardware Guidance (RTX 5070 Ti Mobile 12 GB vs. 16 GB+ / MoE)
- 5. Installation & CLI Usage
- 6. Publishing to Hugging Face & Kaggle
- 7. License, Attribution & Commercial Use
PLC-LLM-Bench (v0.2)
An offline functional, compiler, and dialect benchmark evaluating open-weight LLMs on Siemens TIA Portal SCL and IEC 61131-3 Structured Text.
plc-llm-bench measures whether local models running on consumer/workstation GPUs (starting with an NVIDIA GeForce RTX 5070 Ti Mobile, 12 GB VRAM) can generate industrial automation FUNCTION_BLOCK logic that:
- Follows Siemens TIA Portal SCL conventions (
#varprefixing,{ pragmas }, double-quoted block names, standard IEC timers/counters), - Transpiles cleanly (
scl_to_iec) and compiles natively with MatIEC (iec2c) +gcc(zero syntax errors, plus 1-turn Pass@2 compiler self-repair), and - Passes deterministic multi-scan PLC simulation unit tests (
SCLFunctionBlock) across timers, edge triggers, PID loops, grid droop curves, ring buffers, arrays, motion homing, Modbus CRC-16, and 2oo3 voting.
1. Three-Layer Verification Pipeline
- Layer 1 — TIA Portal SCL Dialect Linter (
plc_bench.scl_normalizer.lint_scl) Scores structural adherence to Siemens TIA Portal SCL:FUNCTION_BLOCK/FUNCTIONheaders, double-quoted block identifiers,{ S7_Optimized_Access := 'TRUE' }/VERSION,#varlocal symbol references, and balancedVAR*/END_VARand block terminators. - Layer 2 — v0.2 Transpiler & Native Compiler (
plc_bench.scl_normalizer.scl_to_iec+plc_bench.compiler.compile_scl) Lowers TIA Portal SCL sugar into strict IEC 61131-3 Structured Text (BEGINstripping with trailing comments preserved,//comment stripping outside string literals, named built-in arguments such asLIMIT(MN:=..., IN:=..., MX:=...),=>FB output extraction,VAR_STAT/IEC_TIMERnormalization, andReal := int;coercion), then compiles throughMatIEC iec2c-> C ->gcc. If Pass@1 compilation fails, the exact compiler diagnostics are fed back for a 1-turn Pass@2 repair attempt. - Layer 3 — Multi-Scan Deterministic PLC Simulator (
plc_bench.scl_interp.SCLFunctionBlock) Executes the generatedFUNCTION_BLOCKacross dozens/hundreds of PLC scan cycles with deterministicscan_dt_mstime steps, simulatingTON/TOF/TP/IEC_TIMER,R_TRIG/F_TRIG,CTU/CTD,SR/RS,ARRAY[lo..hi],VAR_IN_OUT, bitwise masks /.%Xbit access,EXPT/ROL/ROR,CONTINUE/EXIT/RETURN, and control flow.
2. Benchmark Dataset & Task Catalog (30 Custom SCL + Academic Subset)
The exported dataset in dataset/plc_scl_tasks.jsonl contains 30 verified multi-scan Siemens SCL tasks across 5 industrial categories (6 tasks per category). All 30 reference solutions pass Layer 1 linting, native MatIEC iec2c + gcc compilation, and Layer 3 multi-scan assertions (tests/test_tasks.py).
Custom Siemens SCL Tasks (plc_bench/tasks_scl.py)
| Category | Task IDs | Function Blocks Tested | Key Capabilities Verified |
|---|---|---|---|
| Timers & State Machines | SCL-SM-01 .. SCL-SM-06 |
FB_MotorDOL, FB_StarDelta, FB_ConveyorJam, FB_PumpLeadLag, FB_BatchSequencer, FB_PackML_State |
Seal-in interlocks, TON star-delta dead-time, jam watchdog, edge-triggered lead/lag alternation, timed batch sequencer, PackML state transitions (EXECUTE/HOLDING/HELD/STOPPING/STOPPED) |
| Process & Analog Control | SCL-PC-01 .. SCL-PC-06 |
FB_Scale4to20mA, FB_LowPassEMA, FB_PID_AntiWindup, FB_RampLimiter, FB_SplitRange, FB_AnalogAlarmHyst |
Linear scaling + NAMUR NE43 wire-break fault, EMA filter, discrete PI/PID with conditional anti-windup, rate/slew limiter, heating/cooling split-range, HH/H/L/LL alarm hysteresis |
| Energy, BESS & Grid | SCL-EN-01 .. SCL-EN-06 |
FB_LFSM_Droop, FB_BESS_SafetyGuard, FB_Synchrocheck, FB_ModbusMap, FB_PV_BESS_Alloc, FB_QV_VoltVarDroop |
Frequency-watt LFSM-O/U droop, BESS SoC/cell-voltage/thermal derating + fault latch, grid synchrocheck window timer, IEEE-754/scaled Modbus word packing, PV/BESS dispatch allocation, Q(V) volt-var droop |
| Debug & Refactoring | SCL-BF-01 .. SCL-BF-06 |
FB_PulseCounterFix, FB_SafeLatchFix, FB_LadderToSCL, FB_FlowRatioSafe, FB_EnablePIFix, FB_DebounceTimerFix |
Double-counting bug fix via R_TRIG, unsafe reset priority fix (Stop/E-stop overrides Start), ladder-to-SCL refactor, divide-by-zero/clamp hardening, integrator reset on disable, TON-based contact debounce |
| Advanced Arrays, Motion & Voting | SCL-AD-01 .. SCL-AD-06 |
FB_MovingAvg4, FB_LeadLag3Pump, FB_AxisHomingSeq, FB_CRC16_ModbusWord, FB_Voter2oo3, FB_CascadeLoop |
4-sample ARRAY ring buffer average, runtime-balanced 3-pump selector, multi-step axis homing (WAIT_HOME/BACKOFF/DONE/FAULT), bitwise Modbus CRC-16 (0xA001), 2-out-of-3 analog sensor median voting with discrepancy alarm, outer-to-inner cascade loop |
Academic IEC 61131-3 Compile Subset
When cloned via --autoplc-dir and --agents4plc-dir, plc_bench/tasks_academic.py additionally evaluates models on 16 academic ST tasks sourced from AutoPLC and Agents4PLC_release using MatIEC iec2c + gcc compilation.
3. Empirical Leaderboard (v0.2 Rescored — 468 Colab T4 Evaluations)
All 13 models (Tier 1: 8 models <=12 GB VRAM; Tier 2: 5 models 12–16 GB / MoE) were executed on a Google Colab Tesla T4 (15,360 MiB VRAM) using llama-server (CUDA, q8_0 KV cache) over the 36-task v0.1 suite (20 custom SCL + 16 academic ST = 468 empirical evaluations) and re-scored cleanly with the v0.2 transpiler & simulator (rescore_checkpoint):
- Composite Score Formula (
plc_bench/report.py): $$\text{Composite} = 0.45 \cdot \text{Func P@1} + 0.25 \cdot \text{Func P@2} + 0.15 \cdot \text{Custom Compile P@1} + 0.10 \cdot \text{SCL Lint} + 0.05 \cdot \min(\text{tok/s}, 60)/60 \times 100$$
| Rank | Model | Tier | Quant | Func Pass@1 | Func Pass@2 | Compile P@1 | Compile P@2 | SCL Lint | Gen tok/s | Peak VRAM | RTX 5070 Ti Mobile Fit | Composite |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | gemma-4-26b-a4b | T2 | gemma-4-26B-A4B-it-UD-Q3_K_M.gguf |
65.0% | 85.0% | 50.0% | 80.0% | 71.2% | 35.6 | 12.37 GB | 12-16 GB / MoE Offload | 68.1 |
| 2 | qwen3.5-9b | T1 | Qwen3.5-9B-Q5_K_M.gguf |
35.0% | 60.0% | 45.0% | 80.0% | 38.6% | 33.5 | 6.00 GB | 100% VRAM (<=12 GB) | 44.1 |
| 3 | seed-coder-8b | T1 | Seed-Coder-8B-Instruct-Q6_K.gguf |
30.0% | 30.0% | 35.0% | 35.0% | 91.6% | 33.9 | 6.71 GB | 100% VRAM (<=12 GB) | 38.2 |
| 4 | qwen3-coder-30b-a3b | T2 | Qwen3-Coder-30B-A3B-Instruct-Q3_K_S.gguf |
25.0% | 25.0% | 50.0% | 70.0% | 84.8% | 49.1 | 12.83 GB | 12-16 GB / MoE Offload | 37.6 |
| 5 | granite-4.0-h-small | T2 | granite-4.0-h-small-Q3_K_S.gguf |
25.0% | 25.0% | 40.0% | 50.0% | 87.8% | 21.1 | 13.69 GB | 12-16 GB / MoE Offload | 34.0 |
| 6 | gpt-oss-20b | T2 | gpt-oss-20b-MXFP4.gguf |
20.0% | 30.0% | 40.0% | 55.0% | 67.8% | 44.3 | 11.02 GB | 100% VRAM (<=12 GB) | 33.0 |
| 7 | devstral-small-2-24b | T2 | Devstral-Small-2-24B-Instruct-2512-IQ4_XS.gguf |
15.0% | 20.0% | 45.0% | 65.0% | 77.8% | 13.8 | 12.52 GB | 12-16 GB / MoE Offload | 27.4 |
| 8 | gemma-4-e4b | T1 | gemma-4-E4B-it-Q4_K_M.gguf |
15.0% | 15.0% | 15.0% | 25.0% | 95.4% | 50.9 | 3.30 GB | 100% VRAM (<=12 GB) | 26.5 |
| 9 | qwen3-14b | T1 | Qwen3-14B-Q4_K_M.gguf |
10.0% | 25.0% | 35.0% | 75.0% | 71.2% | 24.8 | 9.02 GB | 100% VRAM (<=12 GB) | 25.2 |
| 10 | qwen2.5-coder-14b | T1 | qwen2.5-coder-14b-instruct-q4_k_m.gguf |
15.0% | 15.0% | 30.0% | 40.0% | 75.1% | 24.7 | 9.12 GB | 100% VRAM (<=12 GB) | 24.6 |
| 11 | gemma-4-12b | T1 | gemma-4-12b-it-Q4_K_M.gguf |
10.0% | 30.0% | 20.0% | 45.0% | 32.8% | 26.7 | 7.32 GB | 100% VRAM (<=12 GB) | 20.5 |
| 12 | deepseek-r1-distill-14b | T1 | DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.gguf |
5.0% | 5.0% | 20.0% | 25.0% | 72.2% | 24.5 | 9.12 GB | 100% VRAM (<=12 GB) | 15.8 |
| 13 | phi-4-reasoning-14b | T1 | Phi-4-reasoning-Q4_K_M.gguf |
0.0% | 10.0% | 20.0% | 25.0% | 52.9% | 25.2 | 9.32 GB | 100% VRAM (<=12 GB) | 12.9 |
Academic Dataset Subset (AutoPLC & Agents4PLC MatIEC Compile Check)
| Model | Tasks | Academic Compile P@1 | Academic Compile P@2 |
|---|---|---|---|
| gemma-4-26b-a4b | 16 | 18.8% | 18.8% |
| qwen3.5-9b | 16 | 6.2% | 25.0% |
| seed-coder-8b | 16 | 6.2% | 6.2% |
| qwen3-coder-30b-a3b | 16 | 31.2% | 31.2% |
| granite-4.0-h-small | 16 | 25.0% | 25.0% |
| gpt-oss-20b | 16 | 12.5% | 12.5% |
| devstral-small-2-24b | 16 | 12.5% | 18.8% |
| gemma-4-e4b | 16 | 12.5% | 18.8% |
| qwen3-14b | 16 | 31.2% | 31.2% |
| qwen2.5-coder-14b | 16 | 18.8% | 18.8% |
| gemma-4-12b | 16 | 12.5% | 12.5% |
| deepseek-r1-distill-14b | 16 | 6.2% | 12.5% |
| phi-4-reasoning-14b | 16 | 0.0% | 6.2% |
4. Hardware Guidance (RTX 5070 Ti Mobile 12 GB vs. 16 GB+ / MoE)
- Best Strictly <=12 GB Mobile GPU Fit (
qwen3.5-9b, Q5_K_M): Uses only 6.00 GB VRAM (leaving 6 GB headroom for TIA Portal / IDE), achieves 60.0% Func Pass@2, 80.0% Custom Compile P@2, and 33.5 tok/s. - Highest Overall Accuracy (
gemma-4-26b-a4b, UD-Q3_K_M): 65.0% Func Pass@1, 85.0% Func Pass@2, 80.0% Custom Compile P@2, and 35.6 tok/s at 12.37 GB peak VRAM (3.8B active parameters MoE). Fits 16 GB desktop/laptop GPUs cleanly or runs on 12 GB GPUs with minimal MoE expert CPU offload (-ot). - Best Sub-12 GB Dialect Adherence (
seed-coder-8b, Q6_K): 91.6% SCL lint score, 30.0% Func Pass@1, 6.71 GB VRAM, 33.9 tok/s. - Ultra-Fast Lightweight Draft Model (
gemma-4-e4b, Q4_K_M): 50.9 tok/s, 95.4% SCL lint score, 3.30 GB VRAM. - MoE vs. Dense Speed Advantage: Active-parameter MoEs (
qwen3-coder-30b-a3bat 49.1 tok/s,gpt-oss-20bat 44.3 tok/s,gemma-4-26b-a4bat 35.6 tok/s) outpace dense 24B (devstral-small-2-24bat 13.8 tok/s) by 2.6x–3.6x.
5. Installation & CLI Usage
Setup & Verification
pip install -e ".[dev]"
pytest -q
(Install MatIEC iec2c + gcc on Linux/WSL/Colab/Kaggle for native Layer 2 IEC 61131-3 compilation.)
Run Local GGUF Roster (llama-server)
# Quick smoke test on 1 model and 3 custom SCL tasks
python scripts/run_bench.py --smoke --models qwen3.5-9b
# Evaluate Tier 1 (<=12 GB) on all 30 custom SCL tasks
python scripts/run_bench.py --tier 1 --custom-only
# Evaluate Tier 2 (12–16 GB / MoE)
python scripts/run_bench.py --tier 2 --custom-only
Benchmark Any External OpenAI-Compatible Endpoint (Ollama, vLLM, LM Studio)
# Ollama example
python scripts/run_bench.py \
--api-url http://localhost:11434/v1 \
--api-model qwen3:14b \
--api-tier 1 \
--custom-only
# vLLM / LM Studio with reasoning prompt hint
python scripts/run_bench.py \
--api-url http://localhost:8000/v1 \
--api-model gemma-4-26b-a4b \
--api-tier 2 \
--api-reasoning \
--custom-only
Re-Score Existing Checkpoints Offline
# Via standalone wrapper (writes .jsonl.bak backup, updates checkpoint, regenerates reports)
python scripts/rescore_checkpoint.py results/checkpoint.jsonl --out-dir results
# Or via run_bench.py
python scripts/run_bench.py --rescore-only --checkpoint results/checkpoint.jsonl --out-dir results
Export Dataset & Regenerate Colab/Kaggle Notebook
python scripts/export_dataset.py
python scripts/make_notebook.py
6. Publishing to Hugging Face & Kaggle
Hugging Face Datasets
- Ensure
dataset/is freshly exported andREADME.md(with the YAML Dataset Card above) is at the repository root:pip install -U huggingface_hub hf auth login python scripts/export_dataset.py hf repos create iulio/plc-llm-bench --type dataset --exist-ok hf upload iulio/plc-llm-bench . . --repo-type dataset --exclude ".venv/**" --exclude "cell*" --exclude ".*_cache/**" --exclude "**/__pycache__/**" --exclude "*.egg-info/**"
Kaggle Datasets & Notebooks
- Configure
~/.kaggle/kaggle.json(orKAGGLE_API_TOKEN) for"id": "iulianamaricai/siemens-scl-iec61131-benchmark"indataset/dataset-metadata.json, then publish:pip install -U kaggle kaggle datasets create -p dataset - Upload
PLC_LLM_Bench_Colab.ipynbas a Kaggle Notebook (Accelerator: GPU T4 x2 or P100, Internet: On). The notebook automatically detects/kaggle/workingvs./contentand runs the full MatIEC +llama-serverpipeline end-to-end.
7. License, Attribution & Commercial Use
- Dataset & Benchmark License: Released under CC-BY-NC-SA-4.0 (Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International) — see LICENSE.
- Attribution: Academic researchers, students, and non-commercial practitioners may freely use, benchmark, and build upon this dataset with attribution to Iulian Amăricăi / CTRL ALT DELIGHTED S.R.L. (PLC-LLM-Bench).
- Commercial Licensing: Commercial use — including training or fine-tuning proprietary commercial LLMs, commercial product evaluation, or custom enterprise industrial SCL / IEC 61131-3 / AAS Digital Twin benchmark suites — requires a separate commercial license from CTRL ALT DELIGHTED S.R.L. (Romania; creators of TwinForge AI and NexusControl Studio).
- Downloads last month
- 76
