Skip to main content
QUICK REVIEW

[Paper Review] SmoothLLM: Defending Large Language Models Against Jailbreaking Attacks

Alexander Robey, Eric Wong|arXiv (Cornell University)|Oct 5, 2023
Topic ModelingComputer Science28 citations
TL;DR

SmoothLLM is a randomized defense wrapper that perturbs input prompts and aggregates LLM outputs to mitigate adversarial jailbreaks, reducing attack success rates to under 1% across multiple models with high query efficiency and provable guarantees.

ABSTRACT

Despite efforts to align large language models (LLMs) with human intentions, widely-used LLMs such as GPT, Llama, and Claude are susceptible to jailbreaking attacks, wherein an adversary fools a targeted LLM into generating objectionable content. To address this vulnerability, we propose SmoothLLM, the first algorithm designed to mitigate jailbreaking attacks. Based on our finding that adversarially-generated prompts are brittle to character-level changes, our defense randomly perturbs multiple copies of a given input prompt, and then aggregates the corresponding predictions to detect adversarial inputs. Across a range of popular LLMs, SmoothLLM sets the state-of-the-art for robustness against the GCG, PAIR, RandomSearch, and AmpleGCG jailbreaks. SmoothLLM is also resistant against adaptive GCG attacks, exhibits a small, though non-negligible trade-off between robustness and nominal performance, and is compatible with any LLM. Our code is publicly available at \url{https://github.com/arobey1/smooth-llm}.

Motivation & Objective

  • Define a comprehensive desiderata for defenses against adversarial-prompting jailbreaks (attack mitigation, non-conservatism, efficiency, compatibility).
  • Propose SmoothLLM as the first general-purpose defense against adversarial-prompting jailbreaks.
  • Provide theoretical guarantees on attack mitigation under perturbation stability assumptions.
  • Empirically evaluate SmoothLLM across multiple popular LLMs and attacks, and compare query efficiency to baseline attacks.

Proposed method

  • Identify that adversarial suffixes are brittle to character-level perturbations.
  • Introduce a perturbation step that creates N perturbed copies of the input prompt using insert, swap, or patch changes controlled by q%.
  • Introduce an aggregation step that passes perturbed prompts through the LLM and uses majority voting to decide whether the prompt jailbreaks, selecting a consistent response from the perturbed runs.
  • Provide a formal definition of SmoothLLM and analyze its defense success probability (DSP) under k-unstable suffix assumptions.
  • Derive closed-form expressions for DSP for swap perturbations and discuss how N (samples) and q (perturbation) influence robustness.
  • Evaluate robustness and efficiency against the GCG jailbreak and discuss compatibility with closed-source LLMs.

Experimental results

Research questions

  • RQ1Can SmoothLLM mitigate adversarial-prompting jailbreaks without retraining the model?
  • RQ2How do perturbation level q and number of samples N affect attack mitigation and nominal performance?
  • RQ3What theoretical guarantees exist for SmoothLLM under perturbation-stability assumptions?
  • RQ4Is SmoothLLM compatible with both open and closed-source LLMs and more efficient than prior attacks?
  • RQ5Does SmoothLLM extend to semantic jailbreaks like PAIR?

Key findings

  • SmoothLLM reduces attack success rates of GCG on seven LLMs (Llama2, Vicuna, GPT-3.5, GPT-4, Claude-1, Claude-2, PaLM-2) to below 1%.
  • For Llama2 and Vicuna, the reductions are about 50-fold and 100-fold respectively compared to undefended models.
  • SmoothLLM uses between 10^5 and 10^6 fewer queries than GCG and is several thousand times faster in running time.
  • The defense provides a high-probability guarantee on mitigating suffix-based attacks under perturbation stability (k-unstable suffix).
  • SmoothLLM maintains nominal performance on standard NLP benchmarks at small perturbation levels (q around 5%).
  • SmoothLLM reduces the PAIR semantic jailbreak ASR from 92% to around 50% on Vicuna with swap perturbations (not the primary target).
  • The defense is architecture-agnostic and compatible with any LLM, including closed-source models, with ASR reduced to below 1% on transferred suffixes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.