PD3F: A Pluggable and Dynamic DoS-Defense Framework against resource consumption attacks targeting Large Language Models

Y Zhang, Xinyue Wang, Haoran Gao, Zhenhong Zhou, Fanyu Meng, Sen Su2025 · DOI

Introduction

As Large Language Models (LLMs) become central to modern computing infrastructure, their high operational costs have introduced a new security vulnerability: resource consumption Denial-of-Service (DoS) attacks. Unlike traditional attacks that seek to extract data or bypass safety filters, these "Sponge" attacks are designed to exhaust GPU memory and compute cycles. By forcing models to generate massive, repetitive, or computationally intensive outputs, attackers can effectively paralyze a server, driving up latency and denying service to legitimate users.

To address this, we present PD³F (Pluggable and Dynamic DoS-Defense Framework), a hardware-aware defense mechanism that monitors process-level behavior to identify and mitigate malicious requests in real-time. PD³F moves beyond traditional text-based filtering, offering a robust shield that can increase a server's capacity to handle benign users by up to 500% during active attacks.

The Challenge: Stealthy Resource Exhaustion

Existing LLM defenses typically focus on Natural Language Processing (NLP) techniques, such as detecting "jailbreak" keywords or measuring text perplexity. However, modern adversarial techniques like AutoDoS and GCG-DoS are specifically designed to be stealthy. These prompts often appear benign to standard filters but trigger "pathological" resource usage once the model begins generation.

The fundamental gap in current security is the lack of hardware-level awareness. Most systems treat the LLM as a black box, failing to correlate the input text with the actual GPU utilization and memory footprint it generates. PD³F bridges this gap by shifting the focus from what the text says to how the hardware behaves during processing.

The PD³F Architecture

PD³F is designed as a pluggable framework that can be integrated into existing LLM serving pipelines. It operates through three synergistic components: the Resource Index, Reputation-Based Scheduling, and Adaptive Suppression.

1. The Resource Index ($I_r$)

Instead of relying solely on prompt analysis, PD³F monitors process-level features during the inference phase. It calculates a comprehensive Resource Index ($I_r$) based on two primary metrics:

  • Consumption Index ($I_c$): This measures the raw intensity of resource usage, including reasoning time, GPU memory utilization, and the ratio of input tokens to output tokens.
  • Tendency Index ($I_t$): This utilizes cosine similarity to compare a request’s resource "fingerprint" against known clusters of benign and malicious behavior. This allows the system to identify patterns characteristic of DoS attacks even when the text itself looks normal.

2. Dynamic Request Polling Scheduling

To manage multi-user environments, PD³F replaces standard First-Come-First-Served (FCFS) scheduling with a reputation-based system. Every user is assigned a dynamic reputation score.

  • Rewards: Users who submit requests within normal resource bounds receive a "Short Request Reward," increasing their priority in the queue.
  • Penalties: Users exhibiting DoS-like resource consumption patterns receive heavy penalties, moving their subsequent requests to the back of the line. This ensures that even during a sustained attack, legitimate users maintain access to the model.

3. Adaptive End-Based Suppression

A common issue with DoS defense is the "hard-cut" problem, where a system abruptly terminates a long response, resulting in a poor user experience. PD³F introduces a "soft" termination mechanism. When a suspicious request exceeds a calculated resource threshold, the framework intervenes at the logit level, artificially boosting the probability of the <EOS> (End of Sequence) token. This "nudges" the model to conclude its generation naturally and coherently, but significantly sooner than the attacker intended, thereby reclaiming GPU resources without a jarring interruption.

Experimental Evaluation

PD³F was evaluated using six prominent models—including Llama-3.1, Qwen-2.5, and Mistral-v0.2—against a variety of attack vectors:

  • P-DoS: Poisoning-based attacks designed to break output limits.
  • GCG-DoS: Adversarial suffixes that induce long, rambling outputs.
  • AutoDoS: Black-box attacks that embed "Length Trojans" to exhaust resources.

Key Results

  • Throughput Improvement: Under heavy attack scenarios, PD³F improved Benign User Throughput (BUT) by up to 500% compared to standard FCFS scheduling.
  • Resource Efficiency: The framework successfully reduced the total time spent on malicious requests by at least 50%.
  • Detection Precision: The Resource Index achieved an F1 score exceeding 0.97 across all tested models, demonstrating a near-perfect ability to distinguish between long-winded benign users and malicious attackers.
  • Minimal Overhead: The computational cost of PD³F is negligible, with index calculation and schedule updates taking less than $10^{-2}$ seconds, ensuring no perceptible latency for the end-user.

Conclusion and Future Work

PD³F demonstrates that hardware-aware monitoring is a critical component of LLM security. By correlating resource consumption with user reputation and employing "soft" suppression techniques, the framework provides a powerful defense against sophisticated DoS attacks.

While current results are based on local server simulations, future research will focus on deploying PD³F in distributed cloud environments and exploring "resource-aware" training methods. Making LLMs inherently resistant to resource exhaustion at the architectural level remains the ultimate goal for securing the next generation of AI services.

Summary updated

BibTeX
@misc{zhang2025pd,
  author = {Y Zhang and Xinyue Wang and Haoran Gao and Zhenhong Zhou and Fanyu Meng and Yuyao Zhang and Sen Su},
  title = {{PD3F: A Pluggable and Dynamic DoS-Defense Framework against resource consumption attacks targeting Large Language Models}},
  year = {2025},
  doi = {10.18653/v1/2025.findings-emnlp.195},
}
Figure