arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.01319cs.SE
收藏

ABFS:针对基于LLM的NLP软件的自然鲁棒性测试

ABFS: Natural Robustness Testing for LLM-based NLP Software

Mingxuan Xiao, Yan Xiao, Shunhui Ji, Yunhe Li, Lei Xue, Pengcheng Zhang

AI总结:

本文提出ABFS自动化测试方法,首次将输入提示和示例作为整体进行鲁棒性测试,通过组合优化和自适应控制策略生成高自然度测试用例,显著提升了基于LLM的NLP软件的测试成功率和效率。

摘要:

由于大型语言模型(LLMs)在自然语言处理(NLP)任务中的卓越性能,基于LLM的NLP软件在金融分析和内容审核等各个领域迅速获得关注。然而,这些应用经常表现出鲁棒性缺陷,输入(提示+示例)中的轻微扰动可能导致错误输出。当前的鲁棒性测试方法面临两个主要限制:(1)测试有效性低,限制了基于LLM的软件在安全关键场景中的适用性;(2)测试用例的自然度不足,降低了测试结果的实用价值。为了解决这些问题,本文提出了ABFS,这是一种简单而有效的自动化测试方法,首次将输入提示和示例作为一个统一的整体进行鲁棒性测试。具体而言,ABFS将测试过程表述为组合优化问题,采用最佳优先搜索在扰动空间中识别成功的测试用例,并设计了一种新颖的自适应控制策略以增强测试用例的自然度。我们在三个数据集上评估了ABFS在五种威胁模型下的鲁棒性测试性能。在Llama2-13b上,传统的StressTest仅实现了13.273%的成功率,而ABFS达到了98.064%的成功率,支持在软件部署前进行更全面的鲁棒性评估。与基线方法相比,ABFS对原始输入引入的修改更少,并持续生成具有更优自然度的测试用例。此外,ABFS生成的测试用例展现出更强的可迁移性和更高的测试效率,显著降低了测试成本。

英文摘要:

Owing to the exceptional performance of Large Language Models (LLMs) in Natural Language Processing (NLP) tasks, LLM-based NLP software has rapidly gained traction across various domains, such as financial analysis and content moderation. However, these applications frequently exhibit robustness deficiencies, where slight perturbations in input (prompt+example) may lead to erroneous outputs. Current robustness testing methods face two main limitations: (1) low testing effectiveness, limiting the applicability of LLM-based software in safety-critical scenarios, and (2) insufficient naturalness of test cases, reducing the practical value of testing outcomes. To address these issues, this paper proposes ABFS, a straightforward yet effective automated testing method that, for the first time, treats the input prompts and examples as a unified whole for robustness testing. Specifically, ABFS formulates the testing process as a combinatorial optimization problem, employing Best-First Search to identify successful test cases within the perturbation space and designing a novel Adaptive control strategy to enhance test case naturalness. We evaluate the robustness testing performance of ABFS on three datasets across five threat models. On Llama2-13b, the traditional StressTest achieves only a 13.273% success rate, while ABFS attains a success rate of 98.064%, supporting a more comprehensive robustness assessment before software deployment. Compared to baseline methods, ABFS introduces fewer modifications to the original input and consistently generates test cases with superior naturalness. Furthermore, test cases generated by ABFS exhibit stronger transferability and higher testing efficiency, significantly reducing testing costs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑