CausalDetox: Causal Head Selection and Intervention for Language Model Detoxification
Yian Wang, Yuen Chen, Agam Goyal, Hari Sundaram · 2026
Read CausalDetox: Causal Head Selection and Intervention for Language Model Detoxification by Yian Wang, Yuen Chen, Agam Goyal, Hari Sundaram (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-14602.txt.
Introduction
Wang, Chen, Goyal, and Sundaram propose CausalDetox, a system finding and acting on heads behind toxic output. Probability of necessity and sufficiency finds a minimal head set necessary and sufficient for toxic output. Two routes use them: local action with dynamic steering vectors per input, and PNS-guided fine-tuning that unlearns toxic patterns. PARATOX, a new benchmark of aligned toxic/non-toxic pairs, enables careful counterfactual tests. On ToxiGen, ImplicitHate, and ParaDetox, it cuts toxicity up to 5.34 percent more than rivals while keeping fluency, with 7x faster head picks.
Catalog record
| CREATOR | Yian Wang, Yuen Chen, Agam Goyal, Hari Sundaram |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 75850 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2604.14602
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
CausalDetox: Causal Head Selection and Intervention for Language Model Detoxification Yian Wang, Yuen Chen, Agam Goyal, Hari Sundaram Abstract Large language models (LLMs) frequently generate toxic content, posing significant risks for safe deployment. Current mitigation strategies often degrade generation quality or require costly human annotation. We propose CausalDetox , a framework that identifies and intervenes on the specific attention heads causally responsible for toxic generation. Using the Probability of Necessity and Sufficiency (PNS), we isolate a minimal set of heads that are necessary and sufficient for toxicity. We utilize these components via two complementary strategies: (1) Local Inference-Time Intervention, which constructs dynamic, input-specific steering vectors for context-aware detoxification, and (2) PNS-Guided Fine-Tuning, which permanently unlearns toxic representations. We also introduce ParaTox , a novel benchmark of aligned toxic/non-toxic sentence pairs enabling controlled counterfactual evaluation. Experiments on ToxiGen, ImplicitHate, and ParaDetox show that CausalDetox achieves up to 5.34% greater toxicity reduction compared to baselines while preserving linguistic fluency, and offers a 7 × 7\times speedup in head selection. 1 Introduction Large language models (LLMs) have significantly advanced natural language generation, achieving state-of-the-art performance across a wide range of tasks. Despite their advancements, LLMs continue to pose serious safety concerns due to their propensity for generating toxic, biased, or otherwise harmful content ( 12 ; 50 ) . Addressing these issues is crucial for the responsible and ethical deployment of LLMs in real-world applications. Previous detoxification approaches have primarily involved lexical filtering, adversarial training, reinforcement learning from human feedback (RLHF), and supervised fine-tuning using carefully curated datasets ( 4 ; 35 ) . While these methods achieve varying degrees of success, each presents notable limitations. Lexical filtering often disrupts semantic coherence and can fail to account for subtle, context-dependent toxicity ( 50 ) . Methods based on RLHF or supervised fine-tuning require extensive human annotation, which is costly, can lead to the inadvertent suppression of nuanced language or subtle concepts ( 52 ) , and may raise concerns about annotator well-being due to the repetitive or potentially harmful nature of the content being reviewed. More recent model-based approaches, such as direct preference optimization ( 25 ) or activation patching 41 , typically involve extensive modification of model parameters, potentially degrading unrelated model capabilities and reducing overall model generalization. To overcome these challenges, we propose CausalDetox , a principled framework that identifies and intervenes on the specific attention heads that are causally linked to toxic generation. Inspired by causal representation learning ( 46 ; 29 ; 44 ) , we utilize the Probability of Necessity and Sufficiency (PNS) to quantify the causal influence of each head. Unlike correlation-based heuristics, PNS isolates a minimal set of heads that are both necessary and sufficient for encoding toxicity. This precise localization enables us to mitigate toxicity efficiently through targeted steering and unlearning. We intervene on these heads in three complementary ways: (i) global inference-time intervention to steer activations away from toxic directions, (ii) local inference-time intervention that constructs input-dependent steering vectors for context-aware detoxification, and (iii) PNS-guided fine-tuning that further concentrates toxic representations within the selected heads. We evaluate our method on ParaDetox ( 30 ) and introduce ParaTox , a benchmark of aligned toxic–non-toxic sentence pairs constructed by paraphrasing ToxiGen ( 18 ) and ImplicitHate ( 11 ) examples using Vicuna-13B ( 5 ) . In summary, our main contributions are: • A causal criterion for head selection: We propose a novel selection criterion based on the probability of necessity and sufficiency (PNS) to identify attention heads causally responsible for toxic generation. Unlike prior correlation-based approaches, our method enables more targeted interventions with stronger toxicity reduction while preserving language fluency. • Context-Aware Local Intervention: We introduce a local inference-time intervention strategy that constructs input-specific steering vectors by aggregating activation differences from semantically similar examples in representation space. This captures the heterogeneity of toxic expressions across contexts, enabling more fine-grained and adaptive detoxification than global intervention alone. • PNS-guided fine-tuning for disentangled toxicity representations: We leverage the PNS lower bound as a training objective to fine-tune the selected attention heads, encouraging them to become both necessary and sufficient for encoding toxicity. This disentangles toxic signals from benign linguistic features, making subsequent inference-time interventions more precise and effective. • ParaTox Benchmark: We construct ParaTox , a benchmark of aligned toxic–non-toxic sentence pairs generated by paraphrasing ToxiGen ( 18 ) and ImplicitHate ( 11 ) using Vicuna-13B. This benchmark provides the counterfactual ground truth for rigorous causal evaluation and supports broader alignment research beyond CausalDetox . 2 Related Work 2.1 Detoxification in LLMs Detoxification techniques for LLMs include lexical, reinforcement learning, and model-editing approaches. Early work applied lexical or rule-based filters to remove toxic tokens, but these risk semantic loss and fail to capture context-dependent toxicity ( 12 ; 50 ) . Reinforcement learning from human feedback (RLHF) and supervised fine-tuning on curated toxicity datasets improve safety but require extensive human annotation and may inadvertently suppress benign language, particularly minority voices ( 4 ; 35 ; 52 ) . More recent methods perform targeted model edits: direct preference optimization (DPO) aligns generations towards harmlessness via modified loss functions ( 25 ; 39 ) , activation patching replaces harmful activation patterns with safe ones ( 41 ; 33 ) , and subspace steering projects hidden states onto toxicity-averse directions ( 16 ; 23 ) . Expert/anti-expert frameworks train auxiliary models to rewrite outputs toward safety ( 15 ) , while adversarial safety pipelines guard against malicious prompts ( 53 ; 9 ; 47 ) . Most recently, 45 proposed Eigen-Detox, which steers models by identifying toxicity directions via Singular Value Decomposition (SVD) on internal activations. However, many of these methods rely on correlation-based heuristics, retraining, or fine-tuning, incurring substantial computational cost and lacking a principled mechanism for isolating causally responsible components. 2.2 Causal Representation Learning for Alignment Causal representation learning (CRL) seeks to identify and manipulate latent generative factors under principled causal assumptions ( 43 ) . A foundational desideratum for such representations is articulated by 49 , where the authors provided formalized criteria, i.e., the probability of necessity and sufficiency, that guarantee the identification of meaningful latent features. Recent analyses indicate that transformer self-attention encodes structured causal dependencies between tokens ( 42 ; 34 ) , motivating causal approaches to detoxification. Causal tracing locates toxicity pathways in network circuits but often lacks principled intervention mechanisms ( 33 ) , while concept-based CRL recovers interpretable concepts through conditioning ( 40 ) but has not been fully leveraged for context-sensitive detoxification. Output-level causal methods such as CFL ( 31 ) and ATE-based bias mitigation ( 32 ) apply structural causal models at the token or generation level to suppress spurious associations. In contrast, CausalDetox applies PNS to identify internal attention heads whose component-level counterfactual influence is jointly necessary and sufficient for toxic generation, enabling targeted intervention without output-level supervision. 2.3 Inference-Time Intervention-Based Methods Inference-time intervention method modifies model behavior without weight updates. Plug-and-Play Language Models (PPLM) use gradient-based updates to steer hidden states toward desired attributes during generation ( 8 ) . GeDi employs small generative discriminators as controllers that adjust token probabilities for targeted attributes ( 24 ) . Direct Preference Optimization (DPO) shows that training LMs with certain