Context Misleads LLMs: The Role of Context Filtering in Maintaining Safe Alignment of LLMs
On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks
also in 1 more
Abstract (arXiv)
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.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 21 of its 37 references that are in the map. First posted on arXiv 9 Aug 2025.
Builds on
21 of 37 references.
Closest ancestors · 4
Same direction, newest first
- 2023Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrations10 Oct
- 2023Defending Against Alignment-Breaking Attacks via Robustly Aligned LLM18 Sep
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Models1 Sep
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
Other references · 17
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2023GPQA: A Graduate-Level Google-Proof Q&A Benchmarkcited by 2,879
- 2023Jailbreaking Black Box Large Language Models in Twenty Queriescited by 1,420
- 2024Length-Controlled AlpacaEval: A Simple Way to Debias Automatic Evaluatorscited by 897
- 2023GPTFUZZER: Red Teaming Large Language Models with Auto-Generated Jailbreak Promptscited by 560
- 2023DeepInception: Hypnotize Large Language Model to Be Jailbreakercited by 367
- 2023Certifying LLM Safety against Adversarial Promptingcited by 266
- 2023A Wolf in Sheep's Clothing: Generalized Nested Jailbreak Prompts can Fool Large Language Models Easilycited by 259
- 2024SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decodingcited by 247
5 more
- 2023LLM Self Defense: By Self Examination, LLMs Know They Are Being Trickedcited by 244
- 2023Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritizationcited by 170
- 2020Toxicity Detection: Does Context Really Matter?cited by 93
- 2021Abuse is Contextual, What about NLP? The Role of Context in Abusive Language Annotation and Detectioncited by 19
- 2025SecurityLingua: Efficient Defense of LLM Jailbreak Attacks via Security-Aware Prompt Compressioncited by 13
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2025Jailbreaking Attacks vs. Content Safety Filters: How Far Are We in the LLM Safety Arms Race?
- 2025Scalable Defense against In-the-wild Jailbreaking Attacks with Safety Context Retrieval
- 2025Paper Summary Attack: Jailbreaking LLMs through LLM Safety Papers
- 2025Beyond Jailbreaks: Revealing Stealthier and Broader LLM Security Risks Stemming from Alignment Failures
- 2025Behind the Mask: Benchmarking Camouflaged Jailbreaks in Large Language Models
- 2024Jailbreak Attacks and Defenses Against Large Language Models: A Survey
- 2024SelfDefend: LLMs Can Defend Themselves against Jailbreaking in a Practical Manner
- 2024Jailbreaking and Mitigation of Vulnerabilities in Large Language Models