Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Context Misleads LLMs: The Role of Context Filtering in Maintaining Safe Alignment of LLMs

About

While Large Language Models (LLMs) have shown significant advancements in performance, various jailbreak attacks have posed growing safety and ethical risks. Malicious users often exploit adversarial context to deceive LLMs, prompting them to generate responses to harmful queries. In this study, we propose a new defense mechanism called Context Filtering, an input pre-processing method designed to filter out untrustworthy and unreliable context while identifying the primary prompts containing the real user intent to uncover concealed malicious intent. Given that enhancing the safety of LLMs often compromises their helpfulness, potentially affecting the experience of benign users, our method aims to improve the safety of the LLMs while preserving their original performance. We evaluate the effectiveness of our model in defending against jailbreak attacks through comparative analysis, comparing our approach with state-of-the-art defense mechanisms against six different attacks and assessing the helpfulness of LLMs under these defenses. Our model demonstrates its ability to reduce the Attack Success Rates of jailbreak attacks by up to 92% while maintaining the original LLMs' performance, achieving state-of-the-art Safety and Helpfulness balance. Notably, Context Filtering is a plug-and-play method that can be applied to all LLMs, including both white-box and black-box models, to enhance their safety without requiring any fine-tuning of the models themselves. Our model is available for research purposes.

Jinhwa Kim, Ian G. Harris• 2025

Related benchmarks

TaskDatasetResultRank
Jailbreak AttackGCG
ASR12
47
Jailbreak AttackPAIR--
46
Jailbreak AttackAutoDAN
ASR10
42
HelpfulnessAlpaca Eval
Alpaca Eval (%)88
42
Helpfulness evaluationSHP
Helpfulness Score86
40
Helpfulness evaluationAlpaca
Helpfulness Score88
20
Jailbreak DefenseDictionary-based Jailbreak Evaluation
GCG ASR0.00e+0
20
Jailbreak Attack EvaluationDeepIn
ASR2
20
Jailbreak Attack EvaluationGPTFuzz
ASR10
20
Jailbreak Attack EvaluationReNe
ASR8
14
Showing 10 of 11 rows

Other info

Follow for update