Self-Sanitize: Cognitive-Inspired In-Place Mitigation of LLM Harmful Responses

Wenjie Fu, Huandong Wang, Chen Gao, Guoan Wan, Junyao Gao, Yong Li, Tao Jiang


Abstract
Despite significant advances in aligning Large Language Models (LLMs) with safety and ethical standards, adversarial prompts can still be crafted to elicit undesirable responses. Existing mitigation strategies predominantly rely on post-hoc filtering, which introduces substantial latency or computational overhead, and is incompatible with token-level streaming generation. To address this, we introduce Self-Sanitize, a novel LLM-driven mitigation framework inspired by cognitive psychology, which emulates human self-monitor and self-repair behaviors. The framework utilizes a lightweight Self-Monitor module to inspect high-level intentions via representation engineering and a Self-Repair module for in-place correction without separate review dialogues. This design allows for real-time streaming monitoring and seamless repair, with negligible impact on latency and resource utilization. Extensive experiments across three privacy-leakage scenarios and broader safety-sensitive domains (e.g., crime and bias) demonstrate that Self-Sanitize achieves superior mitigation performance with minimal overhead and preserved model utility. Our code is available at the following link: https://anonymous.4open.science/r/LLM_Self_Sanitize-5E8B
Anthology ID:
2026.emnlp-main.1390
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
31732–31757
Language:
URL:
https://aclanthology.org/2026.emnlp-main.1390/
DOI:
Bibkey:
Cite (ACL):
Wenjie Fu, Huandong Wang, Chen Gao, Guoan Wan, Junyao Gao, Yong Li, and Tao Jiang. 2026. Self-Sanitize: Cognitive-Inspired In-Place Mitigation of LLM Harmful Responses. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 31732–31757, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Self-Sanitize: Cognitive-Inspired In-Place Mitigation of LLM Harmful Responses (Fu et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.1390.pdf