Fluent Student-Teacher Redteaming

T. Ben Thompson, Michael SklararXiv 2024

Abstract

Many publicly available language models have been safety tuned to reduce the likelihood of toxic or liability-inducing text. To redteam or jailbreak these models for compliance with toxic requests, users and security analysts have developed adversarial prompting techniques. One attack method is to apply discrete optimization techniques to the prompt. However, the resulting attack strings are often gibberish text, easily filtered by defenders due to high measured perplexity, and may fail for unseen tasks and/or well-tuned models. In this work, we improve existing algorithms (primarily GCG and BEAST) to develop powerful and fluent attacks on safety-tuned models like Llama-2 and Phi-3. Our technique centers around a new distillation-based approach that encourages the victim model to emulate a toxified finetune, either in terms of output probabilities or internal activations. To encourage human-fluent attacks, we add a multi-model perplexity penalty and a repetition penalty to the objective. We also enhance optimizer strength by allowing token insertions, token swaps, and token deletions and by using longer attack sequences. The resulting process is able to reliably jailbreak the most difficult target models with prompts that appear similar to human-written prompts. On Advbench we achieve attack success rates >93% for Llama-2-7B, Llama-3-8B, and Vicuna-7B, while maintaining model-measured perplexity <33; we achieve 95% attack success for Phi-3, though with higher perplexity. We also find a universally-optimized single fluent prompt that induces >88% compliance on previously unseen tasks across Llama-2-7B, Phi-3-mini and Vicuna-7B and transfers to other black-box models.

Introduction

Safety-tuned Large Language Models (LLMs) are engineered to refuse harmful or toxic requests. However, security researchers employ "redteaming" to identify adversarial prompts capable of bypassing these safeguards. Current automated attacks typically fall into two categories: discrete optimization (e.g., GCG), which is effective but produces detectable "gibberish" strings, and fluent attacks (e.g., BEAST), which produce human-readable text but often lack the potency to break robustly defended models like Llama-2.

This paper introduces FLRT (Fluent Student-Teacher Redteaming), an optimization framework designed to generate adversarial prompts that are both highly effective and remarkably human-fluent. By bridging the gap between power and stealth, FLRT makes adversarial attacks significantly harder to distinguish from legitimate user queries.

Methodology

FLRT enhances existing discrete optimization algorithms through three primary innovations:

  1. Distillation Objective: Unlike traditional "token forcing" (e.g., forcing a model to start with "Sure!"), FLRT utilizes a distillation-based approach. A "toxified" teacher model is created via LoRA fine-tuning on a small toxic dataset. The optimizer then minimizes a distillation loss, compelling the victim model to match the output probabilities or internal activations of the toxic teacher.
  2. Fluency Constraints: To ensure prompts resemble natural language, the framework incorporates a multi-model perplexity penalty. By averaging perplexity across multiple models (e.g., Llama-2, Phi-3, Pythia), the optimizer is prevented from exploiting "dead zones" in any single model's scoring. A repetition penalty is also applied to prevent nonsensical loops.
  3. Flexible Optimization: The FLRT optimizer allows for token insertions, deletions, and swaps, moving beyond the fixed-length constraints of previous methods.
Anatomy of a jailbreak prompt illustrating the relationship between the chat template, the malicious task, and the optimized trigger.

Experimental Results

The framework was evaluated using Advbench across several target models, including Llama-2-7B, Llama-3-8B, Vicuna-7B, and Phi-3-mini.

  • Attack Success and Stealth: FLRT achieved a 96% Attack Success Rate (ASR) on Llama-2-7B while maintaining a perplexity of only 33. This stands in stark contrast to high-power attacks like GCG, which often result in perplexity scores in the hundreds of thousands.
  • Universal Jailbreaks: The researchers identified a single, fluent, poetic prompt that induces over 88% compliance across multiple models on unseen tasks.
  • Cross-Model Transfer: Prompts optimized against open-source models successfully transferred to black-box systems, achieving a 69% ASR on GPT-3.5-Turbo and approximately 12-15% on GPT-4o.

Discussion and Conclusion

A key insight from this work is that "token forcing" is often brittle; models like Llama-2 can self-correct even after an initial affirmative response. Distillation captures the entire toxic behavior, making jailbreaks more robust. Furthermore, the study confirms that prompt length serves as a significant lever for vulnerability, providing more "surface area" for optimization.

While FLRT is computationally more expensive than simpler gradient-based attacks due to multi-model checks, it demonstrates that fluency and adversarial power are not mutually exclusive. Future work may explore optimizing even longer sequences or developing more sophisticated proxies for human fluency beyond simple perplexity metrics.

Summary updated

BibTeX
@misc{thompson2024fluent,
  author = {T. Ben Thompson and Michael Sklar},
  title = {{Fluent Student-Teacher Redteaming}},
  year = {2024},
  eprint = {2407.17447},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.17447},
}
Figure