Skip to content

Perplexity-aware black-box attacks with diffusion language modelsDiffusion Language Models for Perplexity-Aware Black-Box Attacks

arXiv: Jailbreaks, Prompt Injection, Poisoning & Defenses· arXiv:2610.31558· Ali Al-Lawati, Elsayed Eshra, Dongwon Lee, Suhang WangThe Pennsylvania State UniversityIndexed by this site · 2026-10-23· Originally publishedAttacks

Quick read

Attacks

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

The authors replace the random mapping in continuous-space attacks with the continuous diffusion language model Cola-DLM, lowering the character-level perplexity of RareTrap hit prompts from 10^3–10^7 to 3–5.

Threat modelThe attacker queries the black-box target LLM only through its outputs (black-box access), with the goal of triggering resource-consuming behavior such as overthinking/over-generation; continuous-space attacks sample or optimize in a low-dimensional Gaussian latent space and decode into prompts via a mapping, and this paper replaces only that mapping, leaving the search pipeline and the target access method unchanged.

Questions
Continuous-space attacks use a random mapping to decode Gaussian latent variables into prompts to attack black-box LLMs, but the generated prompts have high perplexity and are easily detected by input guardrails, and risk estimates based on such prompts do not represent risk under natural inputs.
Methods
The random mapping and nearest-neighbor decoding are replaced with the generation process of the pretrained continuous diffusion language model Cola-DLM; the latent variable is still standard Gaussian noise, and RareTrap's Subset Simulation sampling and ThinkTrap's CMA-ES optimization pipeline remain unchanged.
Experiments and results
The dLLM version of RareTrap triggers over-generation on 9 of the 10 targets, and the character-level perplexity of hit prompts drops from 10^3–10^7 to 3–5; under ThinkTrap it drops from 20–28 to 4.3–5.4; the model risk rankings given by the two mappings can differ by about 40 times.
Limitations and future work
The authors note: the random-mapping baseline is only a single published run; only one unconditionally sampled dLLM is used; only over-generation is studied, with perplexity used in place of human judgment; and ThinkTrap covers only a few targets.
Experimental setupDeepSeek-R1-Distill-Llama-8B、Phi-4-reasoning et al. · RareTrap、ThinkTrap et al. · pF(τ)(过度生成概率)、输出长度增益 et al.
Evaluated models
DeepSeek-R1-Distill-Llama-8BPhi-4-reasoningQwen3.5-9BQwen3-14BMistral-7B-Instruct-v0.3NVIDIA-Nemotron-Nano-9B-v2Olmo-3-7B-InstructGPT-OSS-20BGPT-5.4 (openai.gpt-5.4-2026-03-05)Claude Sonnet 4.6 (global.anthropic.claude-sonnet-4-6)
Benchmarks
RareTrapThinkTrapOASST1
Metrics
pF(τ)(过度生成概率)输出长度增益最长输出长度字符级困惑度(char. PPL)过滤器标记率
AI summaryThe paper proposes replacing the random mapping in continuous-space black-box attacks with a continuous diffusion language model (dLLM), generating more natural prompts while preserving the standard Gaussian latent-space formulation and the downstream sampling and optimization procedures. The authors state that the original random mapping is not learned from language, that its prompts may be highly unnatural and easily detected by input guardrails, and that its risk estimates are not based on natural prompts. Under the sampling-based RareTrap setting, character-level perplexity dropped from 10^3–10^7 to 3–5; under the optimization-based ThinkTrap setting, it dropped from 20–28 to 4.3–5.4. The researchers also found that the risk estimates given by the model under the two mappings can differ by an order of magnitude.

The paper proposes replacing the random mapping in continuous-space black-box attacks with a continuous diffusion language model (dLLM), generating more natural prompts while preserving the standard Gaussian latent-space formulation and the downstream sampling and optimization procedures. The authors state that the original random mapping is not learned from language, that its prompts may be highly unnatural and easily detected by input guardrails, and that its risk estimates are not based on natural prompts. Under the sampling-based RareTrap setting, character-level perplexity dropped from 10^3–10^7 to 3–5; under the optimization-based ThinkTrap setting, it dropped from 20–28 to 4.3–5.4. The researchers also found that the risk estimates given by the model under the two mappings can differ by an order of magnitude.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The random mapping of continuous-space attacks produces high-perplexity, unnatural prompts, and the authors study replacing it with a dLLM mapping.

    Core question: prompts generated by the random mapping in continuous-space attacks are highly unnatural; can a mapping from a continuous diffusion language model (dLLM) replace it while preserving black-box access and leaving the search procedure unchanged?

    • Problem setting: continuous-space attacks sample or optimize in a low-dimensional Gaussian latent space and generate prompts via a random projection matrix and nearest-neighbor decoding, which can trigger malicious behaviors such as overthinking in black-box LLMs.
    • Shortcomings of existing methods: the authors note that the random mapping is not learned from language, its prompts have extremely high perplexity and are easily detected by input guardrails such as perplexity filters; moreover, real users would not issue such prompts, so LLM reliability estimates based on it do not represent robustness under natural inputs in real deployment.
    • Core observation: recent continuous dLLMs can transform standard Gaussian noise into text through a learned generative process, and their latent space is shaped by language; the authors argue it can serve as a plug-and-play replacement for the random mapping.
    • Proposed approach: a plug-in framework that replaces the random mapping with the mapping of a pretrained Cola-DLM, evaluated in two settings, the sampling-based attack RareTrap and the optimization-based attack ThinkTrap, studying two RQs: whether the dLLM mapping is feasible (RQ1) and whether its prompts are more natural (RQ2).
    • Threat model:
      • Goal: trigger over-generation in the target LLM, i.e., output length reaching the 20,000-token threshold, causing inference resource consumption.
      • Knowledge: the target model is black-box, the attacker can only query through outputs, and the dLLM requires no additional access to the target model.
      • Capability: the attacker controls the latent-space input, which is decoded by the mapping into a prompt that is then used to query the target; the search procedure (sampling or optimization) relies only on the behavioral score of the output.
      • Victim systems: 8 open-weight models and 2 cloud API models (accessed via Amazon Bedrock).
  2. What related research exists?

    The related work falls into four groups: continuous-space attacks, continuous diffusion language models, readable attacks and perplexity filtering, and resource-exhaustion attacks.

    Continuous-space attacks

    • ThinkTrap (Li et al., 2025b): uses random projection plus gradient-free optimization (CMA-ES) to search, on black-box models, for prompts that induce long reasoning.
    • RareTrap (Eshra et al., 2026a): uses the same kind of mapping plus Subset Simulation to estimate the probability of over-generation and degenerate repetition. Both decode the projected embedding to the nearest token (Wen et al., 2023).
    • Learned latent-space search: Zhao et al. (2018) search the GAN latent space for natural adversarial examples; REALISTA (Liang et al., 2026) searches combinations of latent directions corresponding to paraphrase directions to attack LLMs. The authors state that this paper combines both ideas: it keeps the Gaussian latent interface and replaces it with the mapping learned by a dLLM.

    Continuous diffusion language models

    • Continuous dLLMs generate text by iterative denoising starting from Gaussian noise in a continuous word-embedding space (Li et al., 2022; Dieleman et al., 2022; Hu et al., 2026; Yang et al., 2026) or in an autoencoder latent space (Lovelace et al., 2023; Jiang et al., 2026).
    • This paper uses Cola-DLM (Guo et al., 2026), whose learned prior turns standard Gaussian noise into continuous text representations and then decodes them into tokens, providing a learned mapping from noise to prompts.

    Readable attacks and perplexity filtering

    • Perplexity filters (Alon and Kamfonas, 2023; Jain et al., 2023) flag unnatural high-perplexity prompts, which prompted a line of attacks that generate natural, readable adversarial prompts (Liu et al., 2024; Zhu et al., 2023; Chao et al., 2023; Paulus et al., 2025; Guo et al., 2024; Lucas et al., 2026).
    • The paper notes that these attacks usually require gradients, log-probabilities, or an attacker LLM; this paper instead lowers the perplexity of continuous-space attacks without adding any of these accesses.

    Resource-exhaustion attacks

    • These include sponge examples (Shumailov et al., 2021), Engorgio prompts (Dong et al., 2025), overthinking attacks against reasoning models (Kumar et al., 2025; Li et al., 2025a,b), and NaturalSloth (Chen et al., 2026), which uses benign-looking instructions to induce excessive computation.

    Baselines and benchmarks: RareTrap's baseline is its published random-mapping result (Qwen3-0.6B proxy, 40-token prompts, D=200); ThinkTrap's baseline is the authors' reproduction of its random mapping (D=20). The evaluation follows the protocols of the two frameworks RareTrap and ThinkTrap.

    The authors position this paper as: fixing the attack pipeline and changing only the distribution from which prompts are sampled—from the distribution induced by the random mapping to a distribution learned from text.

  3. How does the paper address this problem?

    The random mapping is replaced with the Cola-DLM generation process; the latent variable is still standard Gaussian noise, and downstream sampling and optimization are unchanged.

    Overall approach: replace the random mapping hRP in continuous-space attacks with the deterministic mapping hdiff defined by a pretrained continuous dLLM (Cola-DLM); the latent variable is still standard Gaussian noise, and RareTrap's Subset Simulation and ThinkTrap's CMA-ES are left completely unchanged, thereby isolating the prompt representation variable.

    Problem setting and formalization

    • Both frameworks search over a latent variable z ∈ R^D; z ∼ N(0, I_D) is decoded into a prompt via a fixed deterministic projection, and the target response is compressed into a scalar behavior measure r(y) (output length in the experiments).
    • Original pipeline: E = Az, p = NN-decode(E), y = M(p), where A is a fixed random matrix and NN-decode takes the nearest token position by position from the surrogate model's embedding table.
    • RareTrap estimates the probability that the response length reaches a threshold τ, pF(τ) = P[g(z;τ) ≤ 0], where g(z;τ) = τ − r(M(hRP(z))); because the event is rare, it is estimated via Subset Simulation through a sequence of intermediate thresholds.
    • ThinkTrap directly minimizes −r(M(hRP(z))), using CMA-ES to iteratively update the search distribution so that the decoded prompt makes the target generate longer outputs.

    Construction of the dLLM mapping

    • hdiff(z) = Decode(Φψ(z)), where Φψ is the prior learned by Cola-DLM, which transforms Gaussian noise into continuous text latent representations block by block (each block conditioned on the preceding blocks), and Decode is its decoder from latent representations to tokens.
    • The input noise follows N(0, I_D), and the dimension D is determined by the prompt length: Cola-DLM allocates 16 latent dimensions per token, so D = 16L.
    • With fixed inference settings, batch size, and greedy decoding, hdiff is a deterministic function of z and can directly replace hRP; the only change is the search space dimension.
    • Unlike NN-decode, which selects tokens independently position by position, Cola-DLM is trained on text and generates block by block conditioned on preceding blocks; the authors use this to explain why its prompts are more natural.

    Integration with the two frameworks

    • RareTrap: g(z;τ) = τ − r(M(hdiff(z))); τ, r, M, and Subset Simulation itself are unchanged; the estimator only requires the mapping to be a deterministic function of standard Gaussian input, so the replacement requires no change to the estimator.
    • ThinkTrap: the objective −r(M(hRP(z))) is replaced with −r(M(hdiff(z))); the CMA-ES optimizer, initialization, population size, and search budget are unchanged; the comparison is the output length growth brought by the two mappings under the same token budget.
    • Table 1 summarizes: only hRP is replaced; the objective, search method, and target model are all unchanged.

    Key implementation parameters (Appendix A)

    • Cola-DLM generates in blocks of 16 positions, with each block's noise shaped 16×16; unconditional generation is implemented by starting with a single document boundary token.
    • RareTrap uses L = 47 (D = 752, three blocks), and ThinkTrap uses L = 15 (D = 240, one block).
    • Inference settings: 16 Euler steps, classifier-free guidance scale 7.0, repetition penalty 1.1, greedy decoding; prompts are truncated at the first end-of-sequence.

    Evaluation method

    • Attack effectiveness: RareTrap reports pF(τ) (τ = 20,000 tokens), and ThinkTrap reports the output length gain within the budget and the longest output.
    • Naturalness: character-level perplexity PPL_char is used rather than token-level, because, the authors argue, the tokenizer may split rare characters into easily predictable byte tokens, distorting token-level perplexity; scoring uses the target model itself and a fixed reference scorer, Llama-3.1-8B.
  4. What experiments did the paper conduct?

    The two mappings are compared on RareTrap (10 targets) and ThinkTrap (3 targets) in terms of effectiveness, risk estimation, perplexity, and cost.

    Experimental setup

    • Models under test: RareTrap uses 10 targets—DeepSeek-R1-Distill-Llama-8B, Phi-4-reasoning, Qwen3.5-9B, Qwen3-14B, Mistral-7B-Instruct-v0.3, NVIDIA-Nemotron-Nano-9B-v2, Olmo-3-7B-Instruct, GPT-OSS-20B (open weights), plus GPT-5.4 (reasoning effort xhigh) and Claude Sonnet 4.6 (effort high, via Amazon Bedrock); ThinkTrap uses DeepSeek-R1-Distill-Llama-8B, Qwen3-14B, and Phi-4-reasoning among the first three.
    • Protocol: RareTrap estimates the probability that a response reaches 20,000 tokens, with greedy decoding, a 20,003-token output cap, Subset Simulation with 1,000 samples per level, top 10% retained, at most 5 levels, and switching to direct Monte Carlo if ≥20 hits occur among the first 200 samples; the dLLM mapping is run with 3 seeds per target and the median taken, and the random-mapping baseline uses RareTrap's published results.
    • ThinkTrap protocol: temperature 1.0, 4,096-token output cap; 12 latent vectors per generation; a budget of 300,000 generated tokens (enough to complete 13–40 generations), with both mappings given the same budget and the same targets, 3 seeds each.
    • Baselines: the RareTrap random mapping uses a Qwen3-0.6B proxy, 40-token prompts, D = 200; the ThinkTrap random mapping is the authors' reproduction of the plain Gaussian form, D = 20.
    • Metrics: pF(τ), output-length gain, longest output, character-level perplexity (scored by the target model itself and by the reference scorer Llama-3.1-8B; API targets have no log-probabilities, so only the reference scorer is used).
    • Filter evaluation: character-level perplexity filters are calibrated on 735 real OASST1 user prompts (1% and 5% false-positive-rate thresholds), and Llama Guard 3 and the ProtectAI DeBERTa-v3 prompt-injection guard are also tested.

    Main results

    According to Table 2 (RareTrap, over-generation probability at τ = 20,000, dLLM column is the median of three seeds):

    TargetRandom mappingdLLM mapping
    Phi-4-reasoning1.0001.000
    Qwen3.5-9B0.3850.465
    Qwen3-14B3.94×10⁻³2.02×10⁻³
    DeepSeek-R1-Distill-Llama-8B0.1601.17×10⁻²
    Mistral-7B-Instruct-v0.39.04×10⁻²2.11×10⁻³
    Nemotron-Nano-9B-v29.30×10⁻³3.88×10⁻⁴
    GPT-5.41.31×10⁻²4.64×10⁻³
    Olmo-3-7B-Instruct1.63×10⁻²≤10⁻⁵
    GPT-OSS-20B1.82×10⁻²0.115
    Claude Sonnet 4.63.35×10⁻⁴3.68×10⁻³
    • Authors' interpretation (Finding 1/2): the dLLM version of RareTrap triggers over-generation on 9 of the 10 targets; Olmo-3 does not reach the threshold within the maximum depth, so only an upper bound is reported; under ThinkTrap, the dLLM mapping's longest output is no shorter than the random mapping's on every target, but its initial outputs are also longer, so part of the advantage comes from the initial population.
    • Authors' interpretation (Finding 3): the estimates of the two mappings point in inconsistent directions on most targets—the dLLM mapping is lower on 5 targets and higher on GPT-OSS-20B and Claude Sonnet 4.6; under the random mapping, Sonnet 4.6's over-generation risk is about 40 times lower than GPT-5.4's, while under the dLLM mapping the two differ by no more than 1.6 times.
    • Stability: for 7 of the 10 targets, the three-seed estimates differ by within 1.5 times (Appendix E).

    ThinkTrap search progress and perplexity

    According to Table 3 (median of three seeds):

    Swipe horizontally to read the table

    TargetMappingGenerationsLongest outputMean length (first→last 5 generations)Character-level PPL
    DeepSeek-R1-8BRandom344,096721→81227.5
    DeepSeek-R1-8BdLLM284,096842→1,0434.3
    Qwen3-14BRandom391,772600→72919.7
    Qwen3-14BdLLM302,232751→8625.4
    Phi-4-reasoningRandom163,3961,681→1,54722.7
    Phi-4-reasoningdLLM144,0381,915→1,8374.4
    • Authors' interpretation (Finding 2): on DeepSeek-R1-8B and Qwen3-14B, the mean output length rises under both mappings, and the per-seed length-gain intervals overlap on every target (Table 9); Phi-4-reasoning already has long outputs in the initial population, and neither mapping increases them.
    • Perplexity (Finding 5): under ThinkTrap, the top-12 prompts of the dLLM mapping have character-level perplexity of 4.3–5.4, versus 19.7–27.5 for the random mapping, a smaller gap than in RareTrap; the authors explain that the two random mappings decode different types of strings (RareTrap's are almost all rare single-character tokens, while ThinkTrap's are mostly common subwords).

    Prompt naturalness and filters

    • Perplexity of RareTrap hit prompts (Table 4): the character-level perplexity of random-mapping hits is 3–6 orders of magnitude higher than that of dLLM-mapping hits (e.g., for the DeepSeek-R1-Llama-8B target, 6.8×10⁶ vs 4.9 by the target, and 2.4×10⁴ vs 4.7 by the reference scorer); dLLM hits are short English requests with traces of the small model, while random-mapping hits are strings in rare scripts such as Hangul, Arabic, and CJK (70–100% non-ASCII, spanning 6–7 Unicode scripts).
    • Filters (Table 5): at a 1% false-positive rate, the perplexity filter flags 100.0% of random-mapping hits (805) and 67.9% of dLLM hits (293); at a 5% false-positive rate, 100.0% and 94.2%. Llama Guard 3 flags few hits under either mapping (20.4% vs 16.4%; the authors note this is because the over-generation prompts are benign in content); ProtectAI flags 32.3% of random-mapping hits and 9.6% of dLLM hits.
    • Behavior-condition selection (Finding 6, Table 6): compared with the level-0 initial population, hits under the dLLM mapping are more natural on 4 of 6 targets (length-adjusted token-level perplexity ratio <1), while the random mapping changes little.

    Other ablations and analyses

    • Computational cost (Finding 4, Figure 3): during ThinkTrap runs, the dLLM mapping accounts for 3–11% of total computation (DeepSeek-R1-8B 11%, Qwen3-14B 7%, Phi-4-reasoning 3%); Appendix G reports that mapping a batch of 10/25/50 prompts takes 11/16/25 seconds (single A100).
    • Phi-4-reasoning special case (§4.4): under RareTrap's greedy decoding, almost every sample loops verbatim to the cap (pF=1.000); under ThinkTrap at temperature 1.0, at most 3% of responses reach the cap.
    • Prompt length (§4.4): RareTrap random-mapping prompts are about 40 characters and dLLM ones about 200 characters; ThinkTrap prompts are 60–77 characters under both mappings, which the authors suggest may partly explain why its ThinkTrap prompt perplexity (4.3–5.4) is higher than RareTrap's (3–5).
  5. What are some points that can be further explored?

    The authors list limitations such as the baseline single run, the single dLLM, and overgeneration only; the experiments cover 10 RareTrap targets and 3 ThinkTrap targets.

    Limitations and future directions noted by the authors

    • Random-mapping baseline is a single run: the Limitations section notes that the random-mapping baseline is one published run, and that the smallest estimates are based on a few different prompts.
    • Only one unconditionally sampled dLLM was used: the Limitations section notes that the prompts read like generic text rather than typical user requests, and that the estimates describe that distribution rather than real deployment traffic.
    • Single behavior and naturalness measures: the Limitations section notes that only overgeneration was studied, and that naturalness was measured with perplexity rather than human judgment.
    • ThinkTrap covers few targets: the Limitations section notes that the ThinkTrap comparison covers only a few targets.
    • Future directions (Ethical Considerations): the authors state that the results motivate output-side defenses, including repetition detection and per-request reasoning budgets.

    Experimental coverage

    • The RareTrap evaluation covers 10 target models (8 open-weight, 2 cloud APIs), and ThinkTrap covers 3 of them (§4.1).
    • The dLLM mapping is run with 3 seeds per target and reports the median; the random-mapping baseline is RareTrap's single published run (§4.1, Table 8).
    • The behavior studied is only overgeneration (output length reaching 20,000 tokens); no other malicious behavior is covered (§4.1, Limitations).
    • The defense-side evaluation includes a character-level perplexity filter calibrated on OASST1 (735 real prompts) and two guard models (Llama Guard 3, ProtectAI DeBERTa-v3) (§4.3, Table 5).
    • The paper does not report the number of queries for the attack; naturalness was not human-evaluated (Limitations).
  6. Summarize the main content of the paper

    Replacing the random mapping of continuous-space attacks with Cola-DLM lowers prompt perplexity by several orders of magnitude, and the model risk estimates change accordingly.

    An improved study on continuous-space black-box attacks: it replaces the random mapping of "random projection + nearest-neighbor decoding" in the attack with a learned mapping from the pretrained continuous diffusion language model Cola-DLM, while the latent variable remains standard Gaussian noise and the search procedure is unchanged.

    • Problem to solve: prompts generated by the random mapping have extremely high perplexity and are easily detected by input guardrails, and risk estimates based on it do not represent model robustness under natural inputs.
    • Method highlights: define hdiff(z) = Decode(Φψ(z)) to replace hRP, plugging it into the sampling-based RareTrap (Subset Simulation estimates the over-generation probability) and the optimization-based ThinkTrap (CMA-ES maximizes output length) respectively, changing only the mapping dimension and nothing else.
    • The attack still works: the dLLM version of RareTrap triggers 20,000-token over-generation on 9 of 10 targets (Table 2); under ThinkTrap, the longest output for every target is no shorter than with the random mapping (Table 3).
    • More natural prompts: the character-level perplexity of RareTrap hits drops from 10^3–10^7 with the random mapping to 3–5, and under ThinkTrap from 20–28 to 4.3–5.4; a perplexity filter at a 1% false-positive rate flags all random-mapping hits but only 67.9% of dLLM hits (Table 5).
    • Risk estimates change: the over-generation probability estimates of the two mappings point in different directions; under the random mapping Claude Sonnet 4.6 is about 40× lower than GPT-5.4, while under the dLLM mapping the difference is no more than 1.6× (Table 2); the authors argue that risk estimates based on unnatural prompts may misjudge a model's risk under natural inputs.
    • Cost: the authors report that the dLLM mapping accounts for only 3–11% of ThinkTrap's total computation (Figure 3).

    The authors' conclusion: the mapping simultaneously determines what kind of prompts a continuous-space attack finds and which distribution its risk estimates characterize, independent of the search procedure; switching to a pretrained dLLM preserves black-box access, adds limited cost, and makes continuous-space sampling methods a more reliable tool for model evaluation based on natural prompts.

Related papers

Read originalarxiv.org