用大模型从文字需求自动生成微服务架构,效果依赖示例引导。
From Textual Requirements to Microservice Architectures - A Comprehensive Evaluation of LLM-Based Design Synthesis

- 用提示词示例引导大模型,从文字需求生成微服务划分与交互。
- 示例引导下服务识别F1达0.97,通信关系恢复准确率显著提升。
- 适合早期系统设计阶段,对架构师和研发团队有参考价值。
微服务架构已成为现代化单体系统的主要方式,但服务划分仍主要依赖人工,且现有方法多基于代码,难以在仅有文字需求的早期阶段应用。尽管大语言模型(LLM)取得进展,但其能否仅凭自然语言需求生成完整微服务架构(包括服务定义与交互)尚缺乏实证。本研究评估OpenAI o3在零样本(ZS)与少样本(FS)提示下,从文本需求生成架构的能力,涵盖结构一致性与质量感知。实验在Bookstore与PetClinic两个系统上进行,每种条件各一次。通过对比参考架构的精确率、召回率与F1分数评估服务识别与通信恢复,并由盲评专家评估正确性、完整性、模块化与合理性。结果表明,FS提示下服务识别的F1为0.97(ZS为0.79),通信恢复方面FS的F1达0.82,优于ZS的0.61;专家评价也显示FS输出更模块化、合理。结论:大模型在示例引导下具备需求驱动架构生成潜力,但结果受限于模型与上下文,基于两个小型系统,不具备普适性。
原文摘要 · Abstract (English)
Microservice architectures have become dominant for modernizing monolithic systems, yet identifying appropriate services remains challenging and largely manual. Existing decomposition approaches are predominantly code-centric, limiting applicability in early design stages where only textual requirements are available. Despite advances in Large Language Models (LLMs), limited empirical evidence exists on their ability to synthesize complete microservice architectures from natural-language requirements, including service definitions and inter-service interactions. This study investigates whether an LLM can bridge requirements engineering and architectural design, generating architectures solely from textual requirements and evaluating structural agreement and perceived quality of results. We conduct a mixed-method study using OpenAI o3 under zero-shot (ZS) and few-shot (FS) prompting across two systems (Bookstore, PetClinic), one execution per system/condition. Architectures are evaluated through (i) comparison with reference architectures using precision, recall, and F1-score for service identification and communication recovery, and (ii) a blinded expert assessment of correctness, completeness, modularity, and plausibility, plus open feedback synthesis. OpenAI o3 identifies services with higher agreement under FS prompting (F1 = 0.79 for ZS versus = 0.97 for FS). Communication recovery is more challenging: ZS produces dense architectures with high recall but low precision (F1 = 0.61), while FS improves agreement, reaching F1 = 0.82 and reducing unsupported dependencies. Expert evaluation corroborates these results, with FS architectures perceived as more modular, coherent, and plausible than ZS outputs. OpenAI o3 shows potential for requirements-driven synthesis when guided by exemplar prompting. Results are model- and context-specific from two small systems, not model-independent proof.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。