[论文解读] Are Large Language Models Memorizing Bug Benchmarks?
本文研究了大型语言模型(LLMs)是否会记忆广泛使用的软件错误基准(如 Defects4J),采用负对数似然(NLL)和 5-gram 准确率等指标进行评估。研究发现,像 codegen-multi 这类旧模型在 Defects4J 上表现出强烈的记忆信号,而像 LLaMa 3.1 这类新模型则显著降低了信息泄露,凸显了在基准选择和稳健评估实践方面的重要性,以避免性能指标被过度夸大。
Large Language Models (LLMs) have become integral to various software engineering tasks, including code generation, bug detection, and repair. To evaluate model performance in these domains, numerous bug benchmarks containing real-world bugs from software projects have been developed. However, a growing concern within the software engineering community is that these benchmarks may not reliably reflect true LLM performance due to the risk of data leakage. Despite this concern, limited research has been conducted to quantify the impact of potential leakage. In this paper, we systematically evaluate popular LLMs to assess their susceptibility to data leakage from widely used bug benchmarks. To identify potential leakage, we use multiple metrics, including a study of benchmark membership within commonly used training datasets, as well as analyses of negative log-likelihood and n-gram accuracy. Our findings show that certain models, in particular codegen-multi, exhibit significant evidence of memorization in widely used benchmarks like Defects4J, while newer models trained on larger datasets like LLaMa 3.1 exhibit limited signs of leakage. These results highlight the need for careful benchmark selection and the adoption of robust metrics to adequately assess models capabilities.
研究动机与目标
- 评估大型语言模型(LLMs)是否因训练数据中的数据泄露,而记忆了广泛使用的软件错误基准(如 Defects4J 和 BugsInPy)中的内容。
- 使用负对数似然(NLL)和 5-gram 准确率等客观指标,量化 LLM 中的记忆化程度。
- 比较不同模型(包括旧模型,如 codegen-multi,以及新模型,如 LLaMa 3.1)在基准测试中的泄露风险,这些模型均在更大规模的数据集上进行训练。
- 通过将模型在已知基准上的表现与在新挖掘的、可能未见过的 2024 年 GitHub 仓库上的表现进行对比,评估现有基准的可靠性。
- 在软件工程社区中提高对使用可能存在记忆化问题的基准所带来的风险的认识,因为这可能导致模型性能指标被人为夸大。
提出的方法
- 本研究使用负对数似然(NLL)来衡量模型对错误基准中代码片段的熟悉程度,以及对新仓库中代码的熟悉程度。
- 采用 5-gram 准确率评估模型重现基准解决方案中精确序列的能力。
- 分析 TheStack(一个广泛使用的预训练代码数据集)中是否存在基准成员身份,以评估潜在的数据泄露来源。
- 将模型在已建立基准(如 Defects4J、BugsInPy)上的表现,与在新收集的高质量、2024 年风格的 GitHub 仓库数据集上的表现进行对比,以分离记忆化与泛化能力。
- 分析涵盖多种 LLM 模型,包括 codegen-multi、CodeLLaMa、LLaMa 3.1、Gemma 2 等,覆盖代码生成和修复任务。
- 本研究采用 NLL 和 5-gram 准确率在模型和数据集之间的趋势分析,而非依赖绝对数值,以减轻因相似训练/测试划分带来的噪声影响。
实验结果
研究问题
- RQ1像 codegen-multi 这类流行的 LLM 在多大程度上记忆了 Defects4J 等广泛使用的错误基准中的解决方案?
- RQ2在更大、更多样化数据集上训练的新模型(如 LLaMa 3.1)在已建立基准上的记忆化风险如何?
- RQ3相较于 Defects4J 等旧基准,较新但尚未广泛使用的基准(如 GitBug-Java 和 BugsCpp)是否表现出更低的泄露信号?
- RQ4当应用于基准数据与新代码仓库时,负对数似然(NLL)和 5-gram 准确率等指标如何检测 LLM 中的数据泄露?
- RQ5模型规模和训练数据规模对记忆基准解决方案的可能性有何影响?
主要发现
- 模型 codegen-multi(6B 参数)对 Defects4J 错误 #39 展现出强烈的记忆化行为,能逐字逐句重现完整解决方案,包括注释和换行符。
- 在所有模型和指标中,Defects4J 均表现出最高的潜在记忆化率,表明其是最容易发生数据泄露的基准。
- 旧模型如 codegen-multi 在 Defects4J 上表现出极高的 5-gram 准确率和极低的 NLL,表明存在显著的记忆化信号。
- 新模型如 LLaMa 3.1 在更大、更多样化的数据集上进行训练,其在所有基准上均表现出显著降低的记忆化迹象。
- 新基准如 GitBug-Java、BugsInPy 和 BugsCpp 的 NLL 和 5-gram 准确率水平与在新挖掘的 2024 年 GitHub 仓库中的水平相当,表明其泄露风险较低。
- 本研究确认,数据泄露是基准评估中的真实问题,尤其当使用像 Defects4J 这类旧的、广泛使用的数据集时,其可能已被直接或间接地包含在训练数据中。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。