Recent studies have revealed the vulnerability of large language models to adversarial attacks, where adversaries craft specific inputs to induce incorrect or harmful outputs. Although various empirical defenses have been proposed, their worst-case robustness remains poorly understood, raising concerns about how they would behave against stronger future attacks. Here, we study the worst-case robustness of LLMs from both empirical and theoretical perspectives. First, we provide tighter empirical upper bounds for the tested deterministic defenses using stronger white-box attacks, under which most tested configurations achieve nearly 0% robustness. Second, we formulate randomized-smoothing certification for bounded and binary base functions as fractional and 0-1 knapsack problems, respectively, and derive grouped solvers for two token kernels. For example, on AdvBench, we certify a GPT-4o safety detector smoothed by a uniform kernel to an average certified ℓ0 radius of 2.02. In our stated suffix-attack setting, the same kernel certifies a Llama-3-8B safety detector to an average certified radius of 6.41.
Figures & tables
I 2 -GCG
No Defense
PPL
ICD
Self-reminder
PAT
Uniform
Absorb
SmoothLLM
Vicuna-7B
0%
0%
0%
0%
0%
82%
86%
62%
Llama-2-7B
0%
0%
0%
0%
2%
86%
88%
68%
Llama-3-8B
0%
0%
0%
0%
0%
82%
80%
64%
Table 1: Empirical upper bounds on worst-case robustness under I 2 -GCG on 50 AdvBench prompts. Robustness is the fraction of responses identified as refusals by the lexical judge. The tested deterministic defenses drop to nearly 0%, while the bounds for the tested stochastic defenses remain loose.
Variant
Budget/change
Seed 1
Seed 2
Seed 3
Mean ASR
ASR difference
Full I 2 -GCG
Up to 500 steps
98%
100%
100%
99.3%
—
100-step reference
No intermediate stopping
90%
88%
86%
88.0%
—
No end-to-end
Optimize the raw model only
2%
0%
22%
8.0%
−80.0%
No token consistency
Do not match optimization and inference tokens
16%
4%
8%
9.3%
−78.7%
With gradients
Use gradient-based token selection
42%
82%
4%
42.7%
−45.3%
No warm start
Use the same initial suffix for every prompt
46%
32%
30%
36.0%
−52.0%
Table 2: I 2 -GCG diagnostics on Llama-3-8B-Instruct with the PPL defense. We report ASR on the same 50 AdvBench prompts for three seeds. The 100-step reference and four component ablations share a maximum budget of 512 candidates per step; each ASR difference is the variant minus the 100-step reference. The stronger 500-step configuration is reported separately and is not used to compute these differences.
Figure 1: padv -versus- pA plots for the absorbing and uniform kernels. The vertical axis shows padv , and the horizontal axis shows pA . As the vocabulary size ∣V∣ increases, the curve for the uniform kernel moves toward that of the absorbing kernel.
Models
Defenses
GCG
MAC
I-GCG
AutoDAN
ICA
I 2 -GCG
Vicuna-7B
No Defense
0%
0%
0%
4%
66%
0%
PPL
72%
24%
96%
52%
66%
98%
ICD
70%
96%
88%
96%
82%
96%
Self-reminder
60%
94%
26%
92%
50%
86%
PAT
94%
92%
82%
98%
82%
86%
Uniform
98%
92%
90%
94%
16%
92%
Table 3: Black-box robustness on 50 AdvBench prompts (%, higher is better), measured as the fraction of responses identified as refusals by the lexical judge. Suffixes are optimized against the undefended model and then evaluated on the defended model.
Absorb
Uniform
SmoothLLM
Vicuna-7B
1.00
1.02
2.25
Llama-2-7B
1.92
1.86
3.24
Llama-3-8B
1.82
1.54
3.16
GPT-4o
2.00
2.02
3.84
Annotated Human
2.12
2.12
4.04
Table 4: Average certified global ℓ0 radius on AdvBench. All certificates use τ=4.6×10−5 , Ncert=106 , and a per-input one-sided 99% lower confidence bound. “Annotated Human” is the average author-annotated estimate K(x)−1 of the oracle Human Bound.
Repetitions
Absorb
Uniform
Annotated Human
Bayesian Bound
β=0.1
β=0.25
β=0.1
β=0.25
1
1.82
1.44
1.54
1.06
2.12
2.10
2
3.70
4.20
3.22
3.26
5.24
4.54
3
3.94
5.90
3.82
5.34
8.36
6.16
5
3.88
6.84
3.94
6.62
14.60
7.96
Table 6: Certified ℓ0 radius on the repeated AdvBench dataset Zou et al. (2023) using Llama-3-8B Dubey et al. (2024) . “Annotated Human” is the average author-annotated estimate K(x)−1 . The Bayesian Bound uses the uniform certificate at the fixed configuration τ=4.6×10−5 , β=0.25 , and ∣V∣=50,257 .
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 2: Comparison between DiffPure Nie et al. (2022) and DiffTextPure in the text setting.
Figure 3: Per-input token-level ℓ0 certification results on AdvBench ( n=50 harmful prompts per cell, β=0.1 , Ncert=106 , and α=0.01 ). In (b), the dashed line at one is the certification threshold: all reported radii R pass, whereas the next integer radii R+1 fail.
Absorbing
Uniform
Threshold τ or samples per prompt N
Mean pA
Mean radius
Mean pA
Mean radius
Detector threshold τ=4.6×10−5
0.951
1.64
0.945
1.63
Detector threshold τ=10−4
0.951
1.39
0.945
1.37
Detector threshold τ=10−3
0.951
1.15
0.945
1.11
Detector threshold τ=0.01
0.951
0.89
0.945
0.79
Detector threshold τ=0.1
0.951
0.00
0.945
0.00
Appendix
Table 7: Mean pA and mean certified radius under different detector thresholds τ and numbers of Monte Carlo samples N per prompt. The results are computed from the stored evaluations of the same 150 prompt–detector pairs per kernel in Figure 3 ( β=0.1 , α=0.01 ); no additional model samples are drawn.
β
Kernel
Certified radius at matched pA
0.9
0.91
0.93754
0.99
0.999
0.9999
0.10
Absorbing
0
1
1
1
2
3
0.10
Uniform
0
1
1
1
2
3
0.25
Absorbing
1
1
1
3
4
6
0.25
Uniform
1
1
2
3
4
6
Appendix
Table 8: Certified radii of the absorbing and uniform kernels when both are evaluated at the same pA . The results are computed directly by the two certificate solvers with ∣V∣=50,257 and τ=4.6×10−5 , rather than measured from separate purification runs. At β=0.25 and pA=0.93754 , the uniform radius is 2 , whereas the absorbing radius is 1 .
0.1
0.25
0.5
0.75
0.9
1
Absorb
1.82
1.44
0.94
0.86
0.12
0.00
Uniform
1.54
1.06
0.66
0.08
0.06
0.00
Appendix
Table 9: Certified robustness under ℓ0 attacks for different β values on the AdvBench dataset Zou et al. (2023) using Llama-3-8B Dubey et al. (2024) .
Purifier
Kernel
Diffusion
Vicuna
Llama-3
GPT-4o
ℓ0 attacks
Absorb
1.82
0.00
0.00
2.76
ℓ0 attacks
Uniform
1.54
0.00
0.00
1.42
Suffix attacks
Absorb
6.57
0.00
0.00
6.30
Suffix attacks
Uniform
6.41
0.00
0.00
1.28
Appendix
Table 10: Certified robustness of Llama-3-8B Dubey et al. (2024) on the AdvBench dataset Zou et al. (2023) using different purifiers. We use β=0.1 for global ℓ0 certificates and β=0.25 for the suffix-attack setting defined in Sec. 6.3 .
Adversarial robustness of language models studies how to keep their outputs and decisions reliable under manipulative prompts, input changes, and malicious fine-tuning.