Introduction
As Large Language Models (LLMs) advance, their vulnerabilities become increasingly subtle and difficult to detect. Traditional "red teaming"—the process of intentionally prompting a model to generate harmful content—faces two primary bottlenecks: the high cost of manual scaling and the lack of diversity in static automated strategies. Current automated methods often fail to adapt as target models improve their defenses.
To address these challenges, the SEAS (Self-Evolving Adversarial Safety) framework introduces a co-evolutionary approach. By treating safety as a moving target, SEAS employs a "Red Team" model and a "Target" model that iteratively learn from each other in a continuous, self-improving loop.
The SEAS Framework
The SEAS pipeline operates in three distinct stages designed to foster adversarial competition and mutual improvement.
- Initialization: Both the Red Team and Target models (initially Llama-3-8B) undergo Supervised Fine-Tuning (SFT). The Red Team is trained on a specialized adversarial dataset, while the Target is trained on high-quality general instruction data to maintain utility.
- Attack Stage: The Red Team generates diverse adversarial prompts. These are processed by the Target model, and a "Safe Classifier" (Llama Guard 2) evaluates the resulting responses.
- Adversarial Optimization: This stage utilizes Direct Preference Optimization (DPO) rather than standard SFT. The Red Team is updated to prefer prompts that successfully "break" the Target model, while the Target model is updated to prefer safe responses over the harmful ones it previously generated.
This cycle repeats over multiple iterations, forcing the Red Team to develop increasingly complex "Hard" attacks as the Target model patches its "Easy" vulnerabilities.
Dataset and Attack Taxonomy
Central to this framework is the SEAS dataset, a comprehensive collection of 18,000 entries. This dataset is unique in its two-dimensional categorization of prompts:
- Risk Categories: Includes five domains such as Health Harm, Privacy and Property, and Illegal Activities.
- Attack Styles: Encompasses nine distinct styles, including Role Play, Goal Hijacking, and Adversarial Prefixes.
By training on this diverse taxonomy, the Red Team learns to explore a wide range of adversarial vectors, ensuring the Target model is tested against more than just simple keyword-based attacks.
Key Insights and Results
The iterative co-evolutionary process yielded several critical insights:
- The DPO Advantage: DPO proved significantly more effective for safety than SFT. While SFT reinforces correct behavior, DPO explicitly teaches the model to move away from specific harmful outputs, which is vital for handling complex edge cases.
- Co-evolutionary Pressure: As the Target model becomes more robust, the Red Team’s Attack Success Rate (ASR) naturally drops. However, by training the Red Team on these failures, it learns to generate more sophisticated prompts. By the third iteration, the Red Team's ASR against a powerful model like Llama3-70B-Instruct increased by over 50%.
- Combating Over-Refusal: A common side effect of safety training is "moralizing" or refusing harmless prompts (e.g., refusing to "kill a process" in Linux). SEAS incorporates an "ambiguous harmless" dataset to help the model distinguish between aggressive style and harmful intent.
After three iterations, the SEAS-T3 model achieved an ASR of 7.0% on the SEAS-Test set, outperforming GPT-4 (15.52%) and performing comparably to Llama3-70B-Instruct. Crucially, these safety gains did not compromise general intelligence; scores on benchmarks like MT-Bench and Arena Hard remained stable or improved.
Limitations and Future Work
Despite its success, the SEAS framework has limitations. It relies heavily on the accuracy of the "Safe Classifier" (Llama Guard 2); any nuances missed by the classifier can lead to incorrect learning. Additionally, the diversity of the "seed" prompts in the SEAS dataset still constrains the evolution of the Red Team. Future work will explore incorporating human-in-the-loop evaluations to refine the classifier and testing the framework across more diverse model architectures.
Summary updated