Model denial of service

Also known as: unbounded consumption · denial-of-wallet · LLM DoS

On this page 7

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.

TechniqueHow it worksResource exhausted
Context window floodingSends inputs near the maximum context lengthMemory and prefill compute
Output maximizationAsks for extremely long or repetitive answersDecode compute and tokens billed
Recursive agent loopsInduces an agent to call tools without endAPI calls and orchestration capacity
Sponge examplesCrafted inputs that maximize energy and latencyGPU time and power
Request volume abuseHigh request rates from many accounts or keysRate limits and shared capacity
Resource-heavy retrievalQueries that trigger large document fetchesVector search and embedding capacity
Common model denial of service techniques

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 modelPrimary impactTypical warning sign
Self-hosted GPU clusterQueue saturation and latency spikesRising time to first token
Pay-per-token APIUnexpected cost growthSpend alerts or quota exhaustion
Multi-tenant platformNoisy-neighbor effects on other customersFairness complaints across tenants
Agentic applicationRunaway tool usage and third-party feesAbnormally long agent traces
Impact by deployment model

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.

RiskRecommended controlReason
Very long inputsInput token limits per requestCaps prefill cost and memory
Very long outputsMaximum output tokens set server-sidePrevents unbounded generation
High request ratesRate limiting per key and userSpreads capacity fairly
Runaway agentsStep and tool-call budgetsStops infinite loops
Budget exhaustionHard spending caps and alertsLimits financial damage
Slow requestsTimeouts and request cancellationFrees capacity for other users
Controls against model denial of service

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.