cs.AIOct 30, 2026

LLM Detoxification via Transition-Aware Reward-Guided Representation Sampling

Authors: Aishan Liu, Yisong Xiao, Xianglong Liu, Yongxin Huang, Siyuan Liang, Zonghao Ying, Yang Qu, Jian Yang, 

Organizations: SKLCCSE, the School of Computer Science and Engineering, Beihang University, Beijing 100191, China. · BAAI, Beijing 100191, China. · the College of Computing & Data Science, Nanyang Technological University, Singapore 639798. · the Institute for Artificial Intelligence, Peking University, Beijing 100191, China.

Abstract

Large Language Models (LLMs) can generate toxic content, motivating effective test-time detoxification. Existing representation steering methods often rely on static or coarse interventions and provide imprecise guidance because they inadequately model transitions between toxic and non-toxic generations. We propose Transition-Aware Reward-Guided Representation Sampling (TARGRS), a test-time framework that learns reward guidance over toxicity transitions in latent representation space. During exploration, progressive steering along the toxicity direction constructs trajectories from non-toxic to toxic states. Toxicity scores along these trajectories turn sparse annotations into dense, listwise supervision for a transition-aware token-level reward model. During inference, TARGRS uses this model to guide coarse-to-fine sampling along the opposite, non-toxic direction: coarse sampling identifies the intervention needed to reach non-toxic regions, and refinement selects a detoxified representation with minimal perturbation. Experiments on 10 LLMs across RealToxicityPrompts, BOLD, and AttaQ show that TARGRS consistently outperforms state-of-the-art baselines, reducing toxicity by up to 69.38% on RealToxicityPrompts. TARGRS runs nearly as fast as the original LLM while preserving its core capabilities with minimal impact. By intervening in the language decoder space, TARGRS also extends to Large Vision-Language Models (LVLMs), reducing toxicity by up to 64.23% across 3 representative LVLMs.

Figures & tables

Explore similar work

CardsList
  1. Detoxifying LLMs via Representation Erasure-Based Preference Optimization

    Feb 24, 2026Nazanin Mohammadi Sepahvand, Eleni Triantafillou, Hugo Larochelle +3LLM SafetyText Detoxification

  2. CausalDetox: Causal Head Selection and Intervention for Language Model Detoxification

    Apr 16, 2026Yian Wang, Yuen Chen, Agam Goyal +1Causal Reasoning in Language ModelsLLM Safety

  3. Detoxification for LLM: From Dataset Itself

    Apr 21, 2026Wei Shao, Yihang Wang, Gaoyu Zhu +4Training Data CurationLLM Safety