What is a sponge attack?
A sponge attack uses inputs specially crafted to maximise the computation, energy and response time a neural network or language model spends on each one; even if the model answers correctly, the system slows, cost rises and other users sharing the resource suffer.
Unlike unbounded consumption in general, which many requests can also cause, a sponge attack reaches the same result with few but individually very expensive inputs. Limiting request counts alone is therefore not enough.
- Topic
- AI security
- Also known as
- Sponge examples, energy-latency attack
- Origin
- Shumailov et al., 2020
How a sponge attack works
- The attacker seeks input traits that most lengthen computation: text splitting into very long or unusual tokens, requests triggering long answers or long reasoning.
- Inputs maximising these traits are produced by trial and error or optimisation.
- Sent to the system, each costs many times more processing and time than an ordinary request.
- On shared GPUs, queues grow, other users' latency rises and energy and cost climb.
In more detail
Raising activation density and suppressing EOS
In the original 2020 formulation, sponge examples targeted hardware zero-skipping optimisations by maximising internal activation density (forcing sparse ASICs or pruned networks to perform dense work) and suppressed end-of-sequence (
Overthinking attacks on reasoning models
Because reasoning models (such as o-series, R1-style or thinking-enabled LLMs) generate thousands of internal reasoning tokens before producing a visible answer, an attacker can craft seemingly simple prompts, such as paradoxes, dense constraint puzzles or self-referential tasks, that consume the entire thinking budget and exhaust KV cache memory across shared inference workers.
Tokenisation blow-up and the quadratic cost of prefill
Attackers can also exploit subword tokenisers with inputs that fragment into an unusually high number of tokens per character (for example, rare Unicode blocks, zero-width characters or repeated single-character symbols), inflating attention cost quadratically (O(n²)) during prefill even when character-length filters allow the prompt through.
Commonly confused terms
| Term | How it differs |
|---|---|
| Distributed denial of service (DDoS) | Traditional DDoS floods an endpoint with massive request volume to exhaust network bandwidth or worker pools, whereas a sponge attack can succeed within normal rate limits using a small number of maximally expensive payloads. |
| AI unbounded consumption | OWASP LLM10 Unbounded Consumption is the broad risk category covering all excessive resource drain (including runaway agents, scraping and unthrottled APIs); a sponge attack is a specific adversarial technique designed to maximise per-input compute and energy. |
| Prompt injection | Token smuggling or jailbreaks aim to bypass safety policies and elicit prohibited content, whereas sponge attacks aim to degrade availability, latency and compute budgets even while producing benign, compliant answers. |
Why a sponge attack matters for on-premises AI
The research introducing sponge examples showed energy use in vision and language models can be raised 10 to 200 times and real-time decisions delayed. In language models long answers and long reasoning raise cost directly, so the risk is large. Controls: limits on input length and maximum output tokens, reasoning budgets, per-request time and compute limits, token-based rate limits, monitoring unusually expensive requests and quotas per user or department.
In a bank's in-house assistant, requests from one account that each trigger very long reasoning lengthen the GPU queue; the gateway enforces per-request token and time limits, flags unusually expensive requests and other users' latency returns to normal.
Common questions
How does a sponge attack differ from denial of service?
Classic denial of service floods a system with many requests. A sponge attack can do the same with few but individually very expensive inputs.
Which controls work against sponge attacks?
Input and output length limits, reasoning budgets, per-request time and compute limits, token-based rate limits and cost monitoring.
Related terms
Sources
- Shumailov et al., Sponge Examples: Energy-Latency Attacks on Neural Networks, 2020
- OWASP, LLM10:2025 Unbounded Consumption
In the glossary: Glossary, R to Z