Adaptive Detoxification: Safeguarding General Capabilities of LLMs through Toxicity-Aware Knowledge Editing
Large language models (LLMs) exhibit impressive language capabilities but remain vulnerable to malicious prompts and jailbreaking attacks.Existing knowledge editing methods for LLM detoxification face two major challenges.First, they often rely on entityspecific localization, making them ineffective against adversarial inputs without explicit entities.Second, these methods suffer from overediting, where detoxified models reject legitimate queries, compromising overall performance.In this paper, we propose TOXEDIT, a toxicity-aware knowledge editing approach that dynamically detects toxic activation patterns during forward propagation.It then routes computations through adaptive inter-layer pathways to mitigate toxicity effectively.This design ensures precise toxicity mitigation while preserving LLMs' general capabilities.To more accurately assess over-editing, we also enhance the SafeEdit benchmark by incorporating instruction-following evaluation tasks.Experimental results on multiple LLMs demonstrate that our TOXEDIT outperforms previous state-of-the-art methods in both detoxification performance and safeguarding general capabilities of LLMs.
Authors
- Meishan Zhang (ORCID: https://orcid.org/0000-0001-6335-1340)
- Yihui Zhang (ORCID: https://orcid.org/0000-0003-3587-9214)
- Yiming Zhou (ORCID: https://orcid.org/0000-0001-6819-556X)
- Fangming Liu (ORCID: https://orcid.org/0000-0002-8570-1345)
- Min Zhang (ORCID: https://orcid.org/0000-0002-2225-8024)
- Jun Qing Yu (ORCID: https://orcid.org/0000-0001-5008-2153)
- Yifan Lu (ORCID: https://orcid.org/0000-0003-3787-0440)
- Xiucheng Li (ORCID: https://orcid.org/0009-0006-4145-6698)
- Jing Li (ORCID: https://orcid.org/0000-0001-5934-4359)
- Wenya Wang (ORCID: https://orcid.org/0000-0003-3902-4088)
Publication Details
- Published
- 2025-01-01
- DOI
- https://doi.org/10.18653/v1/2025.findings-acl.1013
- Primary Topic
- Statistical and Computational Modeling
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Science Foundation
- National Natural Science Foundation of China