[Paper Review] Attacking Large Language Models with Projected Gradient Descent
The paper presents a Projected Gradient Descent (PGD) attack for LLMs that operates on a continuously relaxed token sequence, achieving comparable attack strength to discrete optimization methods with up to 10x faster run times.
Current LLM alignment methods are readily broken through specifically crafted adversarial prompts. While crafting adversarial prompts using discrete optimization is highly effective, such attacks typically use more than 100,000 LLM calls. This high computational cost makes them unsuitable for, e.g., quantitative analyses and adversarial training. To remedy this, we revisit Projected Gradient Descent (PGD) on the continuously relaxed input prompt. Although previous attempts with ordinary gradient-based attacks largely failed, we show that carefully controlling the error introduced by the continuous relaxation tremendously boosts their efficacy. Our PGD for LLMs is up to one order of magnitude faster than state-of-the-art discrete optimization to achieve the same devastating attack results.
Motivation & Objective
- Motivate and enable efficient automatic red-teaming of LLMs.
- Show that gradient-based optimization with continuous relaxation can match discrete attacks in effectiveness.
- Develop a projection-based framework to keep optimization on a probabilistic simplex and control relaxation error.
- Demonstrate efficiency gains over state-of-the-art attacks for large-scale evaluations and adversarial training.
Proposed method
- Formulate a continuous relaxation of the one-hot input tokens on a probabilistic simplex.
- Apply gradient-based updates to the relaxed input and project back onto the simplex after each step.
- Use an entropy (Gini) projection to bound relaxation error and encourage discreteness.
- Introduce a differentiable length flexibility by a token mask, enabling smooth insertion/removal of tokens in attention.
- Discretize by taking argmax per token after relaxation and evaluate the attack objective on the resulting sequence.

Experimental results
Research questions
- RQ1Can gradient-based optimization with continuous relaxation effectively attack aligned LLMs on jailbreaking tasks?
- RQ2How does PGD compare to discrete optimization methods in terms of attack effectiveness and computational efficiency?
- RQ3Does entropy-based projection improve reliability by counteracting relaxation error?
- RQ4Does allowing variable sequence length further improve attack performance?
Key findings
- PGD achieves the same or better attack strength as state-of-the-art discrete optimization methods with up to an order of magnitude lower runtime.
- On the behavior jailbreaking task, PGD attains 87% attack success rate at 60 seconds versus 83% for GCG and 40% for GBDA.
- PGD reduces the search space from about 65,000 to roughly 10 candidate tokens per position.
- Cross-entropy results from ablation show improvements: 0.092±0.014 (no relaxation), 0.085±0.010 (relaxation without entropy projection), 0.078±0.009 (relaxation with entropy projection).
- PGD’s efficiency advantage is demonstrated across Vicuna 7B, Falcon 7B, and Falcon 7B Instruct models.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.