Page 225 - 《软件学报》2026年第5期
P. 225
2104 软件学报 2026 年第 37 卷第 5 期
constraint extraction methods based on different data sources and techniques to identify complex relationships between configurations.
However, these methods face several limitations, such as limited applicability across multiple programming languages, constrained analysis
scale, and a heavy reliance on high-quality annotated data. To overcome these issues, this study proposes LLM-Extractor, a configuration
constraint extraction method based on large language models. This method consists of two main components: the construction of a
configuration-function association graph and configuration constraint inference based on multi-configuration association subgraphs. In the
graph construction phase, LLM-Extractor leverages the powerful text understanding and analysis capabilities of large language models to
identify entities related to configurations and software functionalities from configuration documents and extract various types of
relationships. In the constraint inference phase, LLM-Extractor searches for multi-configuration association subgraphs on the existing
function graph and guides the large language model to infer configuration constraints based on the information within the subgraphs. By
inferring constraints based on multi-configuration association subgraphs, LLM-Extractor can extract configuration constraints transmitted
through software function states, filling the gap left by existing methods. It is also characterized by its language-agnostic nature and
scalability. The effectiveness of this approach is evaluated on configuration documents from three open-source software systems, analyzing
over 1 400 configuration options. Experimental results show that LLM-Extractor outperforms existing text analysis methods, with a 43.4%
improvement in F1 score. Further ablation studies demonstrate the critical positive impact of multi-configuration association subgraphs on
the effectiveness of configuration constraint inference.
Key words: software configuration; software configuration constraint; large language model (LLM)
随着软件系统在社会发展各个领域发挥越来越重要的作用, 社会逐渐进入“软件定义”的时代. 软件配置
(software configuration) 作为软件系统的重要组成部分, 在增强软件功能的多样性、提升系统的灵活性和实现定制
化方面具有重要作用. 软件配置广泛存在于从软件开发到软件部署、运维的整个生命周期中. 软件开发人员通过
设置配置变量和开发特定配置修改接口, 实现了软件系统的可配置化; 软件部署和运维人员能根据不同的实际应
用场景修改对应的软件配置, 从而实现功能定制、资源分配、场景迁移等需求. 近年来, 为了应对更加复杂的软件
应用场景, 软件系统逐渐朝着高可配置化的方向发展, 软件配置的灵活性也越来越大.
然而, 随着软件系统规模的增大和复杂性的提升, 软件配置的数量不断增加, 软件配置之间的依赖关系越来越
复杂. 例如, Squid 6 拥有超过 300 个配置项 [1] , MySQL 5.7 数据库拥有超过 1 000 个软件配置项 [2] , openGauss 5.0.0
拥有超过 700 个配置项 [3] . 软件配置复杂性的提高导致配置项相关的软件故障愈发频繁, 许多跨国科技公司的软
件故障报告表明, 软件配置错误可能会导致严重的生产事故 [4–6] . 2019 年, 一项配置错误导致 Facebook 出现了严重
的服务宕机, 影响到数百万用户的正常使用 [4] . 2024 年 4 月 8 日下午, 腾讯云出现服务故障, 故障发生后, 依赖云
API 提供产品能力的部分公有云服务, 也因为云 API 的异常出现了无法使用的情况, 此次故障一共持续了 87 min,
腾讯云的故障复盘说明指出错误配置导致了这次故障, 故障的根本原因是配置与新版本的接口协议参数不兼容 [5] .
2025 年 1 月 13 日, GitHub 因内部负载均衡器的配置错误导致全球服务中断, 停机时间长达 49 min, 部分用户甚至
报告停机时间超过 2 h, 此次事件影响了数以百万计的开发者, 事件报告指出此次事故是由于配置错误影响了数据
库基础架构内的流量路由, 导致关键服务意外丢失数据库连接 [6] . 种种事例表明软件配置错误会导致严重的后果,
而软件配置之间复杂的约束关系是导致配置错误的重要原因 [7] . 软件配置间复杂的约束关系显著提高了配置人员
下发错误配置的概率 [8,9] , 如何在软件配置下发前提前获取软件配置之间的复杂约束关系, 并对软件配置进行错误
检测, 是软件配置研究领域的重要问题 [10] .
软件配置约束提取任务作为软件配置研究领域的重要任务, 有大量研究工作基于不同数据来源、应用多种技
术手段来提取软件配置约束 [10] . 许多研究工作使用软件系统的源代码作为数据源、应用静态程序分析技术来提
取软件配置约束 [11–17] . 基于静态程序分析的方法分析软件源代码编译过程中产生的抽象语法树 (abstract syntax
tree, AST) 和中间表示 (intermediate representation, IR) 等信息, 从而提取配置约束. 此类方法在实际应用中面临语
言特性多样、程序分析规模受限等问题, 无法快速适配不同编程语言编写的软件系统, 并且对于大规模软件系统
的分析能力有限 [10] . 有部分研究工作使用大量的配置样本作为数据源, 应用概率统计相关方法, 提取软件配置约
束 [18–24] . 这些方法的效果受数据质量的影响较大, 且提取复杂配置约束的能力较差. 有少量研究工作使用软件配置
文档、软件日志等自然语言信息作为数据源, 应用自然语言处理 (natural language processing, NLP) 相关方法, 从

