[论文解读] Can an LLM Detect Instances of Microservice Infrastructure Patterns?
本论文提出 MicroPAD,这是一个基于大语言模型的工具,利用自然语言模式描述,在多语言环境下检测微服务基础设施模式,在 190 个代码库上使用 GPT-5 Nano 进行评估。
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.
研究动机与目标
- 在多语言工件中证明语言无关的架构模式检测的必要性。
- 提出 MicroPAD,这是一个基于大语言模型的流水线,在不需要语言特定解析器的情况下检测微服务基础设施模式。
- 创建一个人工标注的数据集,将仓库标注为 Richardson 的微服务模式以用于评估。
- 评估对不同模式的检测性能,并分析影响成功的因素,如工件普及度和区分度。
提出的方法
- 从自然语言模式描述和示例实例中开发 Pattern Profiles(模式画像)。
- 使用多阶段流水线(Pattern Profile 创建、文件路径确定、模式检测)并包含 LLM 推理轨迹。
- 用嵌入和关键词匹配对要分析的文件进行优先级排序,以应对大规模代码库。
- 通过对仓库主要贡献者的问卷调查获取真实标签,并计算 precision、recall、accuracy 和 F1。
- 引入 File Dominance Index(FDI),用于分析工件对检测性能的影响。
- 使用混淆矩阵和九种 Richardson 模式的逐模式指标来汇报结果。
实验结果
研究问题
- RQ1RQ1:一种语言无关的基于 LLM 的方法在软件工件中检测微服务基础设施模式实例的检测性能如何?
- RQ2RQ2:软件仓库中的工件如何影响基于 LLM 的方法检测微服务基础设施模式实例的能力?
主要发现
- MicroPAD 在九种模式下的准确率为 79.5%,精确率为 49.6%,召回率为 32.8%,F1 值为 39.5%。
- F1 分数范围为 0.70(每容器的服务实例)到 0.09(第三方注册)。
- 模式的普及度与 F1 分数之间存在显著正相关(r = 0.74)。
- 具有显著工件的模式(如与 Docker、Terraform、Kubernetes 相关的模式)显示更高的检测性能(FDI 与 FDI 的相关性)。
- 不同模式的顶级分析工件各异;某些模式缺乏主导文件,F1 分数较低(如服务注册表)。
- F1 分数与每个模式的最大 File Dominance Index(FDI)之间存在强正相关(r = 0.83)。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。