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

Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMs

Xing Xing, Wei Wang, Lipeng Ma, Weidong Yang, Junjie ZhengarXiv 2025 · DOI

Introduction

While Large Language Models (LLMs) have demonstrated remarkable proficiency in generating isolated code snippets, they frequently struggle with "system-level" programming tasks that require complex, state-driven logic. Most current models employ a "single-step" approach, transitioning directly from a natural language prompt to executable code. This methodology often bypasses established Software Engineering (SE) principles, leading to logic hallucinations, poor modularity, and fragile error handling. To address this, researchers have introduced a "lifecycle-aware" framework that structures LLM reasoning through traditional SE phases: requirements, architecture, and design.

The Lifecycle-Aware Framework

The core of this research is a multi-stage generation pipeline that decomposes the coding process into four verifiable stages. Instead of jumping to implementation, the model is guided through a structured chain of thought that mimics human engineering practices.

The lifecycle-aware framework decomposes code generation into four distinct stages: Requirements Analysis, Architectural Design (SCXML), Detailed Design (Pseudo-code), and final Code Generation.

The four stages are:

  1. Requirements Analysis: Translating high-level user intent into detailed, structured specifications.
  2. Architectural Design: Converting requirements into State Chart XML (SCXML), providing a formal model for system states.
  3. Detailed Design: Translating declarative SCXML into imperative, language-agnostic pseudocode.
  4. Code Generation: Converting the pseudocode into final executable Python.

Methodology and Data

To train models in this structured approach, the authors developed a specialized dataset of 4-tuples (Intent, Requirements, SCXML, Pseudocode, Code). Data was sourced from rigorous aviation standards (RTCA/DO-185B), industrial state machine platforms (XState, Simulink), and synthetic expansion using GPT-4o to reverse-engineer requirements from high-quality codebases.

The models, including DeepSeek-Coder and Qwen-2.5, were fine-tuned using Low-Rank Adaptation (LoRA). This process allowed the models to internalize the hierarchical dependencies between high-level goals and low-level implementation details.

Key Results and Insights

The structured lifecycle approach yielded significant performance gains:

  • Correctness Improvements: Fine-tuning with lifecycle artifacts improved code correctness by up to 75% compared to base models.
  • Competitive Performance: A fine-tuned 1.3B parameter model (DeepSeek-Coder) outperformed much larger models, achieving a 20% improvement in CodeBLEU over ChatGPT-4o-mini.
  • The Role of Architecture: Ablation studies identified the SCXML (state machine modeling) phase as the most critical component. Without this formal structural scaffolding, the model's ability to handle complex logic decreased significantly.
  • Generalist vs. Specialist Models: General-purpose models like Qwen-2.5 often outperformed code-specific models in the early, language-heavy stages of the pipeline, highlighting the importance of linguistic reasoning in software design.

Conclusion and Future Work

The "lifecycle-aware" approach demonstrates that how a model reasons is often more critical than its parameter count. By enforcing a structured software engineering process, even smaller models can produce robust, complex logic that rivals or exceeds the output of state-of-the-art generalist models.

However, challenges remain. The multi-stage process increases latency, making it less ideal for real-time autocompletion. Additionally, errors in early stages (like requirements) can propagate through the pipeline. Future research will focus on integrating automated verification tools at each stage and expanding the framework beyond state-machine-based systems to other programming paradigms.

Summary updated

BibTeX
@misc{xing2025lifecycle,
  author = {Xing Xing and Wei Wang and Lipeng Ma and Weidong Yang and Junjie Zheng},
  title = {{Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMs}},
  year = {2025},
  eprint = {2510.24019},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.24019},
}
Figure