UniDetox: Universal Detoxification of Large Language Models via Dataset Distillation

Huimin Lu, Masaru Isonuma, Junichiro Mori, Ichiro Sakata
2/12/2026

No official code found. Best implementation: EminLU/UniDetox (3 stars, Apache-2.0, last commit 2025-04-14).

Abstract

We present UniDetox, a universally applicable method designed to mitigate toxicity across various large language models (LLMs). Previous detoxification methods are typically model-specific, addressing only individual models or model families, and require careful hyperparameter tuning due to the trade-off between detoxification efficacy and language modeling performance. In contrast, UniDetox provides a detoxification technique that can be universally applied to a wide range of LLMs without the need for separate model-specific tuning. Specifically, we propose a novel and efficient dataset distillation technique for detoxification using contrastive decoding. This approach distills detoxifying representations in the form of synthetic text data, enabling universal detoxification of any LLM through fine-tuning with the distilled text. Our experiments demonstrate that the detoxifying text distilled from GPT-2 can effectively detoxify larger models, including OPT, Falcon, and LLaMA-2. Furthermore, UniDetox eliminates the need for separate hyperparameter tuning for each model, as a single hyperparameter configuration can be seamlessly applied across different models. Additionally, analysis of the detoxifying text reveals a reduction in politically biased content, providing insights into the attributes necessary for effective detoxification of LLMs.

View on arXivView PDF

Code Implementations(1)

EminLU/UniDetoxCommunity100%
Apache-2.0
31Shell, PythonFeb 28, 20251 years agoApache-2.0

Similar Papers

Cite this paper

@article{lu2026unidetox,
  title  = {UniDetox: Universal Detoxification of Large Language Models via Dataset Distillation},
  author = {Huimin Lu and Masaru Isonuma and Junichiro Mori and Ichiro Sakata},
  year   = {2026},
  eprint = {2504.20500},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2504.20500},
  journal = {ICLR 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.20500.svg)](https://codeofpaper.com/paper/2504.20500)

Discussion