Saved in:
Bibliographic Details
Main Authors: Lu, Yifan, Li, Jing, Zhou, Yigeng, Zhang, Yihui, Wang, Wenya, Li, Xiucheng, Zhang, Meishan, Liu, Fangming, Yu, Jun, Zhang, Min
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2505.22298
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916764380561408
author Lu, Yifan
Li, Jing
Zhou, Yigeng
Zhang, Yihui
Wang, Wenya
Li, Xiucheng
Zhang, Meishan
Liu, Fangming
Yu, Jun
Zhang, Min
author_facet Lu, Yifan
Li, Jing
Zhou, Yigeng
Zhang, Yihui
Wang, Wenya
Li, Xiucheng
Zhang, Meishan
Liu, Fangming
Yu, Jun
Zhang, Min
contents 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 entity-specific localization, making them ineffective against adversarial inputs without explicit entities. Second, these methods suffer from over-editing, 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.
format Preprint
id arxiv_https___arxiv_org_abs_2505_22298
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Adaptive Detoxification: Safeguarding General Capabilities of LLMs through Toxicity-Aware Knowledge Editing
Lu, Yifan
Li, Jing
Zhou, Yigeng
Zhang, Yihui
Wang, Wenya
Li, Xiucheng
Zhang, Meishan
Liu, Fangming
Yu, Jun
Zhang, Min
Computation and Language
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 entity-specific localization, making them ineffective against adversarial inputs without explicit entities. Second, these methods suffer from over-editing, 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.
title Adaptive Detoxification: Safeguarding General Capabilities of LLMs through Toxicity-Aware Knowledge Editing
topic Computation and Language
url https://arxiv.org/abs/2505.22298