Skip to content

Sponge Examples: energy consumption and latency attacks against neural networksSponge Examples: Energy-Latency Attacks on Neural Networks

arXiv· arXiv:2006.03463· EuroS&P 2021· Ilia Shumailov, Yiren Zhao, Daniel Bates, Nicolas Papernot, Robert Mullins, Ross AndersonUniversity of Cambridge; University of Toronto; Vector InstituteIndexed by this site · 27 days ago· Originally publishedSelected AttacksSelectedAttention43

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose the sponge examples attack, using specially crafted inputs to raise the energy consumption and latency of neural network inference; the authors state that for Azure Translator with 50-character input, latency rises from 1ms to 6s (6000×).

Threat modelThe attacker can submit input samples to the target system, which are processed by a single CPU, GPU, or ASIC; no rate limiting (other than the device's own dynamic power control or thermal throttling), no physical access. Three settings: white-box (knows architecture and parameters), interactive black-box (can query arbitrarily and remotely measure latency or energy), blind adversary (no knowledge, no measurement, directly transfers existing sponge examples).

Questions
The energy consumption and latency of neural network inference vary with input content, whereas hardware and algorithm optimizations focus only on the average case. The authors care about the security dimension of availability: whether an attacker can use specially crafted inputs to push an ML system toward worst-case performance, causing denial of service.
Methods
Propose sponge examples: use a genetic algorithm (white-box uses estimated energy, black-box uses measured latency or energy as fitness) or L-BFGS (maximizing activation values at each layer) to search for inputs that maximize inference energy consumption and latency, and analyze two causes: computational dimensions and data sparsity.
Experiments and results
Experiments on SuperGLUE, WMT translation, and ImageNet models and CPU/GPU/ASIC simulators. The authors state that on language models energy consumption and latency often rise to 30×, and for Azure Translator with 50-character input latency rises from 1ms to 6s; vision models show only a 1–3% energy increase.
Limitations and future work
The authors state that the attack assumes per-sample processing and that results vary with hardware platform and even weather (differences of up to 10× on two similar servers); on GPUs the differences for vision tasks are too small to measure reliably; frequency and temperature attacks and collaborative attacks in federated learning are left as future directions.
Experimental setupRoBERTa、WMT14 En→Fr Transformer [64] et al. · SuperGLUE (CoLA, MNLI, WSC)、WMT14/16 En→Fr、En→De et al. · GPU Energy [mJ]、ASIC Energy [mJ] et al.
Evaluated models
RoBERTaWMT14 En→Fr Transformer [64]WMT16 En→De Transformer [64]WMT18 En→De Transformer [65]WMT19 En→Ru Transformer [66]Microsoft Azure TranslatorResNet-18ResNet-50ResNet-101DenseNet-121DenseNet-161DenseNet-201MobileNet-V2GoogLeNet
Benchmarks
SuperGLUE (CoLA, MNLI, WSC)WMT14/16 En→Fr、En→DeWMT18 En→DeWMT19 En→RuImageNet-2017
Metrics
GPU Energy [mJ]ASIC Energy [mJ]GPU TimeEnergy ratioPost-ReLU / Overall densitylatency degradation factor
AI summaryand selection rationaleResearchers propose the Sponge Examples attack, using specially crafted inputs to maximize the energy consumption and latency of neural network inference; the authors call it the first denial-of-service attack against the ML components of such systems. The attack includes gradient-based white-box methods and genetic-algorithm-based black-box methods, and is effective on CPUs, GPUs, and ASIC simulators; language models are especially vulnerable, with energy consumption and latency often amplified 30-fold, and the mechanism exploits the tokenizer's subword splitting of rare words and hardware optimization for data sparsity to amplify computation. In a real test, a 50-character input raised the response time of the Microsoft Azure translation service from 1ms to 6s (6000-fold); the researchers notified Microsoft following responsible disclosure procedures, and the attack has been added to MITRE's AI security attack framework (https://github.com/mitre/advmlthreatmatrix)。视觉任务上效果较弱,能耗仅增加 1-3%; the defense approach proposed by the authors is to shift energy analysis from the average case to the worst case and set thresholds for the inference cost of natural samples.

Researchers propose the Sponge Examples attack, using specially crafted inputs to maximize the energy consumption and latency of neural network inference; the authors call it the first denial-of-service attack against the ML components of such systems. The attack includes gradient-based white-box methods and genetic-algorithm-based black-box methods, and is effective on CPUs, GPUs, and ASIC simulators; language models are especially vulnerable, with energy consumption and latency often amplified 30-fold, and the mechanism exploits the tokenizer's subword splitting of rare words and hardware optimization for data sparsity to amplify computation. In a real test, a 50-character input raised the response time of the Microsoft Azure translation service from 1ms to 6s (6000-fold); the researchers notified Microsoft following responsible disclosure procedures, and the attack has been added to MITRE's AI security attack framework (https://github.com/mitre/advmlthreatmatrix)。视觉任务上效果较弱,能耗仅增加 1-3%; the defense approach proposed by the authors is to shift energy analysis from the average case to the worst case and set thresholds for the inference cost of natural samples.

Why it was selectedThe paper proposes sponge sample attacks and empirically measures that language model energy consumption and latency can be amplified by tens of times, suggesting that average-case optimization of ML services expands the attack surface.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors propose sponge examples: maximizing the energy consumption and latency of neural network inference through specially crafted inputs, attacking the availability of ML systems.

    Core question: can specially crafted inputs push neural network inference toward worst-case energy consumption and latency, thereby launching denial-of-service attacks on ML systems.

    • Problem setting: the authors note that existing attacks such as adversarial examples and data poisoning target confidentiality or integrity, whereas availability, one of the three elements of security, has been little studied in ML; the NIST draft on adversarial machine learning mentions availability but gives no attack examples.
    • Why it matters: ML-as-a-Service bills per query rather than per energy consumption, edge devices depend on batteries, and real-time systems such as autonomous driving have strict latency constraints; pushing a system toward worst-case performance can cause service disruption, battery drain, or failure of safety-critical systems.
    • Core observation: inputs of the same size can cause a DNN to consume vastly different time and energy, which the authors call the energy-latency gap; causes include hardware optimizations (exploiting input sparsity) and algorithmic characteristics (e.g., autoregressive models having a variable number of computation rounds for same-size inputs).
    • What the paper proposes: two methods for generating sponge examples (genetic algorithm and L-BFGS), covering three threat models—white-box, interactive black-box, and blind adversary—and a defense approach bounded by worst-case performance.
    • Threat model:
      • Goal: maximize the energy consumption and latency of a single inference of the target model, denial-of-service.
      • Knowledge: white-box knows architecture and parameters; interactive black-box does not know the internals but can query arbitrarily and remotely measure latency or energy; blind adversary has no knowledge and no measurement, and directly transfers existing examples.
      • Capability: can only supply input samples; no rate limiting (other than the device's own dynamic power control or thermal throttling); no physical access, cannot modify hardware configuration.
      • Victim system: an ML system that processes inputs with a single CPU, GPU, or ASIC, covering ML-as-a-Service and on-device processing.
  2. What related research exists?

    Related work falls into four groups: ML security attacks, energy attacks, hardware acceleration and sparsity optimization, and ML energy research; the authors report that this paper is the first denial-of-service attack targeting ML components.

    Machine learning security

    • Biggio et al. (2013), Szegedy et al. (2013): adversarial examples cause models to misclassify; white-box uses gradient optimization, black-box can transfer (Papernot et al., 2017) or approximate gradients with finite differences (Chen et al., ZOO, 2017).
    • Nelson et al. (2008), Jagielski et al. (2018): data poisoning manipulates a model's future performance; Hong et al. (2019): runtime bit errors substantially degrade performance. The authors note that these attacks target confidentiality or integrity, whereas this paper targets availability.
    • Erba et al. (2019): poisoning against industrial control systems can be regarded as an availability attack; the authors note that this paper does not poison data but instead targets the algorithmic complexity of hardware or models.

    Energy attacks

    • Palmieri et al. (2015), Xu et al. (2014): data center power attacks, exploiting power oversubscription to cause service disruption.
    • Martin et al. (2004), Fiore et al. (2014): battery-drain attacks against mobile devices; Tang et al. (CLKSCREW, 2017): using energy management for deterministic fault injection.

    Hardware acceleration and sparsity

    • Jouppi et al. (2017)'s TPU, Chung et al. (2018)'s BrainWave, Hazelwood et al. (2018)'s Big Basin: data center DNN acceleration hardware, pursuing operations per watt.
    • ASIC accelerators such as Eyeriss v2 (2019), EIE (2016), SCNN (2017) exploit runtime data sparsity (zero-skipping multiplication, compressed DRAM access); the authors note that the attacks in this paper specifically target such optimizations.

    ML energy consumption and carbon emissions

    • Strubell et al. (2019), Henderson et al. (2020), Lacoste et al. (2019): focus on the energy consumption and carbon emissions of training large models; the authors state that this paper shows fine-grained energy consumption during inference also needs study.

    Baselines and comparison setup: the attacks in this paper do not compare against other attack methods; the in-experiment controls are natural (evaluation dataset samples) and random (random strings/random pixels) inputs, and the white-box GA attack serves as a baseline in the black-box experiments (Section 5.3).

    Authors' positioning: the authors state that sponge examples are the first denial-of-service attack targeting ML components, bringing classic DoS from the network layer to the application layer and achieving amplification by targeting the most expensive computation parts of models.

  3. How does the paper address this problem?

    Use a genetic algorithm or L-BFGS to search for inputs that maximize inference energy consumption and latency, exploiting two sources of the energy gap: computational dimensions and data sparsity.

    Overall approach: find inputs that make a single inference perform the most arithmetic operations and memory accesses (sponge examples), use genetic algorithms (GA) to cover White-box and Black-box, use L-BFGS for White-box gradient optimization, and give a physical model of energy consumption explaining the parameters attackers can influence.

    Energy Model and Attack Surface

    • Energy E=(Pstatic+Pdynamic)× t; after expansion, attackers can influence four parameters: temperature T, activity rate α, frequency f, and time t.
    • The authors report that sponge examples directly exploit α and t (closely related to the number of operations and memory accesses); f and T can only be indirectly affected by hardware optimization, and the authors assume they could also be used for hardware-level availability attacks, but this is beyond the scope of this paper.

    Two Energy Gap Hypotheses

    • Computational dimensions (Hypothesis 1): Models such as Transformer translation are autoregressive, and the number of input tokens ltin, number of output tokens ltout, and embedding dimensions lein/leout determine the amount of computation; the main loop complexity is O(ltin × lein × ltout × leout). Attackers do not change the number of input characters, but merely split words into more subword tokens via the tokenizer/BPE and induce longer outputs, thereby nonlinearly amplifying computation.
    • Data sparsity (Hypothesis 2): ReLU makes activations sparse, and ASIC accelerators exploit sparsity by skipping multiplications with zeros and compressing DRAM accesses; inputs that make activations denser increase operations and memory accesses, thereby increasing energy consumption.

    Attack Methods

    • White-box GA: Accesses model parameters and runtime information, using operation counts estimated from runtime sparsity as fitness.
    • Black-box GA: Accesses no internal information, directly using measured hardware cost (latency or energy) as fitness.
    • L-BFGS (White-box): Optimization objective −∑al ∈ A |al|2, i.e., maximizing activation values at all layers so that hardware cannot skip operations; due to the discreteness of NLP, evaluated only on vision tasks.
    • blind adversary: Does not query the target, directly transferring discovered sponge examples to new models or new hardware.

    Genetic Algorithm Procedure (Algorithm 2)

    • Randomly initialize a sample pool (sentences for NLP, images for CV), then iterate: measure fitness (latency or energy) → select top 10% as parents → crossover and mutation.
    • NLP crossover: concatenate the left half of parent A with the right half of B, and probabilistically flip the two halves; CV crossover: mix A ∗ mask + (1 − mask) ∗ B with a random mask; then randomly mutate some features (words or pixels).
    • Parameters: pool size 1000 for GLUE and CV benchmarks, 1000 for translation tasks, all benchmarks run 1000 GA iterations (Appendix A); Azure experiments use a pool of 500, 50 rounds, with input fixed at 50 characters.

    Domain-Specific Optimizations (Appendix C)

    • NLP: GA spontaneously exploits encoding scheme loopholes (e.g., inserting backslashes to split subwords), characters are lost at concatenation points, and probabilistically flipping the two halves gives slight improvement.
    • CV: Random samples are always classified into the same class and have low density; uniform random mutation dilutes class features, so only 1% of pixels are mutated; at least 20 different classes are kept in the pool to maintain diversity. Operations such as rotation, transposition and scaling showed no improvement.

    Measurement and Platforms

    • CPU: Intel Xeon E5-2620 v4, energy measured with RAPL; GPU: GeForce 1080 Ti (250W power limit, 84°C throttling, 96°C slowdown), measured with NVML.
    • ASIC: a custom deterministic simulator that records runtime operation and DRAM access counts, converted using Horowitz's 45nm/0.9V data (32-bit DRAM access 1950 pJ, floating-point multiplication 3.7 pJ).
  4. What experiments did the paper conduct?

    Three threat models tested on SuperGLUE/WMT/ImageNet models and CPU/GPU/ASIC simulators; the authors report language model energy latency often reaching 30×, and Azure Translator 6000×.

    Experimental Setup

    • Models under test (NLP): RoBERTa in the FairSeq framework (CoLA, MNLI, WSC from SuperGLUE), Transformer translation models for WMT14/16 En→Fr and En→De, WMT18 En→De, WMT19 En→Ru; plus the real deployed Microsoft Azure Translator.
    • Models under test (CV): TorchVision's ResNet-18/50/101, DenseNet-121/161/201, MobileNet v2 (3.4M to 49M parameters), with the task being ImageNet-2017 classification.
    • Attack variants: White-box GA, Black-box GA (with GPU energy and GPU time as fitness, respectively), White-box L-BFGS (CV only), blind transfer.
    • Controls: natural (evaluation set samples), random (randomly generated samples); Black-box experiments use White-box GA as the baseline.
    • Metrics: GPU energy (NVML, mJ), ASIC simulator energy (mJ), GPU time (mS), multiples of energy/time relative to natural; for CV, additionally Energy ratio (energy ratio of the sparsity-optimized ASIC to the unoptimized ASIC) and activation density.
    • Parameters and repetitions: GA in Table 1 runs 1000 rounds with a pool of 1000; Table 2 runs 100 rounds with a pool of 1000; Azure experiments use a pool of 500, 50 rounds, 4 consecutive runs; ASIC measurements report standard deviation (Table 5).

    Main Results

    Table 1 (White-box GA, NLP, multiples of sponge relative to natural):

    Swipe horizontally to read the table

    Task (input length)GPU energyASIC energyGPU time
    CoLA (50)2.06×1.53×1.27×
    MNLI (50)2.16×1.51×1.30×
    WSC (50)26.64×14.22×20.56×
    WMT14/16 En→Fr (15)4.32×4.74×3.89×
    WMT14/16 En→De (15)27.84×30.83×24.18×
    WMT18 En→De (15)30.81×30.55×26.49×
    WMT19 En→Ru (15)26.43×25.26×22.85×
    • The authors report that sponge has the highest energy on both GPU and ASIC, reaching 26× when most favorable to the attacker (GPU energy for WSC with input 50 is 26.64×); random samples also consume more energy than natural samples, and the authors accordingly claim random noise can serve as a scalable Black-box attack tool ("barrage jamming").
    • The authors report that the main cause of performance degradation is the increase in computational dimensions: the attack maximizes the tokenized representation length and the output sequence length, and the coupling of these two with internal computation brings near-quadratic growth.
    • For fast tasks (such as CoLA), GPU time degradation is not large, while latency for time-consuming tasks rises to 30×; the ratio of energy degradation multiple to time degradation multiple is between 1.15–1.66 (Table 4), with energy growing faster.

    Interactive Black-box and Azure Case

    • Black-box GA (Figure 2): For WMT14 En→Fr (input 15, pool 1000), Black-box attackers using GPU energy or GPU time as fitness can increase energy and time without knowing the model internals; with time as fitness the noise is greater, while energy is more stable. The authors report that attacks can transfer across hardware and measurement proxies (e.g., an attack targeting GPU time also increases ASIC energy).
    • Azure Translator (Figure 3): Black-box, with latency only as fitness, input 50 characters, pool 500, 50 rounds, 4 consecutive runs; the authors report latency rising from a natural-sample baseline of 1ms to a maximum of 6s (6000×), with all four runs converging. The authors report they could not know actual energy consumption, but infer from the Section 5 results that the energy increase should also be on the order of thousands of times; they also observed large performance fluctuations within the pool, suspecting a connection to Azure's caching mechanism; Azure gave >0.9 confidence for sponge predictions.
    • Ethical measures: The authors report paid use, about 200k queries, only 50 characters used (limit 10000), running at night in the data center's time zone, execution sample by sample, and disclosure to Microsoft; sponge examples have been added to MITRE's AI security attack framework.

    Blind Transfer and Vision Models

    • Blind Black-box transfer (Table 2): Sponge generated from WMT16 En→De transferred to WMT14 En→Fr, WMT18 En→De, WMT19 En→Ru shows higher energy and latency than natural samples on ASIC/GPU/CPU (e.g., transfer to WMT14 En→Fr: GPU energy 2.81×, GPU time 1.95×); the same-model White-box control reaches GPU energy 40.94×. The authors report that blind attacks do not reach the degradation level of the White-box baseline.
    • Vision White-box (Table 3): The two attacks, GA and L-BFGS, increase energy by only 1–3% relative to natural samples on 7 ImageNet models (ASIC simulator); both post-ReLU density and overall density rise, with L-BFGS having the highest density on most models. The authors report that the density effect is concentrated in the first few layers.
    • Vision transfer and statistical tests (Figure 4, Appendix D.1): Except for MobileNet, transferred sponge increases internal density in each network and outperforms random noise; MobileNet's sponge energy is 1.5% higher than natural samples on CPU and >7% on ASIC, and the Mann-Whitney U test (one-sided p=0.000) indicates that the energy distributions of the three sample types are statistically different; on GPU the standard deviation exceeds 15%, making evaluation impossible. The authors report that CNN computation pipelines are structured and input sizes fixed, so only hardware that exploits fine-grained sparsity is easily attacked.

    Other Ablations and Analysis

    • Pool size (Figure 6, Appendix A): For the WSC task with word length 29, pools of 100–900 show only marginal improvement from larger pools, while small pools significantly shorten attack time.
    • Number of GA iterations (Appendix A): For almost all tested input lengths, convergence occurs within 100 iterations, with only small improvement beyond 1000.
    • Class density (Figure 5, Appendix D): ImageNet natural samples show inter-class density differences, with some classes (e.g., 'greenhouse', 'howler monkey') consistently denser, and this is consistent across architectures; the authors report that attackers can directly use natural samples from high-energy classes to attack.
    • Energy-time relationship (Table 4): The Time×/Energy× ratio for each NLP task is 1.11–1.66.
    • Reproducibility (Section 8): The authors report that attack effectiveness varies greatly with hardware platform and even weather, with energy and latency differences of up to 10× between two similarly configured servers; the authors released the sponge samples, attack code and ASIC simulator.
  5. What are some points that can be further explored?

    The authors list limitations such as per-sample assumptions and measurement difficulty, and propose directions such as frequency-temperature attacks, federated learning collaborative attacks, and defense thresholds.

    Limitations and future directions noted by the authors

    • Per-sample assumption (Section 7.1): the attack assumes only one sample is processed at a time; the authors state that more complex attacks could let samples interact, and collaborative attacks in federated learning are a natural future direction.
    • Frequency and temperature attacks (Section 4.3): the authors assume f and T could also be exploited (e.g., forcing throttling or heating the device), but explicitly state this is beyond the scope of this paper.
    • Measurement difficulties (Section 6.2, Appendix D.1): GPU hardware thermal control and the resolution of measurement tools are insufficient, and energy differences for vision tasks are too small to observe reliably on GPUs; GPU energy standard deviation exceeds 15%.
    • Reproducibility (Section 8): attack effectiveness varies greatly with hardware platform and even weather, with energy and latency differences of up to 10× on two similarly configured servers.
    • Defense directions (Section 7.2): profile energy/latency on natural samples before deployment and set threshold upper bounds; real-time systems need to be designed for worst-case performance and provide fallback mechanisms; the authors state that research is needed on the sensitivity of hardware that does not exploit sparsity (e.g., TPU) to sponge, and that when prevention is impossible, detection may be the better strategy.
    • Use for security testing (Section 7.1): the authors state that the sponge method can be used for routine security testing and for automatically discovering timing side channels and potential dependencies between components.

    Scope of experiments

    • 14 models tested in total: 5 FairSeq NLP models (RoBERTa and 4 WMT Transformers), 7 TorchVision vision models, 1 real deployed service (Microsoft Azure Translator), and 1 white-box transfer control of the same model.
    • Hardware platforms are 1 CPU (Xeon E5-2620 v4), 1 GPU (GeForce 1080 Ti), and 1 self-developed ASIC simulator; no measurements were made on a real ASIC or TPU.
    • NLP input lengths are 15/30/50 characters, with the Azure experiment fixed at 50 characters; vision tasks use fixed-size ImageNet-2017 inputs.
    • Statistical tests report only the Mann-Whitney U test for MobileNet on CPU (p=0.000); the paper does not report the number of repetitions for the main NLP table or the standard deviation of GPU measurements.
    • Defenses are only proposed as ideas of threshold profiling and worst-case design; the paper does not implement or evaluate any defense.
  6. Summarize the main content of the paper

    The authors propose the sponge examples attack targeting ML availability; on language models energy and latency rise to about 30×, and for Azure Translator 6000×, and they propose a worst-case defense approach.

    An availability attack paper: targeting the energy consumption and latency of neural network inference, it proposes sponge examples—inputs that make the model do the most computation without changing input size, pushing the system to worst-case performance and constituting denial of service.

    • Problem addressed: Existing adversarial attacks target confidentiality and integrity, while availability is neglected; hardware (sparsity optimization) and algorithms (autoregressive variable computation) create an energy-latency gap between average and worst-case performance.
    • Method highlights: White-box/Black-box genetic algorithms evolve inputs using fitness (estimated energy or measured latency/energy); White-box L-BFGS maximizes activation values at each layer; in the blind setting, samples are transferred directly. Covers three threat models: White-box, interactive Black-box, and blind adversary.
    • Main NLP results: Under White-box GA, WMT18 En→De (input 15) has GPU energy 30.81× and ASIC energy 30.55×; WSC (input 50) has GPU energy 26.64×; random samples also consume more energy than natural samples (Table 1).
    • Real service: A Black-box attack on Microsoft Azure Translator (50-character input, latency only as fitness) raises response time from 1ms to 6s (6000×), with all 4 runs converging (Figure 3); disclosed and added to the MITRE attack framework.
    • Vision and transfer: On ImageNet models energy increases by only 1–3% (Table 3), which the authors attribute to the structured computation of CNNs; sponge can transfer across models and across CPU/GPU/ASIC simulators, but blind attacks are weaker than the White-box baseline.
    • Authors' conclusions: Energy analysis should shift from average case to worst case; pre-deployment profiling plus threshold caps, and real-time systems designed for worst case with fallback mechanisms; the authors report that rate limiting is insufficient to defend against such attacks.
Read originalEuroS&P 2021