Lune

EMNLP2023Top-tier venue

Self-Detoxifying Language Models via Toxification Reversal

Chak Tou Leong, Yi Cheng, Jiashuo Wang, Jian Wang, Wenjie Li

Abstract

Language model detoxification aims to minimize the risk of generating offensive or harmful content in pretrained language models (PLMs) for safer deployment. Existing methods can be roughly categorized as finetuning-based and decoding-based. However, the former is often resource-intensive, while the latter relies on additional components and potentially compromises the generation fluency. In this paper, we propose a more lightweight approach that enables the PLM itself to achieve "selfdetoxification". Our method is built upon the observation that prepending a negative steering prompt can effectively induce PLMs to generate toxic content. At the same time, we are inspired by the recent research in the interpretability field, which formulates the evolving contextualized representations within the PLM as an information stream facilitated by the attention layers. Drawing on this idea, we devise a method to identify the toxification direction from the normal generation process to the one prompted with the negative prefix, and then steer the generation to the reversed direction by manipulating the information movement within the attention layers. Experimental results show that our approach, without any fine-tuning or extra components, can achieve comparable performance with state-of-the-art methods. 1 1 Code is available at https://github.com/ cooperleong00/ToxificationReversal Toxic Non-Toxic Context Embeddings Toxification Process Generation Space MHSA MHSA MHSA MHSA MHSA MHSA Toxification Direction Toxification Reversal Direction

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

26 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Plug and Play Language Models: A Simple Approach to Controlled Text Generation cites The Curious Case of Neural Text Degeneration
  • Fundamental Limitations of Alignment in Large Language Models cites Training language models to follow instructions with human feedback
  • Steering When Necessary: Flexible Steering Large Language Models with Backtracking cites In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
  • Steering When Necessary: Flexible Steering Large Language Models with Backtracking cites Finetuned Language Models are Zero-Shot Learners
  • Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
  • Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing cites In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
  • Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing cites Training language models to follow instructions with human feedback
  • Spherical Steering: Geometry-Aware Activation Rotation for Language Models cites Steering When Necessary: Flexible Steering Large Language Models with Backtracking
  • Spherical Steering: Geometry-Aware Activation Rotation for Language Models cites In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
  • Spherical Steering: Geometry-Aware Activation Rotation for Language Models cites Finetuned Language Models are Zero-Shot Learners
  • Finetuned Language Models are Zero-Shot Learners cites Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback cites Finetuned Language Models are Zero-Shot Learners
  • Training language models to follow instructions with human feedback cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers26

  1. In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space SteeringSheng Liu, Haotian Ye, Lei Xing, James Y. ZouICML 2024 · 244 citations
  2. Fundamental Limitations of Alignment in Large Language ModelsYotam Wolf, Noam Wies, Oshri Avnery, Yoav Levine et al.ICML 2024 · 186 citations
  3. Detoxifying Large Language Models via Autoregressive Reward Guided Representation EditingYisong Xiao, Aishan Liu, Siyuan Liang, Zonghao Ying et al.NeurIPS 2025 · 12 citations
  4. Spherical Steering: Geometry-Aware Activation Rotation for Language ModelsZejia You, Chunyuan Deng, Hanjie ChenICML 2026 · 12 citations
  5. Steering When Necessary: Flexible Steering Large Language Models with BacktrackingZifeng Cheng, Jinwei Gan, Zhiwei Jiang, Cong Wang et al.NeurIPS 2025 · 9 citations

Builds on18

  1. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  2. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations
  3. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  4. Plug and Play Language Models: A Simple Approach to Controlled Text GenerationSumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung et al.ICLR 2020 · 1,166 citations
  5. Fine-Tuning can Distort Pretrained Features and Underperform Out-of-DistributionAnanya Kumar, Aditi Raghunathan, Robbie Matthew Jones, Tengyu Ma et al.ICLR 2022 · 911 citations

Related papers

  1. Leashing the Inner Demons: Self-Detoxification for Language ModelsCanwen Xu, Zexue He, Zhankui He, Julian J. McAuleyAAAI 2022 · 30 citations
  2. Language Model Detoxification in Dialogue with Contextualized Stance ControlJing Qian, Xifeng YanEMNLP Findings 2022
  3. DSCD: Large Language Model Detoxification with Self-Constrained DecodingMing Dong, Jinkui Zhang, Bolong Zheng, Xinhui Tu et al.EMNLP 2025 · 1 citation
  4. Large Language Models can Become Strong Self-DetoxifiersChing-Yun Ko, Pin-Yu Chen, Payel Das, Youssef Mroueh et al.ICLR 2025
  5. Detoxification for LLM: From Dataset ItselfWei Shao, Yihang Wang, Gao yu Zhu, Ziqiang Cheng et al.ACL 2026
Dusk over the sea between two cliffs drawn in fine vertical lines