Context-Aware Toxicity-Adaptive Sampling for Affective Language Generation

View at publisher
Authors: Xueyao Sun, Kaize Shi, Qika Lin, Qing Li, Guandong Xu
Cited by: 1

Abstract

Large language models are increasingly deployed in emotionally sensitive settings such as empathetic dialogue and mentalhealth support, where generating safe and contextually appropriate responses is important. Ensuring emotional safety during generation is essential for maintaining trust, reducing harm, and facilitating reliable affective interaction in artificial intelligence systems. Existing safety mechanisms that prevent the generation of emotional risks or toxicity often rely on static thresholds or posthoc moderation, which cannot account for the evolving conversational context and may not prevent the production of subtle but harmful content. To address these limitations, we introduce an adaptive and context-aware generation framework that proactively regulates toxicity during token sampling. Our core contribution is a dynamic safety mechanism that adjusts risk thresholds in real-time, enabling fine-grained control over emotionally sensitive output while preserving expressive capability. The proposed method, Context-Aware Toxicity-Adaptive Samping, integrates tokenlevel toxicity deltas, an adaptive probability threshold, and toxicityaware reweighting directly into the sampling process, forming a safe vocabulary at each decoding step that reflects the current emotional context and a generation pipeline that anticipates and suppresses harmful content before it appears. Experiments demonstrate that our approach significantly reduces contextdependent toxicity and emotionally inappropriate responses across detoxification and empathetic dialogue benchmarks, while maintaining high fluency and relevance. These results further highlight the potential of applying the method for affectaware LLM deployment in mental health support, counseling, and other highsensitivity domains.

Fields of Study & Subjects

Topic Modeling Multimodal Machine Learning Applications Sentiment Analysis and Opinion Mining

Publication details

Journal / source
IEEE Transactions on Affective Computing
Publisher
Institute of Electrical and Electronics Engineers (IEEE)
Pages
1–12
Publication date
1 January 2026