Model denial of service is an attack in which an adversary sends inputs that make a machine learning model, most often a large language model, consume disproportionate compute, memory or money, so that the service slows down, fails for legitimate users or becomes too expensive to run. In AI security, it is the availability threat among the classic confidentiality, integrity and availability goals, and it is also known as LLM DoS, unbounded consumption or, when the main damage is financial, denial-of-wallet.
The threat differs from traditional network flooding because a single request can be expensive. Inference cost grows with input length, output length, tool calls and retrieval steps, so an attacker does not need millions of packets; a modest number of carefully crafted prompts can exhaust a GPU cluster or a monthly budget.
How model denial of service works
The attack exploits the asymmetry between request cost and response cost. Sending a prompt costs the attacker almost nothing, while processing it may require billions of floating-point operations per generated token. Transformer attention scales roughly quadratically with context length in naive implementations, and every output token requires another forward pass, so long inputs and long outputs multiply the load.
Modern applications add further amplification. An agent loop may call tools repeatedly, a retrieval step may fetch and embed many documents, and an orchestrator may retry failed calls automatically. Each layer can turn one user request into dozens of model invocations, which is why the risk is listed as unbounded consumption in the OWASP guidance for language model applications.
Attack techniques and variants
Attackers combine several techniques that target different resources. The table below lists the most common ones and the resource each exhausts.
| Technique | How it works | Resource exhausted |
|---|---|---|
| Context window flooding | Sends inputs near the maximum context length | Memory and prefill compute |
| Output maximization | Asks for extremely long or repetitive answers | Decode compute and tokens billed |
| Recursive agent loops | Induces an agent to call tools without end | API calls and orchestration capacity |
| Sponge examples | Crafted inputs that maximize energy and latency | GPU time and power |
| Request volume abuse | High request rates from many accounts or keys | Rate limits and shared capacity |
| Resource-heavy retrieval | Queries that trigger large document fetches | Vector search and embedding capacity |
The sponge attack, a neighboring Term, is a research-oriented variant that searches for inputs maximizing energy use or latency of a fixed model. Practical attacks against hosted language models more often rely on simple prompt patterns, because generation length is easy to influence through instructions.
Impact on availability and cost
The consequences fall into three categories of harm: degraded service for legitimate users, direct financial loss and collateral effects on shared infrastructure. In a pay-per-token setup, the denial-of-wallet outcome may arrive without any visible outage; the service stays up while the invoice grows by orders of magnitude.
| Deployment model | Primary impact | Typical warning sign |
|---|---|---|
| Self-hosted GPU cluster | Queue saturation and latency spikes | Rising time to first token |
| Pay-per-token API | Unexpected cost growth | Spend alerts or quota exhaustion |
| Multi-tenant platform | Noisy-neighbor effects on other customers | Fairness complaints across tenants |
| Agentic application | Runaway tool usage and third-party fees | Abnormally long agent traces |
Availability loss can also become a security problem in its own right. When a safety classifier or LLM firewall times out under load, a poorly designed system may fail open and pass unfiltered traffic, so denial of service can weaken other defenses.
Defenses and controls
Effective defense relies on layered resource limits rather than a single filter. Controls should bound each request, each user and the system as a whole, and they should apply before expensive computation starts. The decision table maps typical risks to recommended controls.
| Risk | Recommended control | Reason |
|---|---|---|
| Very long inputs | Input token limits per request | Caps prefill cost and memory |
| Very long outputs | Maximum output tokens set server-side | Prevents unbounded generation |
| High request rates | Rate limiting per key and user | Spreads capacity fairly |
| Runaway agents | Step and tool-call budgets | Stops infinite loops |
| Budget exhaustion | Hard spending caps and alerts | Limits financial damage |
| Slow requests | Timeouts and request cancellation | Frees capacity for other users |
Further measures include cost-aware admission control, which estimates the token cost of a request before scheduling it, caching of repeated prompts, and monitoring of per-user token consumption to flag accounts whose usage pattern deviates from normal behavior. Frameworks such as MITRE ATLAS and NIST AI 100-2 describe these availability threats and help teams include them in AI threat modeling.
Common mistakes in mitigation
Many incidents result from limits that exist but are set too generously or enforced in the wrong place. Typical mistakes include the following.
- Trusting client-side limits, which an attacker can simply remove.
- Counting requests instead of tokens, so a few huge prompts pass unnoticed.
- Leaving agent loops unbounded because normal tests always terminate quickly.
- Sharing one API key across many users, which defeats per-user rate limits.
- Letting security filters fail open when they are overloaded.
In plain words
An AI model needs much computing power for every answer. Long questions and long answers need even more. Model denial of service means someone sends requests that make the model work far too hard on purpose.
Picture a restaurant where one guest orders every dish on the menu, again and again. The kitchen slows down for everyone else, and someone has to pay for the food. The fix is to set clear limits on how much each guest can order.
A real-world example
A small software company runs a customer support chatbot on a hosted language model billed per token. The developers set no maximum output length and allow anonymous visitors to chat without a login. A script begins sending thousands of prompts that ask the bot to repeat a long text many times and to answer in the greatest possible detail.
Within a weekend, token usage grows to roughly forty times the normal level. The chatbot still responds, so uptime monitoring raises no alarm, but the monthly budget is consumed in two days and the provider suspends the account for exceeding its quota. Legitimate customers lose support access on Monday morning.
The team responds by adding per-session token budgets, a server-side output cap of 800 tokens, login for long conversations and a daily spending alert. Repeat attempts are now cut off within minutes, and costs return to their usual range.