AQUA-LLM: Evaluating Accuracy, Quantization, and Adversarial Robustness Trade-offs in LLMs for Cybersecurity Question Answering

Onat Güngör, Roshan Sood, Harold Wang, Tajana RosingarXiv 2025 · DOI

Abstract

Researchers from UC San Diego introduce AQUA-LLM, a framework designed to evaluate the critical balance between predictive accuracy, computational efficiency, and adversarial security in small Large Language Models (LLMs) tailored for cybersecurity tasks. The study investigates the impact of 4-bit quantization on model vulnerability and explores how task-specific fine-tuning can mitigate these risks. Key findings suggest that Fine-tuned Quantized (FTQ) models not only recover accuracy lost during compression but also demonstrate superior adversarial robustness compared to standard fine-tuned models, positioning FTQ as a viable strategy for edge deployment in sensitive security environments.

Introduction

Deploying Large Language Models (LLMs) for real-time cybersecurity—such as interpreting intrusion alerts or answering security queries—presents a significant challenge at the "network edge." Devices like local routers or power grid sensors demand low latency and high privacy, yet LLMs are notoriously resource-intensive. To bridge this gap, engineers often employ quantization, reducing numerical precision (e.g., from 16-bit to 4-bit) to fit models onto constrained hardware.

However, this compression is a double-edged sword. While it drastically reduces memory footprints, it often degrades predictive accuracy and makes models significantly more susceptible to adversarial prompt injections. These malicious inputs are designed to manipulate the AI into leaking sensitive data or providing dangerous advice. The AQUA-LLM framework was developed to explore whether fine-tuning can bridge this security gap and how accuracy, efficiency, and robustness interact in specialized domains.

Methodology: The AQUA-LLM Framework

The authors benchmarked six "edge-friendly" open-source models, including Meta-Llama-3.1-8B, Mistral-7B, and DeepSeek-R1, across four distinct configurations:

  1. Base (B): The original pre-trained model.
  2. Quantized (Q): 4-bit NormalFloat (NF4) quantization, reducing memory footprint by approximately 75%.
  3. Fine-tuned (FT): Utilizing Low-Rank Adaptation (LoRA) to specialize the model for cybersecurity QA.
  4. Fine-tuned Quantized (FTQ): Fine-tuning the model specifically while in its quantized state.
The AQUA-LLM evaluation workflow, from pre-trained models through quantization and fine-tuning to adversarial testing.

The framework evaluates these configurations on two primary fronts: Predictive Accuracy via multiple-choice QA and Adversarial Robustness using the DeepTeam Red Teaming Framework to simulate direct prompt injection attacks.

Datasets

The study utilizes two primary cybersecurity benchmarks to ensure domain-specific rigor:

  • CyberBench: A multi-task benchmark covering named entity recognition, summarization, and classification, adapted into a multiple-choice QA format.
  • CyberMetric: A RAG-based (Retrieval-Augmented Generation) dataset curated for cybersecurity knowledge and validated by domain experts.

Key Results and Insights

The "FTQ" Sweet Spot

The most significant finding is that Fine-tuned Quantized (FTQ) models often exhibit better robustness than models that are only fine-tuned. Quantization appears to act as a form of regularization, preventing the model from over-relying on specific patterns that attackers typically exploit. This suggests that the combination of compression and specialization can yield a model that is both efficient and more resilient than its full-precision counterparts.

Quantization as a Security Risk

Without intervention, quantization is disastrous for security. As shown in the Attack Success Rate (ASR) metrics, quantizing a base model can increase its vulnerability by up to 16x. For instance, the Llama-3.1-8B model saw its ASR spike from negligible levels to nearly 80% upon quantization.

Attack Success Rate (ASR) across different model configurations on CyberBench and CyberMetric datasets.

Performance Recovery

Fine-tuning proved essential for domain utility. It propelled average accuracy from approximately 70% to over 97-98% across both datasets. Furthermore, 4-bit quantization provided a 1.28x inference speedup and reduced GPU memory consumption by 75%, making these high-performing models viable for edge deployment.

Conclusion

The AQUA-LLM study highlights that specialization does not inherently equal safety. Models specifically pre-trained for security (like Foundation-Sec-8B) achieved top-tier accuracy but demonstrated alarmingly poor robustness. The research advocates for "quantization-aware, robustness-preserving" fine-tuning as the gold standard for deploying secure AI at the edge. Future work will expand the attack scope to include indirect injections and backdoors, as well as testing these trade-offs on ultra-small (1B) and larger (70B+) model architectures.

Summary updated

BibTeX
@misc{gungor2025aqua,
  author = {Onat Güngör and Roshan Sood and Harold Wang and Tajana Rosing},
  title = {{AQUA-LLM: Evaluating Accuracy, Quantization, and Adversarial Robustness Trade-offs in LLMs for Cybersecurity Question Answering}},
  year = {2025},
  eprint = {2509.13514},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.13514},
}
Figure