Abstract
Large Language Models (LLMs) are increasingly integrated into NLP software, yet their robustness remains a critical concern. This paper introduces AORTA, an automated framework for stress-testing LLM-based applications, powered by a novel Adaptive Beam Search (ABS) algorithm. AORTA identifies subtle input perturbations that cause model failures with high efficiency and naturalness. Our evaluation across multiple datasets and models demonstrates an 86% success rate in finding vulnerabilities while significantly reducing computational costs compared to existing methods.
Introduction
As Large Language Models (LLMs) like ChatGPT and Llama become the backbone of modern NLP software—handling tasks from financial sentiment analysis to content moderation—their robustness is under scrutiny. Unlike traditional software, LLM-based applications rely on a combination of prompts (instructions) and examples (data) as inputs.
The primary challenge lies in the unpredictable nature of these "black box" models. Subtle, seemingly harmless changes to an input—such as swapping "want" for "hope"—can cause a model to produce incorrect labels or hallucinate, even when the underlying meaning remains unchanged.
Existing testing tools designed for smaller Deep Neural Networks (DNNs) struggle with the scale of LLMs and the complex interaction between prompts and examples. There is a critical need for a testing framework that is both effective at identifying these "blind spots" and efficient enough to minimize API query costs.
The AORTA Framework
To address these challenges, we present AORTA (AutOmated Robustness Testing frAmework), a modular system designed to treat the search for vulnerabilities as a combinatorial optimization problem.
AORTA is composed of four primary components:
- Goal Function: Defines the criteria for a "failed" test (e.g., a label flip).
- Perturbations: Specifies how to modify the text (e.g., synonym replacement, word swapping).
- Constraints: Ensures the generated text remains readable and grammatically correct.
- Search Method: The algorithm used to navigate the space of possible perturbations.
Adaptive Beam Search (ABS)
The core "engine" of AORTA is Adaptive Beam Search (ABS). While standard greedy searches often fail to find optimal perturbations and meta-heuristic searches are too slow for LLMs, ABS introduces two key innovations:
- Adaptive Beam Width: The algorithm dynamically adjusts the number of paths explored based on the success of current perturbations, saving time when paths are unproductive.
- Backtracking: If a search path hits a dead end, ABS can revert to a previous "best" state to explore alternative directions, preventing the algorithm from getting trapped in local optima.
Experimental Evaluation
We evaluated AORTA using three diverse text classification datasets: Financial Phrasebank (FP) for sentiment analysis, AG’s News for topic categorization, and Movie Reviews (MR) for sentiment polarity. These were tested against five prominent open-source models: Mistral-7b, Llama-2-13b, Internlm2-20b, Yi-34b, and Llama-2-70b.
Key Results
- Effectiveness: ABS achieved an average test success rate of 86.14%, significantly outperforming the previous state-of-the-art baseline, PWWS (~68%).
- Efficiency: ABS reduced computational overhead by up to 3,441 seconds per successful test case and required 218 times fewer queries on average than baseline methods.
- Quality and Naturalness: Test cases generated by ABS maintained high linguistic quality, with the lowest rate of grammatical errors (5.8 per case), ensuring vulnerabilities represent real-world risks.
- Transferability: Robustness flaws identified in smaller models often persisted in larger models (e.g., from Llama-2-13b to Llama-2-70b), suggesting these vulnerabilities are inherent to LLM language processing.
Conclusion
AORTA and the ABS algorithm provide a scalable, efficient, and effective solution for benchmarking the robustness of LLM-based NLP software. While currently focused on text classification, future work will extend the framework to generative tasks and multi-modal systems.
Summary updated