Abstract
Large Language Models (LLMs) remain vulnerable to adversarial "jailbreaking" attacks despite safety alignment. We present RESTA (Randomized Embedding Smoothing and Token Aggregation), a defense mechanism that operates in the model's embedding space. By injecting controlled noise into token embeddings and utilizing a majority-vote system for the initial response prefix, RESTA significantly reduces attack success rates while preserving model utility more effectively than existing text-level defenses.
Introduction
Adversarial techniques such as Greedy Coordinate Gradient (GCG) and PAIR can bypass LLM safety filters, forcing models to generate harmful content. Current defenses typically rely on computationally expensive auxiliary "judge" models or character-level randomized smoothing. However, character-level noise often degrades the model's ability to follow instructions. RESTA addresses this challenge by shifting the defense from the syntactic text level to the semantic embedding space, finding a "Goldilocks" zone of noise that disrupts attacks without mangling user intent.
Methodology: The RESTA Approach
RESTA introduces a multi-stage defense process that focuses on the mathematical representation of tokens.
- Embedding Perturbation: Instead of modifying characters, RESTA adds random noise to the high-dimensional vectors (embeddings) representing tokens. The authors explored several noise distributions, including Isotropic Gaussian, Directional (Hard/Soft), and Orthogonal noise. Directional noise is particularly effective as it follows the vector of the original token, preserving core meaning while disrupting adversarial patterns.
- Token Aggregation: For a single prompt, the model generates $k$ parallel "noisy" versions of the next token. A majority-vote aggregation determines the final token to be output.
- Response Prefix Smoothing: To optimize performance, RESTA applies this voting process only to the first $l$ tokens (typically the first 20). Since jailbreak success is often determined by the model's initial trajectory (e.g., starting with a refusal), securing the prefix is sufficient to ensure a safe response.
Experimental Evaluation
The researchers evaluated RESTA using Vicuna-13B and Llama-2-7B against GCG, PAIR, and Random Search attacks from the JailbreakBench dataset. Utility was measured using AlpacaEval and IFEval to ensure the models remained capable of following complex instructions.
Key Results
RESTA consistently outperformed the leading baseline, SmoothLLM, in the robustness-vs-utility tradeoff.
- Defense Against GCG: On Vicuna, an undefended model showed a 94% attack success rate (ASR). RESTA reduced this to 2% ASR while maintaining an AlpacaEval utility score of 50.3%. In comparison, SmoothLLM achieved a 7% ASR but saw its utility drop significantly to 27.8%.
- Resilience and Efficiency: On Llama-2-7B, RESTA achieved a 0% ASR against Random Search attacks with minimal impact on instruction following. The "First 20 Tokens" rule proved to be a practical breakthrough, allowing for robust defense without the latency of full-response smoothing.
Conclusion and Future Work
RESTA provides a self-contained, effective defense against adversarial jailbreaks by operating at the meaning level of embeddings. While it introduces some computational overhead during the prefix generation phase, its superior ability to maintain model helpfulness makes it a viable candidate for real-world deployment. Future work will investigate its performance against adaptive "white-box" attacks and its interaction with non-greedy decoding strategies.
Summary updated