Lune

EMNLP Findings2023

Attack Prompt Generation for Red Teaming and Defending Large Language Models

Boyi Deng, Wenjie Wang, Fuli Feng, Yang Deng, Qifan Wang, Xiangnan He

Abstract

Large language models (LLMs) are susceptible to red teaming attacks, which can induce LLMs to generate harmful content. Previous research constructs attack prompts via manual or automatic methods, which have their own limitations on construction cost and quality. To address these issues, we propose an integrated approach that combines manual and automatic methods to economically generate high-quality attack prompts. Specifically, considering the impressive capabilities of newly emerged LLMs, we propose an attack framework to instruct LLMs to mimic humangenerated prompts through in-context learning. Furthermore, we propose a defense framework that fine-tunes victim LLMs through iterative interactions with the attack framework to enhance their safety against red teaming attacks. Extensive experiments on different LLMs validate the effectiveness of our proposed attack and defense frameworks. Additionally, we release a series of attack prompts datasets named SAP with varying sizes, facilitating the safety evaluation and enhancement of more LLMs. Our code and dataset is available on https://github.com/Aatrox103/SAP.

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · 28 top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Cited by top-tier papers28

  1. Uncovering Safety Risks of Large Language Models through Concept Activation VectorZhihao Xu, Ruixuan Huang, Changyu Chen, Xiting WangNeurIPS 2024 · 83 citations
  2. The VLLM Safety Paradox: Dual Ease in Jailbreak Attack and DefenseYangyang Guo, Fangkai Jiao, Liqiang Nie, Mohan KankanhalliNeurIPS 2025 · 24 citations
  3. MoGU: A Framework for Enhancing Safety of LLMs While Preserving Their UsabilityYanrui Du, Sendong Zhao, Danyang Zhao, Ming Ma et al.NeurIPS 2024 · 13 citations
  4. Activated LoRA: Fine-tuned LLMs for IntrinsicsKristjan Greenewald, Luis A. Lastras, Thomas Parnell, Vraj Shah et al.NeurIPS 2025 · 12 citations
  5. MixAT: Combining Continuous and Discrete Adversarial Training for LLMsCsaba Dékány, Stefan Balauca, Dimitar I. Dimitrov, Robin Staab et al.NeurIPS 2025 · 12 citations

Builds on13

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  4. LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
  5. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations

Related papers

  1. Be a Multitude to Itself: A Prompt Evolution Framework for Red TeamingRui Li, Peiyi Wang, Jingyuan Ma, Di Zhang et al.EMNLP Findings 2024
  2. AdvPrompter: Fast Adaptive Adversarial Prompting for LLMsAnselm Paulus, Arman Zharmagambetov, Chuan Guo, Brandon Amos et al.ICML 2025
  3. StealthGraph: Exposing Domain-Specific Risks in LLMs through Knowledge-Graph-Guided Harmful Prompt GenerationHuawei Zheng, Xinqi Jiang, Sen Yang, Shouling Ji et al.ACL 2026 · 1 citation
  4. SEAS: Self-Evolving Adversarial Safety Optimization for Large Language ModelsMuxi Diao, Rumei Li, Shiyang Liu, Guogang Liao et al.AAAI 2025 · 8 citations
  5. STAR-Teaming: A Strategy-Response Multiplex Network Approach to Automated LLM Red TeamingMinJae Jung, YongTaek Lim, Chaeyun Kim, Junghwan Kim et al.ACL Findings 2026
Dusk over the sea between two cliffs drawn in fine vertical lines