DAPI: Domain Adaptive Toxicity Probe Vector Intervention, for Fine-Grained Detoxification

Cho Hyeonsu, Dooyoung Kim, Youngjoong KoACL 2025

Introduction

Large Language Models (LLMs) often inherit undesirable traits from their training data, including bias and toxicity. A common mitigation strategy is linear probing, which identifies a "toxicity vector" in the model's activation space and subtracts it during inference. However, existing methods often treat toxicity as a monolith, failing to address nuanced categories like threats or identity-based hate, and frequently compromising model fluency through overly aggressive "blunt instrument" interventions.

Presented at ACL 2025, DAPI (Domain Adaptive Toxicity Probe Vector Intervention) introduces a surgical approach to detoxification. By employing multiple, category-specific probe vectors and dynamic scaling, DAPI achieves significant toxicity reduction while maintaining near-perfect linguistic performance.

Qualitative comparison showing DAPI's ability to detoxify while maintaining context, compared to a baseline that produces generic or unrelated text.

Methodology: The DAPI Framework

DAPI operates through a three-stage process designed to make detoxification context-aware and precise.

  1. Fine-Grained Vector Extraction: Instead of a single generic vector, DAPI trains a multi-class classifier on internal model states to identify specific toxic domains: Insult, Identity-Hate, Obscene, Threat, and Other.
  2. Cosine Similarity Regularization: To prevent these vectors from collapsing into a single direction, a novel loss function enforces mathematical distinctness (orthogonality) between categories. This ensures that the "Domain Adaptive" component can function effectively without category overlap.
  3. Dynamic Selection and Scaling: During text generation, DAPI analyzes the current hidden state to determine which specific toxicity category the model is trending toward. It selects the corresponding probe vector and applies a dynamic scaling factor based on the KL-divergence between safe and unsafe probability distributions. This ensures the intervention is just strong enough to redirect the model without disrupting its "train of thought."
The DAPI architecture, illustrating the extraction of multiple probe vectors (Step 1), the selection process based on cosine similarity (Step 2), and the final detoxification step using dynamic scaling (Step 3).

Key Insights and Results

Evaluations on GPT-2 Large using the REALTOXICITYPROMPTS dataset demonstrate DAPI's efficacy:

  • Massive Toxicity Drop: DAPI achieved a toxicity score of 0.0892, compared to the unsteered model's 0.4153 (a ~78% reduction).
  • Fluency Preservation: Unlike many baselines that significantly increase perplexity, DAPI maintained a perplexity nearly identical to the base model (18.78 vs 18.77), outperforming heavy-duty baselines like DExperts.
  • Layer-Specific Intervention: The authors found that intervening at the final layer of the Transformer decoder was most effective, suggesting that high-level semantic toxicity is finalized just before token selection.
  • Computational Efficiency: DAPI requires only a small linear layer and a single forward pass, avoiding the overhead of "Expert" model ensembles that require running multiple LLMs simultaneously.

Conclusion and Future Directions

DAPI demonstrates that specialization beats generalization in model detoxification. By forcing the model to learn distinct vectors for rare categories like "Threats," it addresses gaps left by previous state-of-the-art methods. Future work includes scaling this approach to massive 70B+ parameter models and applying the multi-vector intervention framework to other attributes such as sentiment control, style, or factual accuracy.

Summary updated

BibTeX
@inproceedings{hyeonsu2025dapi,
  author = {Cho Hyeonsu and Dooyoung Kim and Youngjoong Ko},
  title = {{DAPI: Domain Adaptive Toxicity Probe Vector Intervention, for Fine-Grained Detoxification}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure