用大模型检测不稳定的测试,少样本学习更省钱
An Analysis of LLM Fine-Tuning and Few-Shot Learning for Flaky Test Detection and Classification
- 采用孪生网络的少样本学习方法,数据少也能训练
- 少样本方法准确率接近全量微调,但成本低得多
- 适合数据少的团队或项目快速部署
不稳定的测试在执行时行为不可预测,可能无故通过或失败,影响自动化测试套件的可靠性。本文比较了大语言模型的微调与少样本学习(FSL)在检测和分类这类测试中的表现。基于两个现有数据集FlakyCat和IDoFT的评估显示,尽管微调在大数据下可实现高准确率,但少样本学习方法(如提出的FlakyXbert)仅需少量历史数据即可达到接近的性能,显著降低训练成本。该结果表明,两种方法各有适用场景:微调适合资源充足的组织,而少样本学习更适合数据有限的项目,为不同需求提供了灵活选择。
原文摘要 · Abstract (English)
Flaky tests exhibit non-deterministic behavior during execution and they may pass or fail without any changes to the program under test. Detecting and classifying these flaky tests is crucial for maintaining the robustness of automated test suites and ensuring the overall reliability and confidence in the testing. However, flaky test detection and classification is challenging due to the variability in test behavior, which can depend on environmental conditions and subtle code interactions. Large Language Models (LLMs) offer promising approaches to address this challenge, with fine-tuning and few-shot learning (FSL) emerging as viable techniques. With enough data fine-tuning a pre-trained LLM can achieve high accuracy, making it suitable for organizations with more resources. Alternatively, we introduce FlakyXbert, an FSL approach that employs a Siamese network architecture to train efficiently with limited data. To understand the performance and cost differences between these two methods, we compare fine-tuning on larger datasets with FSL in scenarios restricted by smaller datasets. Our evaluation involves two existing flaky test datasets, FlakyCat and IDoFT. Our results suggest that while fine-tuning can achieve high accuracy, FSL provides a cost-effective approach with competitive accuracy, which is especially beneficial for organizations or projects with limited historical data available for training. These findings underscore the viability of both fine-tuning and FSL in flaky test detection and classification with each suited to different organizational needs and resource availability.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。