Can an LLM Detect Instances of Microservice Infrastructure Patterns?
作者: Carlos Eduardo Duarte, Neil B. Harrison, Filipe Figueiredo Correia, Ademar Aguiar, Pavlína Gonçalves
分类: cs.SE, cs.AI
发布日期: 2026-03-24
备注: Accepted at ICSA 2026 - International Conference on Software Architecture - Research Track
💡 一句话要点
MicroPAD利用LLM检测微服务架构模式实例,性能受模式特征影响
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 微服务架构模式 软件架构检测 代码分析 自然语言处理
📋 核心要点
- 现有工具在检测软件架构模式时,面临跨语言、模式多样性和实现方式差异的挑战。
- MicroPAD利用GPT 5 nano,基于自然语言描述,实现跨语言软件制品中的架构模式检测。
- 实验表明MicroPAD能检测多种语言和制品类型的模式,但性能受模式普遍性和制品特征影响。
📝 摘要(中文)
架构模式广泛存在于各种软件制品中。由于模式种类繁多且实现方式各异,现有工具难以有效检测,尤其是在跨语言场景下。大型语言模型(LLM)在大量软件制品和知识上训练,有望克服现有方法的局限性。然而,其真实有效性以及影响性能的因素尚未得到充分研究。为了更好地理解这一点,我们开发了MicroPAD。该工具利用GPT 5 nano,基于自然语言模式描述,识别任何语言编写的软件制品中的架构模式。我们使用MicroPAD评估LLM检测架构模式实例的能力,特别是与基础设施相关的微服务模式。为此,我们选择了一组GitHub仓库,并联系了主要贡献者,创建了一个包含微服务架构模式的人工标注数据集,包含190个仓库。结果表明,MicroPAD能够跨多种语言和制品类型检测模式实例。检测性能因模式而异(F1分数范围为0.09到0.70),特别是与其普遍性和制品特征的独特性有关。我们还发现,与可识别的、主导制品相关的模式检测更可靠。这些发现是否能推广到其他LLM和工具,是未来研究的一个有希望的方向。
🔬 方法详解
问题定义:论文旨在解决现有工具在检测微服务架构模式时,无法有效处理跨语言、模式多样性和实现方式差异的问题。现有方法通常只支持单一语言,且难以应对复杂多变的模式实现,导致检测准确率低、适用范围窄。
核心思路:论文的核心思路是利用大型语言模型(LLM)在大量软件代码和文档上预训练的优势,使其具备理解和识别不同语言和实现方式的架构模式的能力。通过自然语言描述模式,并利用LLM进行推理,从而实现跨语言的模式检测。
技术框架:MicroPAD工具的核心流程包括:1) 收集包含微服务架构模式的GitHub仓库;2) 人工标注数据集,包含190个仓库;3) 使用GPT 5 nano作为LLM引擎;4) 将自然语言描述的架构模式输入LLM;5) LLM分析软件制品,判断是否存在目标模式实例;6) 评估检测结果的准确率和召回率。
关键创新:论文的关键创新在于将大型语言模型应用于软件架构模式检测领域,并验证了其在跨语言环境下的可行性。与传统方法相比,MicroPAD无需针对特定语言或模式进行定制化开发,具有更强的通用性和灵活性。
关键设计:MicroPAD使用GPT 5 nano作为LLM引擎,并采用自然语言描述架构模式。实验中,作者选择了190个包含微服务架构模式的GitHub仓库,并人工标注了数据集。评估指标包括F1分数,用于衡量检测结果的准确率和召回率。实验结果表明,模式的普遍性和制品特征的独特性对检测性能有显著影响。
🖼️ 关键图片
📊 实验亮点
实验结果表明,MicroPAD能够跨多种语言和制品类型检测微服务架构模式实例。检测性能因模式而异,F1分数范围为0.09到0.70,与模式的普遍性和制品特征的独特性有关。与可识别的、主导制品相关的模式检测更可靠,表明LLM在识别具有明确特征的模式时表现更好。
🎯 应用场景
该研究成果可应用于软件架构分析、代码质量评估、自动化重构等领域。通过自动检测代码中的架构模式,可以帮助开发人员更好地理解系统结构,发现潜在的设计缺陷,并指导代码优化和演进。未来,该技术有望集成到IDE和CI/CD流程中,实现持续的架构质量监控。
📄 摘要(原文)
Architectural patterns are frequently found in various software artifacts. The wide variety of patterns and their implementations makes detection challenging with current tools, especially since they often only support detecting patterns in artifacts written in a single language. Large Language Models (LLMs), trained on a diverse range of software artifacts and knowledge, might overcome the limitations of existing approaches. However, their true effectiveness and the factors influencing their performance have not yet been thoroughly examined. To better understand this, we developed MicroPAD. This tool utilizes GPT 5 nano to identify architectural patterns in software artifacts written in any language, based on natural-language pattern descriptions. We used MicroPAD to evaluate an LLM's ability to detect instances of architectural patterns, particularly infrastructure-related microservice patterns. To accomplish this, we selected a set of GitHub repositories and contacted their top contributors to create a new, human-annotated dataset of 190 repositories containing microservice architectural patterns. The results show that MicroPAD was capable of detecting pattern instances across multiple languages and artifact types. The detection performance varied across patterns (F1 scores ranging from 0.09 to 0.70), specifically in relation to their prevalence and the distinctiveness of the artifacts through which they manifest. We also found that patterns associated with recognizable, dominant artifacts were detected more reliably. Whether these findings generalize to other LLMs and tools is a promising direction for future research.