Hype Meets Reality: Large Language Models as Mutators in Search-based Automated Program Repair of Simulink-Stateflow Models
用LLM直接替换变异算子,CPS自动修复效果反而大幅变差:如果你正考虑把LLM塞进搜索式程序修复流程,这个实验先给你泼了冷水:在19个真实Stateflow故障模型上,LLM动态变异只产出4个有效补丁,而原来的手工变异算子能产出16个。问题不在LLM本身,而在替换式集成的做法。
FlowRepair靠手工变异算子修复Stateflow故障模型,研究者把部分算子换成LLM动态生成变异,想看能否扩大修复覆盖。结果在19个真实故障模型、相同壁钟预算下,LLM版本有效补丁仅4个(原始16个),失败原因是精确符号编辑做不到、没有行为反馈、候选噪声太大。
受控实验表明,朴素地把LLM当变异算子会显著降低CPS修复效果(有效补丁4个对16个)。根因不是LLM能力到顶,而是这种集成方式缺少精确符号编辑能力,也没有给LLM行为反馈输入。
1. 旧假设认为LLM动态变异能突破固定算子的数量上限,但替换后有效补丁从16个跌到4个,说明朴素替换和仿真搜索框架根本不匹配。 2. 方法是在FlowRepair中替换部分变异算子,在19个真实Stateflow模型(4个CPS领域)上,用相同壁钟预算、同一适应度函数对比多个LLM变体与原始方法。 3. 决定性结果:LLM合理补丁4-6个对18个、有效补丁4个对16个;应做的是保留手工算子做精确编辑,LLM只提供方向引导。
基准是19个真实世界Stateflow故障模型,覆盖4个CPS领域。对照双方共享相同壁钟预算,指标是合理补丁数和有效补丁数。结果:LLM合理补丁4-6个(原始18个),有效补丁4个(原始16个)。失败模式分析锁定三个根因:LLM无法精确执行符号编辑、候选生成缺乏行为反馈、候选集噪声过大阻碍搜索推进。
- 它要解决什么
- 把LLM当作搜索式APR的变异算子,能不能提升Simulink-Stateflow这类CPS模型的修复效果?
- 研究路径
- FlowRepair按适应度导向的概率选择故障组件,施加变异算子后运行仿真,用测试结果更新合理补丁归档并触发局部搜索。LLM版本把变异这一步改成由LLM动态生成候选,候选同样进仿真评估循环。但LLM生成时拿不到任何行为反馈,候选质量低,还给搜索空间注入大量噪声,淹没了有效搜索路径。
- 这对工程意味着什么
- 第一步行动:搭混合架构,手工变异算子负责精确编辑,LLM只做候选方向引导并接入适应度反馈。要避开的捷径:不要图省事直接拿LLM替换变异算子——没有行为反馈时它生成的低质候选会淹没搜索信号,修复成功率会从16个有效补丁掉到4个。
- 证据定位
- 数字很直接:LLM版本合理补丁只有4-6个,原始方法有18个;LLM版本有效补丁4个,原始方法16个。在相同时间预算下,LLM版本大幅落后于基线。(筛选维度:可复核评测、软件工程方法)
- 适用边界
- 基准规模只有19个模型、4个CPS领域;LLM提示设计细节披露不充分;结论只反映这种替换式集成方式的局限,不代表LLM辅助APR这个方向的通用上界。
方法与英文摘要
研究者在FlowRepair框架里,把一部分预定义变异算子换成LLM动态生成的变异候选。候选仍进入原有的仿真评估循环,由同一个适应度函数打分。测试基准是19个真实Stateflow故障模型,覆盖4个CPS领域。多个LLM变体与原始FlowRepair在相同壁钟预算下逐一对比,保证变量可控。
Search-based Automated Program Repair (APR) techniques rely on carefully designed mutation operators to explore the space of candidate fixes. Recent advances in Large Language Models (LLMs) suggest that generative models could replace such operators by dynamically proposing repairs. In this paper, we investigate this hypothesis in the context of Cyber-Physical Systems (CPSs) modeled in Simulink/Stateflow. We extend the state-of-the-art FlowRepair approach by replacing a subset of its mutation operators with LLM-generated mutations, enabling more flexible and expressive patch generation. We evaluate the approach on a benchmark of 19 real-world faulty Stateflow models across four CPS domains, using the same experimental setup as FlowRepair for controlled comparison under the same wall-clock budget. Contrary to expectations, in this controlled evaluation, the LLM-based mutation substantially degrades repair performance under the FlowRepair experimental setup. Across the tested LLM variants, the LLM-based repair produced plausible patches for 4-6 models and valid patches for 4 models, compared to 18 and 16, respectively, with the original approach. Our analysis reveals that, in this integration, LLMs struggle with precise symbolic edits, lack behavioral feedback, and generate a noisy search space that hinders effective exploration. Rather than showing a general limitation of LLMs for APR, these findings highlight fundamental limitations of naively integrating LLMs into search-based APR and motivate hybrid approaches that combine structured mutation with generative guidance.