Skip to content

On prompt-driven safety protection for large language modelsOn Prompt-Driven Safeguarding for Large Language Models

arXiv· arXiv:2401.18018· Chujie Zheng, Fan Yin, Hao Zhou, Fandong Meng, Jie Zhou, Kai-Wei Chang, Minlie Huang, Nanyun Peng·Indexed by this site · 24 days ago· Originally publishedDefenses
AI summary

The study analyzes the mechanism of safety prompts from the model's representation space and finds that safety prompts generally push the input query as a whole toward a direction more inclined to refusal, even when the query itself is harmless; without safety prompts, the LLM itself can already distinguish harmful from harmless queries. Based on this, the authors propose the DRO (Directed Representation Optimization) method, which treats the safety prompt as a continuous trainable embedding and learns to move the query representation along the refusal direction or its opposite depending on whether the query is harmful. Experiments on eight LLMs against out-of-domain and jailbreak benchmarks show that DRO significantly improves the protection performance of manually written safety prompts without harming the model's general performance.

Read originalarxiv.org