mlsanityData to 14 Oct 2026

Large Language Models can be Strong Self-Detoxifiers

arXiv 2410.03818 ↗First posted 4 Oct 2024cs.LG cs.AI cs.CLcited by 7

On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks

Abstract (arXiv)

Reducing the likelihood of generating harmful and toxic output is an essential task when aligning large language models (LLMs). Existing methods mainly rely on training an external reward model (i.e., another language model) or fine-tuning the LLM using self-generated data to influence the outcome. In this paper, we show that LLMs have the capability of self-detoxification without the use of an additional reward model or re-training. We propose textitSelf-disciplined Autoregressive Sampling (SASA), a lightweight controlled decoding algorithm for toxicity reduction of LLMs. SASA leverages the contextual representations from an LLM to learn linear subspaces characterizing toxic v.s. non-toxic output in analytical forms. When auto-completing a response token-by-token, SASA dynamically tracks the margin of the current output to steer the generation away from the toxic subspace, by adjusting the autoregressive sampling strategy. Evaluated on LLMs of different scale and nature, namely Llama-3.1-Instruct (8B), Llama-2 (7B), and GPT2-L models with the RealToxicityPrompts, BOLD, and AttaQ benchmarks, SASA markedly enhances the quality of the generated sentences relative to the original models and attains comparable performance to state-of-the-art detoxification techniques, significantly reducing the toxicity level by only using the LLM's internal representations.

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 50 of its 52 references that are in the map. First posted on arXiv 4 Oct 2024.

Builds on

50 of 52 references.

References · 50

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023GPT-4 Technical Reportcited by 18,396
  3. 2022Training language models to follow instructions with human feedbackcited by 15,971
  4. 2017Proximal Policy Optimization Algorithmscited by 15,215
  5. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  6. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  7. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  8. 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
  9. 2021On the Opportunities and Risks of Foundation Modelscited by 4,033
  10. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,720
  11. 2022Training Compute-Optimal Large Language Modelscited by 3,019
  12. 2019The Curious Case of Neural Text Degenerationcited by 2,916
38 more
  1. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,984
  2. 2020Don't Stop Pretraining: Adapt Language Models to Domains and Taskscited by 1,565
  3. 2016Man is to Computer Programmer as Woman is to Homemaker? Debiasing Word Embeddingscited by 1,312
  4. 2020RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Modelscited by 1,255
  5. 2021Scaling Language Models: Methods, Analysis & Insights from Training Gophercited by 1,202
  6. 2016Semantics derived automatically from language corpora contain human-like biasescited by 901
  7. 2019Plug and Play Language Models: A Simple Approach to Controlled Text Generationcited by 799
  8. 2019CTRL: A Conditional Transformer Language Model for Controllable Generationcited by 762
  9. 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 722
  10. 2018Gender Bias in Coreference Resolution: Evaluation and Debiasing Methodscited by 659
  11. 2019The Woman Worked as a Babysitter: On Biases in Language Generationcited by 541
  12. 2021DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Expertscited by 441
  13. 2022ToxiGen: A Large-Scale Machine-Generated Dataset for Adversarial and Implicit Hate Speech Detectioncited by 422
  14. 2021BOLD: Dataset and Metrics for Measuring Biases in Open-Ended Language Generationcited by 412
  15. 2020GeDi: Generative Discriminator Guided Sequence Generationcited by 378
  16. 2021FUDGE: Controlled Text Generation With Future Discriminatorscited by 376
  17. 2021Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLPcited by 337
  18. 2024TrustLLM: Trustworthiness in Large Language Modelscited by 285
  19. 2019Predicting the Type and Target of Offensive Posts in Social Mediacited by 271
  20. 2022Quark: Controllable Text Generation with Reinforced Unlearningcited by 237
  21. 2019Build it Break it Fix it for Dialogue Safety: Robustness from Adversarial Human Attackcited by 176
  22. 2020Recipes for Safety in Open-domain Chatbotscited by 170
  23. 2021Challenges in Detoxifying Language Modelscited by 169
  24. 2019What makes a good conversation? How controllable attributes affect human judgmentscited by 140
  25. 2018Learning to Write with Cooperative Discriminatorscited by 119
  26. 2020Towards Controllable Biases in Language Generationcited by 112
  27. 2021Detoxifying Language Models Risks Marginalizing Minority Voicescited by 107
  28. 2020CTRLsum: Towards Generic Controllable Text Summarizationcited by 98
  29. 2023Reward-Augmented Decoding: Efficient Controlled Text Generation With a Unidirectional Reward Modelcited by 79
  30. 2024Decoding-time Realignment of Language Modelscited by 67
  31. 2018Challenges for Toxic Comment Classification: An In-Depth Error Analysiscited by 56
  32. 2021A Plug-and-Play Method for Controlled Text Generationcited by 56
  33. 2023Self-Detoxifying Language Models via Toxification Reversalcited by 46
  34. 2022Critic-Guided Decoding for Controlled Text Generationcited by 45
  35. 2023On the Challenges of Using Black-Box APIs for Toxicity Evaluation in Researchcited by 44
  36. 2023Unveiling Safety Vulnerabilities of Large Language Modelscited by 27
  37. 2023Systematic Rectification of Language Models via Dead-end Analysiscited by 16
  38. 2022Language Detoxification with Attribute-Discriminative Latent Spacecited by 11

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 4.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Detoxification of Large Language Models through Output-layer Fusion with a Calibration Model
  2. 2025Breaking Bad Tokens: Detoxification of LLMs Using Sparse Autoencoders
  3. 2025Detoxifying Large Language Models via Autoregressive Reward Guided Representation Editing
  4. 2025<think> So let's replace this phrase with insult... </think> Lessons learned from generation of toxic texts with LLMs
  5. 2026Test-Time Detoxification without Training or Learning Anything
  6. 2026Measuring and Mitigating Toxicity in Large Language Models: A Comprehensive Replication Study
  7. 2025Refining Positive and Toxic Samples for Dual Safety Self-Alignment of LLMs with Minimal Human Interventions
  8. 2024Preference Tuning For Toxicity Mitigation Generalizes Across Languages