Semi-formal modeling as foundation for hybrid model-driven and LLM-based code generation
Felix Schwägerl, Thomas Buchmann
Key points
From the paper's conclusion- A quantitative evaluation based on three scenarios shows that the semi-formal hybrid generation approach produces syntactically and behaviorally correct results.
Abstract
Model-driven software engineering (MDSE) generates executable code from models, but typically requires fully formal specifications that are costly to create and maintain, particularly for behavioral aspects. Large language models (LLMs) provide a flexible means to generate such behavior, yet their non-deterministic nature conflicts with the reproducibility and traceability expected in MDSE. This article presents a hybrid approach that combines object-oriented modeling with controlled LLM-based code generation. The approach is realized by MoProCo, a semi-formal modeling tool for UML-like class diagrams that contain natural-language behavioral specifications in addition to structural elements. The tool is primarily textual, rendering diagram visualization on demand. From these models, Java code skeletons are first generated deterministically, before behavioral fragments such as method bodies are synthesized by LLMs based on the natural-language behavioral specifications in a second step. In a human feedback phase, LLM-generated fragments can either be regenerated or be propagated back into the model, restoring determinism for subsequent regeneration cycles in order to reconcile LLM-based generation with model-driven principles. A quantitative evaluation based on three scenarios shows that the semi-formal hybrid generation approach produces syntactically and behaviorally correct results. It furthermore represents specifications more efficiently than both fully formal MDSE and manual coding, and reduces the complexity of specifications. While doing so, it requires less LLM runtime and generates fewer tokens. MoProCo considerably increases determinism when compared to black-box LLM-based development. In an additional application scenario, we demonstrate MoProCo’s practical feasibility by transferring the approach to REST backend applications and successfully reengineering a sample application of realistic extent.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- LLMs for Model-driven Engineering: A Systematic Literature ReviewACM Transactions on Software Engineering and Methodology · 2026
- Formal Modeling in Software Engineering with LLMs: A Systematic Literature ReviewarXiv · 2026
- Is there a future for models in the LLM era?arXiv · 2026
- Metamodel-Guided LLM Decoding for Consistent DSL GenerationarXiv · 2026
- Better Specifications, Better Code: Fine-Tuning LLMs for Behavioral Contract GenerationarXiv · 2026
- LLM ‐Based Domain Model Extraction From Requirements: A Case Study on Smart Tourism ApplicationsExpert Systems · 2026