paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Understanding and Improving Flaky Test Classification

理解并改进 flaky 测试分类
OOPSLA 9(OOPSLA2)2025匹配度 4/10 · 论文研究 flaky test 分类,使用 LLM 微调并构建更真实的 FlakeBench,属于软件测试与 ML4Code 方向,与用户核心关注的静态分析、形式化验证、浮点/贝叶斯程序分析及 Agentic 程序分析无直接关系。不过其“揭示已有评估缺陷并构建更真实 benchmark”的问题驱动范式,与用户对 benchmark 和失效原因分析的兴趣有部分重合。引用 5 inbox
Shanto Rahman, Saikat Dutta, August Shi
crossref: 2026-09-10

AI 速览

一句话:揭示先前 flaky 测试分类评估高估,构建真实数据集并提出训练策略 FlakyLens,显著提升分类性能。

回归测试中的 flaky 测试会非确定地通过或失败,浪费开发者时间并掩盖真实缺陷。已有工作用微调大语言模型对 flaky 测试分类并获得很高准确率,但本文发现其因实验设计缺陷和不真实数据分布而高估性能。作者修正实验设计并构建更真实的 FlakeBench 数据集,使此前最优模型的 F1 从 81.82% 降至 56.62%。为此提出新的微调训练策略 FlakyLens,将 F1 提升至 65.79%,比当时最优高 9.17 个百分点,并优于 CodeLlama 和 DeepSeekCoder。进一步通过 token 归因与对抗扰动发现,扰动最重要 token 可使准确率最多下降 18.37 个百分点,表明模型仍依赖类别特定 token,泛化与语义理解不足。

问题
已有 flaky 测试分类器在评估中因实验设计缺陷和数据集分布不真实而高估准确率,且模型泛化与语义理解不足。
方法
修正实验设计、构建真实数据集 FlakeBench,并提出微调训练策略 FlakyLens,同时用 token 归因和对抗扰动分析模型决策依据。
评估
在 FlakeBench 上比较 F1,与 SOTA 及 CodeLlama、DeepSeekCoder 等 LLM 对比,并通过重要 token 扰动评估预测稳定性。
原文摘要(Abstract)

Regression testing is an essential part of software development, but it suffers from the presence of flaky tests - tests that pass and fail non-deterministically when run on the same code. These unpredictable failures waste developers’ time and often hide real bugs. Prior work showed that fine-tuned large language models (LLMs) can classify flaky tests into different categories with very high accuracy. However, we find that prior approaches over-estimated the accuracy of the models due to incorrect experimental design and unrealistic datasets - making the flaky test classification problem seem simpler than it is. In this paper, we first show how prior flaky test classifiers over-estimate the prediction accuracy due to 1) flawed experiment design and 2) mis-representation of the real distribution of flaky (and non-flaky) tests in their datasets. After we fix the experimental design and construct a more realistic dataset (which we name FlakeBench), the prior state-of-the-art model shows a steep drop in F1-score, from 81.82% down to 56.62%. Motivated by these observations, we develop a new training strategy to fine-tune a flaky test classifier, FlakyLens, that improves the classification F1-score to 65.79% (9.17pp higher than the state-of-the-art). We also compare FlakyLens against recent pre-trained LLMs, such as CodeLlama and DeepSeekCoder, on the same classification task. Our results show that FlakyLens consistently outperforms these models, highlighting that general-purpose LLMs still fall short on this specialized task. Using our improved flaky test classifier, we identify the important tokens in the test code that influence the models in making correct or incorrect predictions. By leveraging attribution scores computed per code token in each test, we investigate the tokens that have higher impact on the flaky test classifier’s decision-making per flaky test category. To assess the influence of these important tokens, we introduce adversarial perturbation using these important tokens into the tests and observe whether the model’s predictions change. Our findings show that, when introducing perturbations using the most important tokens, the classification accuracy can change by as much as -18.37pp. These results highlight that these models still struggle to generalize beyond their training data and rely on identifying category-specific tokens (instead of understanding their semantic context), calling for further research into more robust training methodologies.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2936,
  title = {Understanding and Improving Flaky Test Classification},
  author = {Shanto Rahman and Saikat Dutta and August Shi},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763098}
}