Abstract
Recent advancements in Large Language Models (LLMs) have predominantly focused on autoregressive architectures. However, these models face a fundamental limitation when subjected to adversarial scrutiny: they are optimized for predicting the next token, making the "inverse problem"—finding a prompt that elicits a specific harmful response—computationally expensive and often resulting in unnatural text. This paper introduces a novel framework that leverages Diffusion Large Language Models (DLLMs) as "natural adversaries." By treating adversarial prompt generation as an "inpainting" task, we demonstrate that DLLMs can generate highly effective, natural-sounding jailbreaks through amortized inference, significantly outperforming traditional optimization-based attacks in both efficiency and success rate.
Introduction
The safety of Large Language Models (LLMs) is often tested through "jailbreaking"—the process of finding prompts that bypass safety filters to generate harmful content. Historically, this has been a resource-intensive "cat and mouse" game. State-of-the-art attacks, such as Greedy Coordinate Gradient (GCG) or PAIR, rely on iterative optimization or feedback loops to refine prompts. These methods are not only computationally heavy but often produce "gibberish" prompts that are easily flagged by perplexity filters.
The core of this difficulty lies in the autoregressive nature of standard LLMs. These models are trained to model the conditional probability $P(\text{response} | \text{prompt})$. Adversarial attacks, however, require solving for the prompt given a desired (harmful) response. Because autoregressive models are not designed for this inverse mapping, attackers must resort to slow, heuristic-based searches.
The INPAINTING Framework
To address these limitations, we propose INPAINTING, a framework that transforms adversarial search from a difficult optimization problem into a straightforward inference task using Diffusion LLMs (DLLMs).
Joint Distribution Modeling
Unlike their autoregressive counterparts, DLLMs (such as LLaDA) model the joint distribution of prompts and responses: $P(\text{prompt}, \text{response})$. This bidirectional understanding allows the model to treat the relationship between input and output as a unified data structure.
Conditional Sampling as Inpainting
In the INPAINTING framework, generating a jailbreak is analogous to image inpainting. The researcher fixes the "target response" (e.g., a prohibited instruction or a harmful plan) and allows the diffusion model’s denoising process to "fill in" the missing prompt. This process leverages the model's inherent understanding of how prompts and responses co-occur in its training data.
Guided Sampling and Amortization
The strength of these attacks can be further enhanced through guided sampling. During the denoising steps, the generation can be biased toward prompts that the target model is more likely to follow (Likelihood Guidance) or those that maximize a specific reward (Reward Guidance). Crucially, because the DLLM already encodes the relationship between prompts and responses, finding a new jailbreak does not require a new optimization run. Instead, it becomes a matter of "amortized inference"—drawing samples from the model, which is significantly faster than iterative optimization.
Experimental Evaluation
We evaluated the INPAINTING framework using the JailbreakBench (JBB), a standard benchmark of 100 harmful behaviors. The primary surrogate model used for generating attacks was LLaDA-8B. To assess the linguistic quality of the generated prompts, we compared them against benign queries from the UltraChat dataset.
Breaking Hardened Models
One of the most significant findings was the framework's effectiveness against models specifically hardened against adversarial attacks. For instance, against a "Circuit Breaker" Llama-3 model, traditional GCG achieved only a 7% success rate. In contrast, the INPAINTING method achieved a staggering 93% success rate.
Efficiency and Transferability
The method proved to be Pareto-optimal regarding computational cost, achieving higher Attack Success Rates (ASR) with a fraction of the FLOPs required by traditional methods. Furthermore, the attacks demonstrated high transferability to black-box models. When tested against ChatGPT-5 (under a minimum thinking budget), the INPAINTING prompts achieved a 53% success rate, compared to just 13% for Best-of-N and 4% for GCG.
Natural Language Quality
Because DLLMs are trained on massive corpora of human language, the jailbreaks they generate are remarkably natural. The perplexity scores of these adversarial prompts are similar to those of benign human queries. This allows them to bypass simple "gibberish filters" that typically catch the high-perplexity, token-scrambled outputs of optimization-based attacks.
Discussion and Future Work
The emergence of Diffusion LLMs as "natural adversaries" represents a paradigm shift in AI safety and red-teaming. The transition from per-instance optimization to amortized inference allows for the rapid generation of diverse, high-quality test cases.
While the success of this method depends on the quality and data diversity of the underlying DLLM, its potential for defensive applications is vast. Developers can utilize this framework to proactively harden models against a wider array of natural-sounding threats. As non-autoregressive models like Flow-matching continue to evolve, we anticipate that these adversarial techniques will become even more potent, necessitating a corresponding evolution in LLM defense strategies.
Summary updated