Abstract
Large Language Models (LLMs) are prone to generating toxic content, necessitating detoxification through alignment techniques such as fine-tuning (FT) and reinforcement learning (RL). While these methods effectively reduce toxicity, their internal impact on model decision-making remains opaque. This paper investigates how detoxification alters "prompt dependence"—the way a model distributes its attention across input tokens. By measuring attribution entropy, we find that counter-narrative fine-tuning promotes a holistic consideration of the prompt, whereas reinforcement learning preserves the original, localized focus. Our results indicate that counter-narrative training is a superior objective for fostering constructive model behavior.
Introduction
The tendency of LLMs to produce hateful or biased outputs is a significant barrier to their safe deployment. Current mitigation strategies, including Fine-Tuning (FT) and Reinforcement Learning from Human Feedback (RLHF), are often treated as black boxes. We observe safer outputs, but the underlying shift in internal processing is not well understood. This research addresses a critical question: Does detoxification cause a model to ignore toxic triggers, or does it learn to contextualize the entire prompt differently?
Methodology
We evaluated two detoxification strategies across RedPajama 3B and Falcon 7B:
- Counter-Narrative Fine-Tuning (FT): Models were trained on the DIALOCONAN dataset to generate educational and challenging responses to hate speech.
- Reinforcement Learning (RL): Models were optimized using a RoBERTa-based reward model trained on hate speech detection to minimize toxic generations.
To analyze internal dynamics, we utilized gradient-based feature attribution to calculate attribution entropy. High entropy indicates a broad, uniform focus on the prompt, while low entropy signifies hyper-focus on specific "trigger" words.
Results
Both FT and RL successfully reduced the frequency of toxic completions across standard benchmarks like RealToxicityPrompts (RTP).
As shown in Table 1, FT generally outperformed RL in reducing toxicity. For RedPajama 3B, toxic completions dropped from 13% in the instruction-tuned (IT) baseline to 9% with FT. Falcon 7B saw a similar reduction from 10% to 8% for both methods.
Shifts in Prompt Dependence
The most significant finding lies in the divergence of internal mechanics between FT and RL. Analysis of attribution entropy reveals that FT models maintain a higher and more stable entropy throughout the generation process compared to the IT baselines.
In baseline models, toxic outputs are typically preceded by a sharp drop in entropy, where the model "locks in" on specific toxic elements. FT counteracts this by encouraging the model to weigh the entire context, preventing it from being "hijacked" by individual toxic tokens. In contrast, RL models exhibit an attribution distribution similar to the original baseline, suggesting that RL suppresses toxicity without fundamentally changing how the model perceives the prompt.
Discussion and Conclusion
Our study demonstrates that counter-narrative fine-tuning is not merely a method for suppressing bad behavior but a way to enhance a model's contextual awareness. By teaching models to provide constructive responses, we shift their internal processing from a "spiky," trigger-based focus to a more holistic understanding of user intent.
Future work will focus on mapping specific toxic keywords to attribution spikes and exploring "importance regularization" to explicitly maintain high attribution entropy during training, potentially leading to more efficient and robust detoxification.
Summary updated