MIL-Decoding: Detoxifying Language Models at Token-Level via Multiple Instance Learning
Abstract
Despite advances in large pre-trained neural language models, they are prone to generating toxic language, which brings security risks to their applications. We introduce MIL-Decoding, which detoxifies language models at token-level by interpolating it with a trained multiple instance learning (MIL) network. MIL model is trained on a corpus with a toxicity label for each text to predict the overall toxicity and the toxicity of each token in its context. Intuitively, the MIL network computes a toxicity distribution over next tokens according to the generated context which supplements the original language model to avoid toxicity. We evaluate MIL-Decoding with automatic metrics and human evaluation, where MIL-Decoding outperforms other baselines in detoxification while it only hurts generation fluency a little bit.
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.
9 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
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
- Model Editing as a Robust and Denoised variant of DPO: A Case Study on Toxicity cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
- Process for Adapting Language Models to Society (PALMS) with Values-Targeted Datasets cites RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models
- Process for Adapting Language Models to Society (PALMS) with Values-Targeted Datasets cites The Curious Case of Neural Text Degeneration
- 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 Model Editing as a Robust and Denoised variant of DPO: A Case Study on Toxicity
- Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing cites Detoxifying Large Language Models via Knowledge Editing
- Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing cites RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models
- RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models cites Plug and Play Language Models: A Simple Approach to Controlled Text Generation
- RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models cites The Curious Case of Neural Text Degeneration
- Breaking Bad Tokens: Detoxification of LLMs Using Sparse Autoencoders cites Model Editing as a Robust and Denoised variant of DPO: A Case Study on Toxicity
- Breaking Bad Tokens: Detoxification of LLMs Using Sparse Autoencoders cites Detoxifying Large Language Models via Knowledge Editing
Cited by top-tier papers9
- Detoxifying Large Language Models via Autoregressive Reward Guided Representation EditingYisong Xiao, Aishan Liu, Siyuan Liang, Zonghao Ying et al.NeurIPS 2025 · 12 citations
- DSCD: Large Language Model Detoxification with Self-Constrained DecodingMing Dong, Jinkui Zhang, Bolong Zheng, Xinhui Tu et al.EMNLP 2025 · 1 citation
- Breaking Bad Tokens: Detoxification of LLMs Using Sparse AutoencodersAgam Goyal, Vedant Rathi, William Yeh, Yian Wang et al.EMNLP 2025 · 1 citation
- Model Editing as a Robust and Denoised variant of DPO: A Case Study on ToxicityRheeya Uppaal, Apratim Dey, Yiting He, Yiqiao Zhong et al.ICLR 2025
- Detoxifying Large Language Models via Knowledge EditingMengru Wang, Ningyu Zhang, Ziwen Xu, Zekun Xi et al.ACL 2024
Builds on13
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- 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
- Generalization through Memorization: Nearest Neighbor Language ModelsUrvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer et al.ICLR 2020 · 1,038 citations
- RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language ModelsSamuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi et al.EMNLP Findings 2020 · 692 citations
- Process for Adapting Language Models to Society (PALMS) with Values-Targeted DatasetsIrene Solaiman, Christy DennisonNeurIPS 2021 · 276 citations
Related papers
- Leashing the Inner Demons: Self-Detoxification for Language ModelsCanwen Xu, Zexue He, Zhankui He, Julian J. McAuleyAAAI 2022 · 30 citations
- Self-Detoxifying Language Models via Toxification ReversalChak Tou Leong, Yi Cheng, Jiashuo Wang, Jian Wang et al.EMNLP 2023 · 12 citations
- Detoxification for LLM: From Dataset ItselfWei Shao, Yihang Wang, Gao yu Zhu, Ziqiang Cheng et al.ACL 2026
- UniDetox: Universal Detoxification of Large Language Models via Dataset DistillationHuimin Lu, Masaru Isonuma, Junichiro Mori, Ichiro SakataICLR 2025
- Systematic Rectification of Language Models via Dead-end AnalysisMeng Cao, Mehdi Fatemi, Jackie C. K. Cheung, Samira ShabanianICLR 2023 · 2 citations
