TL;DR
Most existing defenses against LLM jailbreaks offer a false sense of security: they crumble under white-box attacks, yet stochastic defenses break optimizers and mislead empirical evaluations. This paper brackets the true worst-case robustness of LLMs by introducing a strictly token-consistent attack ($I^2$-GCG) to establish an empirical upper bound, alongside a general certification framework based on knapsack solvers that establishes provable lower bounds for discrete randomized smoothing.
What Problem Does This Paper Address?
While empirical defenses (such as system prompts, perplexity filtering, and prompt adversarial tuning) claim to protect Large Language Models (LLMs) from adversarial jailbreaks, their worst-case robustness remains largely unknown.
Evaluating worst-case robustness is challenging for two opposing reasons:
- Ineffective white-box attacks: Prior attacks failed to account for subtle tokenization discrepancies between parallelized loss optimization and autoregressive generation, creating an illusion that deterministic defenses work.
- Obfuscation via stochasticity: Stochastic defenses (e.g., randomized masking or perturbation) disrupt gradient- and search-based optimizers. This yields high empirical defense scores simply because attackers fail to optimize, not because adversarial prompts do not exist.
The authors aim to evaluate worst-case robustness systematically by sandwiching it between tighter empirical upper bounds (stronger attacks) and rigorous theoretical lower bounds (certified guarantees).
Methods
The paper tackles robustness from two complementary angles:
- $I^2$-GCG (Empirical Upper Bound): Improving on I-GCG, $I^2$-GCG strictly enforces identical BPE tokenization during both loss optimization and sequential text generation. It also eliminates early stopping, removes gradient pairing for non-differentiable pipelines, and leverages warm-start initializations across batches.
-
Knapsack Formulation for Randomized Smoothing (Theoretical Lower Bound): To certify stochastic defenses $g(x) = \mathbb{E}_{z \sim p(z|x)}[f(z)]$, finding the worst-case output $\min_{x_{\text{adv}}} g(x_{\text{adv}})$ is relaxed to a functional optimization over a hypothesis class $\mathcal{F}$.
-
Fractional Knapsack (Bounded $f \in [0, 1]$): Minimizing the expected adversarial output corresponds to a fractional knapsack problem where item $z$ has weight $p(z|x)$, value $-p(z|x_{\text{adv}})$, and knapsack capacity $p_A = g(x)$. It is solved greedily by sorting by the "trading rate" $\frac{p(z|x_{\text{adv}})}{p(z|x)}$.
- 0-1 Knapsack (Binary $f \in \{0, 1\}$): If the base model outputs hard binary decisions (safe vs. unsafe), the relaxation tightens into a 0-1 knapsack problem solved via dynamic programming.
- Kernel Case Studies: The framework is analyzed for two core text smoothing distributions:
- Absorbing Kernel: Tokens are replaced with a
[MASK]token with probability $\beta$. - Uniform Kernel: Tokens are substituted with random vocabulary tokens with probability $\alpha = \frac{\beta}{|V|-1}$. Additionally, DiffTextPure uses a diffusion denoiser or an LLM to reconstruct clean text from corrupted inputs before classification.
Datasets
- AdvBench (Harmful Behaviors Subset): 50 randomly sampled harmful behaviors used as the primary benchmark for adversarial suffix optimization and certified evaluation.
- Repeated AdvBench: Constructed by repeating prompt strings (1, 2, 3, and 5 times) to study how prompt length impacts certification limits.
- Evaluation on Benign Datasets: Clean accuracy and false positive rates (FPR) were benchmarked against MT-Bench, GSM8K, MMLU, and TruthfulQA.
Key Insights and Ideas
- Tokenization consistency is everything in white-box attacks: Minor token splits during parallel loss computation vs. autoregressive decoding create a "grey-box" gap. Aligning token boundaries rigorously reduced deterministic defense robustness from moderate levels down to essentially 0%.
- Randomized smoothing reduces to knapsack problems: Regardless of the underlying noise distribution (discrete diffusion, Gaussian, or Laplace), certified robustness against adversarial perturbations equates to filling a knapsack based on the likelihood ratio between clean and perturbed distributions.
- Uniform smoothing provably dominates absorbing (masking): For an identical clean accuracy $p_A$ and corruption rate $\beta$, the certified radius under a uniform substitution kernel is strictly greater than or equal to that of an absorbing kernel. As vocabulary size $|V| \to \infty$, the uniform kernel's certified boundary converges down to the absorbing kernel.
- Semantic limits on $\ell_0$ text robustness: Unlike vision, where an $\epsilon$-ball around an image preserves semantics, language has low semantic distance. Altering as few as 1–2 keywords ("make a bomb" $\to$ "make a cake") fundamentally changes the label, setting a theoretical ceiling (the Bayesian / Human bound) on how large any certified $\ell_0$ radius can be.
Key Results
- Upper Bounds (Deterministic Defenses Collapse): Against $I^2$-GCG (20-token suffix), standard deterministic defenses (Perplexity Filter, In-Context Defense, Self-Reminder, PAT) dropped to 0% robustness across Vicuna-7B, Llama-2-7B, and Llama-3-8B (PAT retained 2% on Llama-2-7B).
- Certified $\ell_0$ Radius (Table 2): For whole-sentence perturbations ($\beta = 0.1$), certified radii closely approach the theoretical human limit ($2.12$ words):
- GPT-4o: Certified $\ell_0$ radius of 2.02 (uniform) and 2.00 (absorb).
- Llama-3-8B: Certified $\ell_0$ radius of 1.54 (uniform) and 1.82 (absorb).
- Certified Suffix Defense (Table 3): On Llama-3-8B ($\beta = 0.25$), safety detectors achieve an average certified suffix robustness of 6.41 tokens (uniform) and 6.57 tokens (absorb).
Limitations and Future Work
- Small Certified Margins: Certified guarantees currently protect against suffixes of ~6 tokens or $\ell_0$ shifts of ~2 words, whereas practical adversarial suffixes often span 20+ tokens.
- Over-smoothing vs. Utility: As noise $\beta \to 1$, models become insensitive to adversarial suffixes, but risk losing clean prompt comprehension (and can falsely certify safety if suffixes cancel harm).
- Extreme Sample Requirements: For absorbing kernels, guarantees require an extremely small decision threshold $\tau$, demanding large Monte Carlo sample sizes ($N \approx 100{,}000$) to statistically guarantee 0% false positives.
- Scope of Perturbations: The theoretical analysis covers substitution and masking distributions, leaving token insertion, token deletion, and lengthy, multi-turn conversational jailbreaks to future work.
Summary updated