arXiv:2604.21579cs.SEcs.AI2026-04被引 1

用变异测试+似然值,揭露大模型程序修复中的记忆泄漏问题

A Metamorphic Testing Approach to Diagnosing Memorization in LLM-Based Program Repair

论文配图:A Metamorphic Testing Approach to Diagnosing Memorization in LLM-Based Program Repair
图 1 · 摘自论文原文
  • 通过语义不变变换生成新基准,检测模型是否依赖记忆而非推理
  • 7个大模型在新基准上成功率下降4.1%至15.98%,降幅与记忆概率强相关
  • 适合关注LLM评估可靠性、程序修复安全性的研究者和开发者

基于大语言模型的自动化程序修复(APR)技术虽能降低调试成本,但可能因数据泄露导致性能虚高:当评测基准与预训练数据重叠时,模型会记忆修复方案,造成结果夸大。本文提出结合变异测试(MT)与负对数似然(NLL)的方法,以更准确揭示此类问题。通过对Defects4J和GitBug-Java两个常用数据集进行语义保持变换,构建变体基准,评估7个主流大模型在原始与变换版本上的修复成功率,并分析性能下降与NLL的关系。结果显示,所有模型在新基准上成功率显著下降,降幅从GPT-4o的-4.1%到Llama-3.1的-15.98%不等;且性能退化程度与原基准下的NLL高度相关,表明模型在更可能已记忆的样本上表现更好。该方法为检测数据泄露提供了更强证据,同时表明变异测试可有效缓解评估中的记忆偏差。

原文摘要 · Abstract (English)

LLM-based automated program repair (APR) techniques have shown promising results in reducing debugging costs. However, prior results can be affected by data leakage: large language models (LLMs) may memorize bug fixes when evaluation benchmarks overlap with their pretraining data, leading to inflated performance estimates. In this paper, we investigate whether we can better reveal data leakage by combining metamorphic testing (MT) with negative log-likelihood (NLL), which has been used in prior work as a proxy for memorization. We construct variant benchmarks by applying semantics-preserving transformations to two widely used datasets, Defects4J and GitBug-Java. Using these benchmarks, we evaluate the repair success rates of seven LLMs on both original and transformed versions, and analyze the relationship between performance degradation and NLL. Our results show that all evaluated state-of-the-art LLMs exhibit substantial drops in patch generation success rates on transformed benchmarks, ranging from -4.1% for GPT-4o to -15.98% for Llama-3.1. Furthermore, we find that this degradation strongly correlates with NLL on the original benchmarks, suggesting that models perform better on instances they are more likely to have memorized. These findings show that combining MT with NLL provides stronger and more reliable evidence of data leakage, while metamorphic testing alone can help mitigate its effects in LLM-based APR evaluations.

程序修复大模型评估数据泄露变异测试

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。