RITFIS: Robust input testing framework for LLMs-based intelligent software

Mingxuan Xiao, Yan Xiao, Hai Dong, Shunhui Ji, Pengcheng ZhangarXiv 2024 · DOI

Abstract

As Large Language Models (LLMs) are increasingly integrated into complex software systems, ensuring their reliability and robustness becomes paramount. This paper introduces RITFIS (Robust Input Testing Framework for LLM-based Intelligent Software), the first comprehensive framework designed to evaluate LLM robustness by perturbing the entire input—the combination of the system prompt and the user-provided example. By adapting 17 classical automated testing methods to the LLM context, we demonstrate that even state-of-the-art models like Llama-2-70b are susceptible to subtle, human-imperceptible changes. Our evaluation across three diverse datasets reveals that current LLM-based software remains fragile, with certain testing methods achieving success rates of nearly 64% with minimal text alterations.

Introduction

Large Language Models (LLMs) have transitioned from simple chat interfaces to core components of intelligent software, such as automated financial sentiment analysis and fraud detection systems. In these real-world applications, the input is typically a composite of a fixed instruction (the prompt) and dynamic user data (the example). While previous research has focused heavily on "adversarial prompts" or prompt engineering, this approach is insufficient for software testing. A minor typo or a synonym swap in the user-provided data can flip a model’s classification, rendering the software fundamentally unreliable. RITFIS addresses this gap by providing a modular framework to evaluate how perturbations in the "overall input" affect software performance in zero-shot scenarios.

Methodology

The RITFIS framework treats the testing process as a combinatorial optimization problem: the goal is to identify the smallest possible modification to the input text that maximizes the model's prediction error. The framework is structured into four modular components that allow for flexible and comprehensive testing.

The RITFIS framework architecture, illustrating the flow from original prompt and dataset to the generation of test cases through modular components.

Modular Components

  1. Goal Function: This defines the success criteria for a test case, such as forcing a misclassification or maximizing the confidence score of an incorrect label.
  2. Perturbation Module: This module implements various text alteration techniques, including character-level changes, synonym replacement, word insertion/deletion/swapping, and back-translation.
  3. Constraints: To ensure test cases remain human-readable and semantically equivalent to the original, constraints are applied. These include limiting the percentage of words changed and maintaining part-of-speech consistency.
  4. Search Method: These strategies navigate the vast space of possible text changes. RITFIS focuses on black-box methods, which are more practical for software testers who lack access to internal model weights.

Researchers ported 17 automated testing methods originally designed for Deep Neural Networks (DNNs) into this framework to evaluate their efficacy against LLMs.

Experimental Evaluation

The framework was evaluated using three distinct text classification scenarios: Financial sentiment analysis, Movie Review (MR) analysis, and AG’s News category classification. The target "threat model" for these tests was the Llama-2-70b model, selected for its high performance and complexity.

Results and Analysis

The study conducted a deep dive into five specific methods: TextFooler, StressTest, Checklist, TextBugger, and PWWS. The results, summarized in the table below, highlight significant vulnerabilities in the LLM's robustness.

Performance indicators (Success rate, Change rate, Perplexity, Time-Overhead, and Query-Number) of various testing methods across Financial, AG’s News, and MR datasets.

Key Findings

  • Top Performance: PWWS emerged as the most effective method, achieving the highest average success rate (S-rate) of 63.972% across all datasets. On the MR dataset, it reached a peak success rate of 0.741.
  • Stealthy Attacks: All five primary methods were able to mislead the LLM with a change rate (C-rate) of less than 11%. This indicates that the software can be compromised by changes so minor they might go unnoticed by human users.
  • Naturalness vs. Effectiveness: StressTest produced the most fluent adversarial examples, as indicated by the lowest Perplexity (PPL) scores (e.g., 40.496 on Financial). However, it also had the lowest success rates, demonstrating a trade-off between the naturalness of the perturbation and its effectiveness in triggering errors.
  • Efficiency Trade-offs: There is a notable divide between fast and effective methods. While StressTest is significantly faster (lower T-O), its lack of comprehensiveness leaves many vulnerabilities hidden compared to more intensive methods like PWWS.

Discussion

The evaluation revealed a "Length Penalty" similar to traditional DNNs: LLMs are harder to attack successfully when the input text is longer. For instance, TextFooler’s success rate dropped from ~64% on short movie reviews to ~48% on longer news articles. This suggests that context length may provide a marginal buffer for robustness, though it is not a complete solution.

Furthermore, the reliance of current testing methods on fixed perturbation paradigms—inherited from the DNN era—may not fully capture the unique behaviors of LLMs, such as hallucinations. Future testing strategies must become more adaptive to the dynamic nature of these models.

Conclusion

RITFIS provides a robust foundation for testing LLM-based intelligent software. The findings underscore that current models are not yet ready for high-stakes automated environments without additional safeguards. Future work will focus on developing adaptive testing strategies that evolve alongside LLM behavioral patterns and specifically target phenomena like hallucinations to ensure more comprehensive software validation.

Summary updated

BibTeX
@misc{xiao2024ritfis,
  author = {Mingxuan Xiao and Yan Xiao and Hai Dong and Shunhui Ji and Pengcheng Zhang},
  title = {{RITFIS: Robust input testing framework for LLMs-based intelligent software}},
  year = {2024},
  eprint = {2402.13518},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.13518},
}
Figure