paper-with-me

홈 › Papers

On Prompt-Driven Safeguarding for Large Language Models

2024-01-31 · Chujie Zheng, Fan Yin, Hao Zhou, Fandong Meng, Jie zhou, Kai-Wei Chang, Minlie Huang, Nanyun Peng

Prepending model inputs with safety prompts is a common practice for safeguarding large language models (LLMs) against queries with harmful intents. However, the underlying working mechanisms of safety prompts have not been unraveled yet, restricting the possibility of automatically optimizing them to improve LLM safety. In this work, we investigate how LLMs' behavior (i.e., complying with or refusing user queries) is affected by safety prompts from the perspective of model representation. We find that in the representation space, the input queries are typically moved by safety prompts in a "higher-refusal" direction, in which models become more prone to refusing to provide assistance, even when the queries are harmless. On the other hand, LLMs are naturally capable of distinguishing harmful and harmless queries without safety prompts. Inspired by these findings, we propose a method for safety prompt optimization, namely DRO (Directed Representation Optimization). Treating a safety prompt as continuous, trainable embeddings, DRO learns to move the queries' representations along or opposite the refusal direction, depending on their harmfulness. Experiments with eight LLMs on out-of-domain and jailbreak benchmarks demonstrate that DRO remarkably improves the safeguarding performance of human-crafted safety prompts, without compromising the models' general performance.

📄 PDF Abstract BibTeX arXiv:2401.18018

Code (2)

chujiezheng/llm-safeguard 공식 구현 pytorch
chujiezheng/LLM-Safeguard_data

Similar Papers 제목 키워드 기반

Multilingual Collaborative Defense for Large Language Models

2025-05-17 · Hongliang Li, Jinan Xu, Gengping Cui, Changhao Guan 외

The robustness and security of large language models (LLMs) has become a prominent research area. One notable vulnerability is the ability to bypass LLM safeguards by translating harmful queries into rare or underreprese…

Autonomous LLM-Enhanced Adversarial Attack for Text-to-Motion

2024-08-01 · Honglei Miao, Fan Ma, Ruijie Quan, Kun Zhan 외

Human motion generation driven by deep generative models has enabled compelling applications, but the ability of text-to-motion (T2M) models to produce realistic motions from text prompts raises security concerns if expl…

Adversarial AttackAdversarial TextMotion Generation

RapGuard: Safeguarding Multimodal Large Language Models via Rationale-aware Defensive Prompting

2024-12-25 · Yilei Jiang, Yingshui Tan, Xiangyu Yue

While Multimodal Large Language Models (MLLMs) have made remarkable progress in vision-language reasoning, they are also more susceptible to producing harmful content compared to models that focus solely on text. Existin…

A Call to Action for a Secure-by-Design Generative AI Paradigm

2025-10-01 · Dalal Alharthi, Ivan Roberto Kawaminami Garcia arxiv

Large language models have gained widespread prominence, yet their vulnerability to prompt injection and other adversarial attacks remains a critical concern. This paper argues for a security-by-design AI paradigm that p…

Prompt Engineering

PolygloToxicityPrompts: Multilingual Evaluation of Neural Toxic Degeneration in Large Language Models

2024-05-15 · Devansh Jain, Priyanshu Kumar, Samuel Gehman, Xuhui Zhou 외

Recent advances in large language models (LLMs) have led to their extensive global deployment, and ensuring their safety calls for comprehensive and multilingual toxicity evaluations. However, existing toxicity benchmark…

Benchmarking