Toward Generating Microservice Architectures from Textual Requirements with Large Language Models
J. R. Pereira, Danyllo Wagner Albuquerque, Mirko Perkusich, Guillermo Rodríguez, Jorge Andres Diaz-Pace, Kyller Gorgônio, Ângelo Perkusich · 2025
Large Language Models (LLMs) have demonstrated strong performance in natural language understanding and generation, opening new possibilities for automating software engineering tasks. This study evaluates whether the GPT-4 O3 model can generate microservice-oriented architectures directly from textual requirements. We applied two prompting strategies—zero-shot (ZS) and few-shot (FS)—to two real-world-inspired systems (Bookstore and PetClinic) and compared the outputs against their reference architectures. In ZS, GPT-4 identified 11 out of 14 expected services (precision, recall, and F1 ≈ 0.79) and recovered 33 out of 38 interservice links (precision ≈ 0.50, recall ≈ 0.87, F1 ≈ 0.64), but also introduced 34 unsupported links. Under FS, it matched all 14 services (precision ≈ 0.93, recall = 1.00, F1 ≈ 0.97) and recovered every expected link, while reducing spurious connections to 12 (precision ≈ 0.76, recall = 1.00, F1 ≈ 0.86). A mixed-methods evaluation by four senior architects confirmed these trends. The FS received the best expert scores (avg. correctness ≈ 4.6/5, plausibility ≈ 4.5/5) because they balanced full requirement coverage with sound modularity, whereas the ZS versions, though complete, were downgraded for dense bidirectional coupling (plausibility ≈ 2/5). The reference architecture sat in between, structurally tidy but functionally sparse. Overall, the study shows that supplying even a single exemplar can transform GPT-4 from a rough sketch generator into a credible assistant for microservice decomposition, giving architects a rapid and reliable starting point for design.