Detoxification of Large Language Models through Output-layer Fusion with a Calibration Model

Yuanhe Tian, Mingjie Deng, Guoqing Jin, Yan Song
6/2/2025
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

Existing approaches for Large language model (LLM) detoxification generally rely on training on large-scale non-toxic or human-annotated preference data, designing prompts to instruct the LLM to generate safe content, or modifying the model parameters to remove toxic information, which are computationally expensive, lack robustness, and often compromise LLMs' fluency and contextual understanding. In this paper, we propose a simple yet effective approach for LLM detoxification, which leverages a compact, pre-trained calibration model that guides the detoxification process of a target LLM via a lightweight intervention in its generation pipeline.

Show full abstract

By learning a detoxified embedding space from non-toxic data, the calibration model effectively steers the LLM away from generating harmful content. This approach only requires a one-time training of the calibration model that is able to be seamlessly applied to multiple LLMs without compromising fluency or contextual understanding. Experiment results on the benchmark dataset demonstrate that our approach reduces toxicity while maintaining reasonable content expression.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tian2025detoxification,
  title  = {Detoxification of Large Language Models through Output-layer Fusion with a Calibration Model},
  author = {Yuanhe Tian and Mingjie Deng and Guoqing Jin and Yan Song},
  year   = {2025},
  eprint = {2506.01266},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.01266v1}
}

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/2506.01266.svg)](https://codeofpaper.com/paper/2506.01266)

Discussion