BASFuzz: Towards Robustness Evaluation of LLM-based NLP Software via Automated Fuzz Testing

Pengcheng Zhang (张鹏程), Mingxuan Xiao, Yan Xiao, Shunhui Ji, Jiahe Tu, Pengcheng ZhangarXiv 2025 · DOI

Abstract

As Large Language Models (LLMs) transition from research environments to critical industrial applications, their inherent "brittleness" becomes a significant liability. This paper presents BASFuzz, a novel automated fuzz testing framework designed to evaluate the robustness of LLM-based software, particularly in complex Natural Language Generation (NLG) tasks. BASFuzz combines a "Beam-Annealing" search strategy with semantic-aware mutations to uncover vulnerabilities that cause models to produce incorrect or contradictory outputs. Experimental results show that BASFuzz achieves a 90.3% success rate in identifying failures while maintaining high efficiency and stealth compared to state-of-the-art baselines.

Introduction

The deployment of LLMs in domains such as law and healthcare necessitates high reliability. However, these models often exhibit extreme sensitivity to minor, semantically insignificant changes in input prompts. A simple synonym swap can lead to catastrophic errors, such as altering a legal translation from a permissive "may" to an obligatory "must."

A subtle perturbation in the input text causes the LLM to flip the meaning of a legal translation from 'may' to 'must'.

Existing testing frameworks, or "fuzzers," struggle with two primary issues: poor coupling between prompts and data, and a failure to adapt to the high-dimensional output space of generative tasks. BASFuzz addresses these gaps by treating the prompt and task examples as a unified testing unit and optimizing for generative consistency.

Methodology

BASFuzz introduces a mutation-based fuzzing loop centered on four core innovations:

  1. Beam-Annealing Search: This hybrid algorithm utilizes Beam Search to maintain multiple perturbation paths, ensuring broad coverage. It integrates Simulated Annealing to occasionally accept suboptimal mutations, allowing the search to escape local optima and discover deeper vulnerabilities.
  2. Semantic-Aware Mutation: To maintain human readability and semantic integrity, the framework uses Open Multilingual WordNet (OMW) for lexical retrieval. It further employs Gemma2-based word embeddings to ensure that chosen synonyms are contextually appropriate.
  3. Entropy-Based Adaptive Adjustment: BASFuzz dynamically manages computational resources by calculating the information entropy of the candidate pool. High entropy (diversity) triggers an expansion of the search width, while low entropy (homogeneity) narrows it to improve efficiency.
  4. Probabilistic Elitism: The framework tracks effective "bugs" and grants them a high probability of survival into subsequent testing rounds, balancing the exploitation of known flaws with the exploration of new adversarial space.

Experimental Evaluation

The authors evaluated BASFuzz against five mainstream LLMs: Mistral-7B, Phi-4, InternLM2.5-20B, Yi-1.5-34B, and Llama-3-70B. The evaluation spanned two primary domains:

  • Machine Translation (NLG): Utilizing the WMT16 dataset for Czech-to-English, German-to-English, and Russian-to-English pairs.
  • Text Classification (NLU): Using Financial Phrasebank, AG’s News, and Movie Review datasets to demonstrate scalability.

Key Results and Insights

BASFuzz demonstrated superior performance across several metrics:

  • Effectiveness: The framework achieved an average success rate of 90.335% in NLG tasks, significantly outperforming existing baselines.
  • Efficiency: BASFuzz reduced the average time required to generate a successful test case by approximately 36 minutes (2,163.852 seconds) compared to the next best baseline.
  • Stealth and Quality: Test cases produced by BASFuzz exhibited lower perplexity and fewer grammatical errors. By achieving lower "change rates," the adversarial examples remain covert and realistic to human observers.
  • Cross-Model Transferability: Vulnerabilities discovered in smaller models like Phi-4 often successfully compromised larger models like Llama-3, suggesting that robustness flaws are rooted in shared linguistic patterns.

Conclusion

BASFuzz represents a significant advancement in the robustness testing of generative AI. By focusing on the unique challenges of NLG, it provides a more realistic assessment of how LLMs might fail in production. Future work will focus on expanding the framework to logographic languages and exploring white-box testing methods to uncover even more subtle model failures.

Summary updated

BibTeX
@misc{2025basfuzz,
  author = {Pengcheng Zhang (张鹏程) and Mingxuan Xiao and Yan Xiao and Shunhui Ji and Jiahe Tu and Pengcheng Zhang},
  title = {{BASFuzz: Towards Robustness Evaluation of LLM-based NLP Software via Automated Fuzz Testing}},
  year = {2025},
  eprint = {2509.17335},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.17335},
}
Figure