NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

LLM as a code generator in Agile Model Driven Development

Ahmed R. Sadik, Sebastian Brulin, Markus Olhofer · DOI

TL;DR

This paper proposes an Agile Model-Driven Development (AMDD) framework that uses GPT-4 as a universal code generator, bridging the gap between high-level architectural models and deployable software. By enriching standard UML diagrams with formal constraints (OCL and FIPA-ontology), the authors reduce the ambiguity of LLM prompts, enabling the generation of complex, multi-platform multi-agent systems that are structurally sound and behaviorally consistent.

What Problem Does This Paper Address?

Large Language Models (LLMs) like GPT-4 are excellent at writing snippets of code, but they struggle with "big picture" software architecture. When given vague natural language descriptions, LLMs often produce incomplete or non-deployable artifacts.

Conversely, Model-Driven Development (MDD)—where developers create visual models (like UML) to generate code—is precise but rigid. Traditionally, MDD requires engineers to write and maintain custom "code generators" for every specific programming language or framework used. This is time-consuming and defeats the purpose of "agile" development. The authors seek to solve this by using GPT-4 as a "universal" generator that can interpret formal models and output ready-to-run code in multiple languages without the need for manual template writing.

Methods

The authors developed a layered AMDD approach:

  1. Modeling Layer: They designed a Multi-Agent System (MAS) for an Unmanned Vehicle Fleet (UVF) using the Unified Modeling Language (UML). This included structural (class diagrams) and behavioral (activity and state diagrams) views.
  2. Metamodel Layer (The "Secret Sauce"): To remove the ambiguity that plagues natural language, they added two formal constraint layers:
  3. Object Constraint Language (OCL): Defines strict rules for code construction (e.g., "a vehicle must be idle to accept a task").
  4. FIPA-ontology: A standard for agent communication, ensuring different software components "speak the same language."
  5. Translation: They used PlantUML to convert these visual diagrams into a formal text representation that GPT-4 can process as a prompt.
  6. Generation: GPT-4 was tasked with generating code for two different environments: Java (using the JADE framework) and Python (using the PADE framework).

Datasets

The study does not use a standard public dataset. Instead, it utilizes a custom-designed Unmanned Vehicle Fleet (UVF) case study. This model includes various agent classes:

  • Operator: Dispatches missions.
  • Mission Control Center (MCC): Coordinates the fleet.
  • UVF-Manager: Allocates tasks.
  • Unmanned Vehicles (UVs): Includes UAVs (air), UGVs (ground), and USVs (surface).

Key Insights and Ideas

  • Models as "Prompt Engineering" on Steroids: Instead of trying to describe a complex system in English, the authors use formal models as the prompt. This provides the LLM with a structured "contract" that drastically reduces "hallucinations" or architectural errors.
  • GPT-4 as an "Intelligent" Generator: Unlike traditional code generators that follow rigid templates, GPT-4 showed the ability to complement the model. For example, it autonomously added a "discovery" phase where the controller identifies available vehicles—a logical step that was implicit but not explicitly drawn in the original activity diagrams.
  • The Complexity Trade-off: Adding more constraints (like the FIPA-ontology) naturally increases the complexity of the generated code. However, the authors found that even with these additions, the code remained well within "low-risk" thresholds for maintainability.

Key Results

  • Code Quality: The generated code was nearly deployable out of the box, averaging only four bugs per agent class, most of which were simple missing library imports.
  • Structural Soundness: The authors measured Cyclomatic Complexity (M)—a metric for how "tangled" code is. All generated classes scored between 2 and 6. In software engineering, anything under 10 is considered "low risk" and easy to maintain.
  • Cross-Platform Consistency: Despite being written in different languages (Java vs. Python), the agents generated by GPT-4 exhibited identical behaviors and successfully followed the communication protocols defined in the metamodel.

Limitations and Future Work

  • Human-in-the-Loop: The process isn't 100% automated yet; a developer is still needed to fix minor bugs (like the aforementioned missing imports) and validate the deployment.
  • Narrow Scope: The approach was tested on a single, albeit complex, multi-agent system. Its performance on other types of software architectures (like microservices or monolithic web apps) remains to be seen.
  • Future Directions: The authors plan to integrate privacy and cybersecurity metamodels to see if GPT-4 can automatically bake security constraints into the generated code. They also aim to automate the "correctness" checking of the code to further reduce human intervention.

Summary updated

BibTeX
@misc{sadik2024llm,
  author = {Ahmed R. Sadik and Sebastian Brulin and Markus Olhofer},
  title = {{LLM as a code generator in Agile Model Driven Development}},
  year = {2024},
  eprint = {2410.18489},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.18489},
}
Figure