Source-linked AI summary

Large Language Models Generate Harmful Responses Using a Distinct Mechanism, Shared Across Harm Types

Hadas Orgad, Boyi Wei, Kaden Zheng, Martin Wattenberg, Peter Henderson, Seraphina Goldfarb-Tarrant, Yonatan Belinkov

arXiv:2604.09544v2cs.CLcs.AIcs.LG

TL;DR

LLM safety remains brittle, and it is unclear whether harmfulness lacks coherent internal organization. Using targeted weight pruning as a causal probe, the paper finds a compact, shared harmful-generation mechanism distinct from benign capabilities, with compression linked to emergent misalignment and dissociated from harmful-topic recognition.

  • Problem

    Jailbreaks and narrow-domain fine-tuning can bypass aligned models, leaving unclear whether harmfulness has a coherent internal organization.

  • Method

    The paper uses targeted weight pruning to causally probe harmful-generation parameters while preserving weights supporting benign capabilities.

  • Results

    Harmful generation relies on a compact, shared mechanism distinct from benign capabilities; aligned models compress it more strongly, and pruning it reduces emergent misalignment.

  • Takeaways & Limitations

    The findings support safety approaches that target harmful-generation mechanisms rather than relying solely on brittle behavioral guardrails.

  • Takeaways & Limitations

    Pruning harmful-generation weights can also increase refusal on benign financial-advice queries, indicating coupling to adjacent non-harmful content.

Abstract

from arXiv · show

Large language models (LLMs) undergo alignment training to avoid harmful behaviors, yet the resulting safeguards remain brittle: jailbreaks routinely bypass them, and fine-tuning on narrow domains can induce ``emergent misalignment'' that generalizes broadly. Whether this brittleness reflects a fundamental lack of coherent internal organization for harmfulness remains unclear. Here we use targeted weight pruning as a causal intervention to probe the internal organization of harmfulness in LLMs. We find that harmful content generation depends on a compact set of weights that are general across harm types and distinct from benign capabilities. Aligned models exhibit a greater compression of harm generation weights than unaligned counterparts, indicating that alignment reshapes harmful representations internally--despite the brittleness of safety guardrails at the surface level. This compression explains emergent misalignment: if weights of harmful capabilities are compressed, fine-tuning that engages these weights in one domain can trigger broad misalignment. Consistent with this, pruning harm generation weights in a narrow domain substantially reduces emergent misalignment. Notably, LLMs harmful generation capability is dissociated from how they recognize and explain such content. Together, these results reveal a coherent internal structure for harmfulness in LLMs that may serve as a foundation for more principled approaches to safety.

1 Introduction

The paper probes whether harmfulness has a coherent internal mechanism by causally pruning targeted weights while preserving benign capabilities. It finds that harmful generation is compact, shared across harm types, linked to emergent misalignment, and separable from harmful-content recognition.

  • Motivation and approach: Targeted pruning tests whether harmfulness is encoded in a distinct, compressed subset of weights rather than dispersed across model internals.The intervention removes parameters contributing to harmful generations while preserving parameters essential for benign tasks.
  • Core findings: Approximately 0.0005% of parameters support harmful generation, while general capabilities remain largely intact after their removal.This compactness indicates that harmful generation is localized rather than diffuse.
  • Core findings: Pruning harmful-generation weights generalizes across harm categories, reducing outputs in unrelated domains such as malware, hate speech, and physical-harm instructions.The cross-category effect supports a shared generative mechanism for diverse harmful behaviors.
  • Alignment and compression: Aligned models show stronger separation between harmful-generation and benign-capability weights, and this separation increases with model scale.Alignment therefore reorganizes and compresses harmfulness internally even when refusal behavior remains vulnerable to attacks.
  • Emergent misalignment: Pruning the relevant weights substantially reduces emergent misalignment, including when pruning data and fine-tuning data come from different harm domains.This result supports compression as a mechanism linking narrow-domain fine-tuning to broad harmful behavior.
  • Dissociations and implications: The pruned weights affect harmful-content production rather than harmful-topic knowledge: models retain harmful-request recognition and risk explanation but can partially relearn generation through fine-tuning.The dissociation distinguishes generation from understanding and supports causal targeting of harmful output mechanisms.
  • Dissociations and implications: Weight pruning functions here as a causal probe of model internals, not as a deployment-ready safety intervention.The authors propose that its structural findings may inform future safety methods targeting mechanisms rather than relying solely on behavioral guardrails.

2 Method

The method identifies weights that promote harmful generations and excludes weights important for benign capabilities. It combines signed importance scores over harmful examples with a separate benign-task preservation set, then prunes the resulting difference.

  • Method overview: The analysis uses weight pruning as a causal intervention to identify parameters responsible for harmful outputs while preserving general capabilities.This applies pruning as a mechanistic-interpretability tool rather than solely for efficiency or behavior modification.
  • Model and notation: Each scalar weight W_ij is indexed across the MLP and self-attention matrices of all transformer layers.The notation applies to individual parameters regardless of their layer or component.
  • Harmful-weight ranking: For each weight, a signed SNIP-style score estimates the loss change from setting that weight to zero on a harmful prompt-response pair.The loss is the negative log-likelihood of the response conditioned on the prompt, and the score uses a first-order Taylor approximation.
  • Harmful-weight ranking: Negative scores identify weights that facilitate harmful generation, whereas positive scores indicate weights that suppress harmful outputs and are excluded from pruning.Scores are computed in a single forward–backward pass.
  • Dataset aggregation: Importance scores are averaged across examples in a pruning dataset to obtain dataset-level rankings.The method computes per-example scores and then averages them over the dataset.
  • Dual calibration: A separate preservation set identifies weights important for benign tasks, preventing pruning from degrading general capabilities that overlap with harmful behavior.The pruning and preservation datasets contain harmful and general benign language tasks, respectively.
  • Dual calibration: The final pruning set is the difference between top-ranked harmful-generation weights and top-ranked utility weights.This isolates weights important for harmful content but not essential for benign tasks; q and p control the respective percentages.
  • Calibration data: Harmful weights are identified from jailbroken AdvBench responses, while benign-capability weights are identified from safety-filtered Alpaca data.These datasets provide the harmful-generation and benign-preservation calibration signals.

3 A Unified Mechanism Underlies Harmful Content Generation

Targeted pruning shows that harmful content generation relies on a compact, unified weight mechanism that is separable from benign capabilities. Alignment training increases this separation, while pruning can affect adjacent benign content.

  • Surgical removal: Across models and jailbreaks, pruning approximately 0.0005% of parameters substantially reduces harmfulness while preserving utility.The result indicates that harmful generation is highly compressed and can be surgically removed with minimal general capability loss.
  • Cross-domain generalization: Pruning weights identified from one harm category substantially reduces harmful outputs in semantically unrelated categories.Malware-derived pruning transfers to hate speech, physical harm instructions, and adult content, supporting shared parameters across harm types.
  • Cross-domain generalization: Weight sets overlap across harm categories but nearly not at all with weights for a benign control task.Factual knowledge is not similarly separable, indicating that harmfulness reflects a structural distinction rather than a generic property of capabilities.
  • Effect of alignment training: Alignment training increases separation between harmful-generation weights and benign-capability weights, with compression emerging progressively during training.The OLMo-3-7B sequence shows gradual emergence, while later alignment stages enable removal beyond refusal.
  • Effect of alignment training: Explicitly aligned models retain lower harmful generation after refusal is ablated, unlike instruction tuning without explicit safety training.Mistral-Instruct either generates harmful responses or incurs a significant utility drop under the same comparison.
  • Effect of alignment training: Pruning harmful-generation weights can increase refusal on benign financial-advice queries, showing coupling to adjacent topics learned as refusal targets.This effect defines a practical boundary on the intervention’s selectivity.

4 Compression Explains Emergent Misalignment

The paper interprets emergent misalignment as a consequence of harmfulness being encoded through a shared mechanism. Pruning that mechanism reduces misalignment across domains while preserving downstream utility.

  • Setup: Emergent misalignment involves narrow-domain fine-tuning increasing harmfulness on general benign requests and requires harmful responses outside the fine-tuning domain.The study examines bad medical advice, extreme sports, and risky financial advice.
  • Results: In-domain pruning substantially reduces emergent misalignment, and cross-domain pruning is comparably effective across most conditions.Overlap between pruned weight sets across domains supports operation through a shared mechanism.
  • Implications: EM-targeted pruning preserves downstream utility while reducing misalignment.This supports the paper’s structured interpretation that compressed harmful behavior is both implicated in EM and tractable to target.
  • Implications: The paper interprets emergent misalignment as arising because harmful behaviors are mechanistically compressed.Fine-tuning one narrow domain can therefore engage shared harmfulness-related parameters across domains.

5 Generating Harmful Content is Distinct From Understanding It

Pruning harmful-generation weights sharply reduces harmful output without comparably removing detection, explanation, or refusal capabilities. The results therefore separate producing harmful content from understanding or regulating it.

  • Dissociation: Pruned models retain nearly full detection, explanation, and refusal performance despite reduced harmful-generation capability.The study evaluates these capabilities with distinct prompt formats and metrics.
  • Dissociation: Figure 3 shows harmful generation dropping sharply while refusal, explanation, and detection remain largely preserved relative to the unpruned baseline.Its second panel reports a double dissociation between harm generation and refusal, with measurements after prefilling to bypass refusal.
  • Dissociation: In Llama-3.1-8B-Instruct and Qwen-2.5-14B-Instruct, explanation quality and detection accuracy degrade minimally after generation weights are removed.The findings support modular organization between harmful content production and recognizing or reasoning about it.
  • Recovery and gating: Fine-tuning on harmful examples partially restores generation but does not erase the underlying knowledge removed from the generation mechanism.Recovery is incomplete, and responses often mimic harmful structure without actionable substance.
  • Recovery and gating: Removing harmful-generation weights can trigger over-active refusal, which prefilling bypasses to reveal largely intact capabilities behind the gate.This separates the generation mechanism from the retained capabilities used to reason about harmful content.

6 Related Work

Related work covers harmful text generation, existing safety mitigations and their brittleness, mechanistic studies of alignment, machine unlearning, and pruning-based behavioral modification.

  • Harmful text generation: LLMs can generate instructions for illegal activities, crimes and evasion, and harassment, motivating research on harmful text generation.The cited work frames malicious use as a significant safety concern.
  • Safety mitigations: Existing mitigations include RLHF, filtering, fine-tuning, Constitutional AI, and deliberative alignment, but none are foolproof.Prompt engineering and adversarial methods continue to expose limitations.
  • Safety mitigations: Recent evaluations report limitations and lack of robustness in defenses beyond alignment training, motivating deeper mechanistic approaches.The paper characterizes reactive, layered defenses as increasingly challenged by more capable models and sophisticated attacks.
  • Mechanistic studies: Prior mechanistic work finds safety-alignment contributions to be extremely sparse at neuron and rank levels.One cited result estimates less than 3% at both levels.
  • Machine unlearning: Machine unlearning erases knowledge of specific training data, whereas this paper targets harmful-content generation while preserving other understanding.The distinction is between removing knowledge and modifying generation capacity.
  • Pruning LLMs: Network pruning removes selected weights and has been used to modify LLM behavior, including memorized content, disallowed functionality, and safety guardrails.This work places harmful-generation intervention within that broader pruning literature.

7 Discussion

The discussion argues that alignment compresses harmful-generation mechanisms into a coherent, targetable structure while leaving refusal behavior brittle. This structure both enables mechanistic safety interventions and explains why narrow-domain fine-tuning can produce broad misalignment.

  • Alignment reorganizes the parameter space to consolidate harmful generation beyond teaching models when to refuse.The OLMo progression indicates that supervised fine-tuning introduces refusal behavior, while preference optimization enables cleaner removal of harmful generations beyond the refusal gate.
  • Jailbreaks bypass a shallow refusal gate while leaving the deeply compressed harmful-generation mechanism intact.The discussion reframes brittleness as a property of the refusal interface rather than evidence that alignment lacks internal organization.
  • Compression makes harmfulness tractable to target but also propagates narrow-domain fine-tuning pressure across domains, driving emergent misalignment.Pruning the relevant weights reduces emergent misalignment, supporting compression as its direct cause in this setting.
  • Harmful generation can be impaired while models retain harm recognition and explanation, making this dissociation relevant to safety-system design.The paper presents this as architecturally feasible in principle and relates pruning to lesion studies of separable capabilities.
  • Mechanistic alignment targets the mechanisms producing unsafe behavior and complements behavioral alignment with causal understanding.The compact, causally efficacious harmfulness module is presented as a proof of concept for this research direction.

A.1 Pruning Implementation Details

The pruning implementation selects sparsity using a utility–harmfulness trade-off, targets generation-facilitating weights with signed scores, and preserves broadly influential benign-capability weights with unsigned scores. The experiments use specified harmful, preservation, emergent-misalignment, and utility-evaluation datasets and controls.

  • Sparsity is selected to maximize TriviaQA accuracy while keeping StrongREJECT below 0.1 on validation data.If no configuration meets the threshold, the method chooses the lowest StrongREJECT score among configurations retaining at least 95% of unpruned utility.
  • The authors caution that better harmfulness-reduction configurations may exist, so reduction-magnitude differences should not be read as model-level separability differences.
  • The harmfulness-pruning dataset uses 412 AdvBench samples for pruning and 100 for validation, while preservation scoring samples 412 safety-filtered Alpaca examples.Harmful completions are generated with refusal ablation; larger preservation samples showed no meaningful improvement beyond 412 examples.
  • Emergent-misalignment pruning uses three 6,000-example narrow domains, reserving 1,000 examples for pruning and 5,000 for evaluation.The domains are risky financial advice, extreme sports, and harmful medical advice.
  • Experiments use matched sparsity across capability-targeted pruning conditions and verify utility remains within 95% of the unpruned model.A dedicated search found slightly better configurations for individual capabilities, but matched sparsity avoids confounding by pruned-weight count.
  • Signed scores identify weights facilitating harmful generation, while unsigned scores preserve weights important to benign capabilities in either direction.Negative harmfulness importance scores are pruned; absolute scores are used for preservation because sign is more noise-sensitive for benign performance.
  • This signed-pruning and unsigned-preservation combination yields the best trade-off between harmfulness reduction and utility preservation.
  • Utility is assessed through zero-shot reasoning, factual knowledge, and instruction-following quality, alongside StrongREJECT harmfulness scores.Reasoning averages six benchmarks; TriviaQA measures closed-book exact-match factual accuracy; Alpaca responses receive normalized judge scores.

B Pruning Factuality

Pruning harmful-generation weights reduces harmfulness while largely preserving utility, whereas pruning factuality weights degrades factual accuracy and harmful-generation capability together. This asymmetry supports harmfulness as a specialized, separable parameter subset rather than a generic modular property.

  • Control experiment: Pruning harmful-generation weights substantially reduces harmfulness with minimal impact on utility, unlike pruning factuality weights.The utility–harmfulness curves show a favorable nonlinear trade-off for harmfulness pruning and proportional degradation for factuality pruning.
  • Control experiment: Factuality pruning reduces factual accuracy and harmful-generation capability together, indicating that these capabilities cannot be cleanly separated.The pattern is reported across Llama-3.1-8B-Instruct, Qwen2.5-14B-Instruct, and Qwen2.5-32B-Instruct.
  • Interpretation: The harmfulness–factuality asymmetry supports harmful generation as a specialized weight subset rather than evidence that arbitrary capabilities are modular.Factual knowledge may rely on shared low-level language circuits that affect other behaviors, including harmful generation.
  • Specificity: The second-most-harmful weight set also reduces harmfulness, but its utility cost differs across model families.For Llama, the larger utility reduction may explain lower harmfulness scores; Qwen models show especially large harmfulness reductions in the 32B model.

D Harmful Generations Pruned Weights Overlap Analysis

Pruned harmful-generation weight sets overlap substantially across harmful categories, supporting a shared mechanism, while emergent-misalignment analyses compare overlap across fine-tuning domains and against a benign control.

  • Cross-category overlap: Harmful categories consistently show greater per-layer Jaccard overlap than harmful-versus-TriviaQA pairs across three model families.The comparison covers Llama-3.1-8B-Instruct, Qwen2.5-14B-Instruct, and Qwen2.5-32B-Instruct.
  • Cross-category overlap: The overlap pattern indicates that different harmful-generation types substantially share supporting weights while sharing minimal structure with benign factual capability weights.TriviaQA serves as the benign control in the harmful-versus-control comparisons.
  • Emergent misalignment: Qualitative examples show that narrow-domain fine-tuning can produce broadly misaligned responses, whereas the pruned model produces a substantially more aligned response.The examples concern Qwen2.5-14B-Instruct and compare baseline and pruned responses after narrow-domain fine-tuning.
  • Emergent misalignment: Emergent-misalignment experiments compare pruned-region overlap across bad-medical-advice, extreme-sports, and risky-financial-advice datasets against TriviaQA.The analysis uses average Jaccard similarity across layers as the comparison measure.

G Effect of Alignment Training on Compression

Alignment training increases the compression and separation of harmful-generation weights, improving harmfulness reduction at low utility cost beyond the refusal mechanism. The progression from SFT to DPO/RL suggests deeper compression requires extended optimization, while pruning can spill over onto adjacent benign content.

  • Alignment and compression: 92.8% harmfulness reduction within a 10% utility budget is achieved by Llama-3.1-8B-Instruct, versus 47.6% for its pretrained counterpart.This comparison is reported under a prefilling attack and illustrates the stronger utility–harmfulness trade-off of aligned models.
  • Alignment and compression: Aligned variants retain harmfulness reduction after refusal ablation, whereas Mistral-7B-Instruct either generates harmful responses or incurs substantial utility degradation.This indicates that explicit alignment training affects more than the surface refusal mechanism.
  • Training progression: The OLMo progression shows SFT achieving only 29.2% harmfulness reduction at ≤10% utility loss after refusal ablation, while DPO and RL show substantial compression.The checkpoint sequence traces changes from pretraining through midtraining, long-context extension, SFT, DPO, and RL.
  • Training progression: The SFT–DPO gap suggests compression is not an immediate consequence of safety-data exposure but requires extended optimization pressure.The paper describes compression as developing in two stages: a refusal gate followed by deeper harmful-generation reorganization.
  • Spillover: Pruning makes aligned models more reluctant on benign financial-advice queries, producing refusals, apologetic preambles, and mild coherency impairment.The spillover is strongest near content the models have learned to refuse, reflecting shared parameter structure.
  • Scaling: Larger Qwen2.5 instruct models achieve greater harmfulness reduction at lower utility cost, consistent with increased harmfulness compression with scale.Figure 10 compares 1.5B, 7B, 14B, and 32B models under prefilling attack.

I.1 Cross-capabilities pruning effects

Cross-capability pruning reveals that capability-specific weight sets are largely disjoint, but indirect dependencies can still produce collateral effects. Detection is especially model-dependent: it remains relatively separable in Qwen but is entangled with core language circuits in Llama.

  • Capability effects: Pruning refusal increases harmful generation and can degrade reasoning, explanation, or detection in model-dependent ways.Llama shows more detection false positives, while Qwen shows more false negatives after refusal pruning.
  • Detection: Detection pruning remains relatively targeted in Qwen, but increasing pruning aggressiveness jointly degrades Llama detection, TriviaQA performance, and response coherency.The Llama degradation culminates in simultaneous collapse at higher sparsity levels.
  • Detection: Llama detection is therefore deeply entangled with core language circuits, unlike generation or refusal, which can be more cleanly isolated.This entanglement is why Llama detection pruning is omitted from the cross-capability analysis.
  • Matrix interpretation: Figure 11 compares capability changes relative to the unpruned baseline, with rows for targeted capabilities, columns for metrics, and blue borders marking intended effects.Negative cells indicate decreases; non-negative cells indicate no impairment.
  • Weight-set overlap: All pairwise Jaccard indices across capability-specific weight sets are below 0.033, indicating largely disjoint circuits.Despite low direct overlap, pruning one capability can affect another through indirect functional dependencies.

K Finetuning After Pruning

Fine-tuning partially restores harmful generation after pruning, but judge assessments and qualitative examples show that recovered responses are generally less actionable and often merely mimic harmful-answer formats.

  • Fine-tuning partially restores harmful generation in pruned models.Figure 14 evaluates baseline and pruned models after fine-tuning on 30 harmful examples, with and without prefilling.
  • A dedicated judge evaluates usefulness of generated continuations to malicious actors on a 1–10 scale.The judge scores only the AI-generated continuation and assesses its usefulness beyond the supplied prefix.
  • Pruning shifts judge-score distributions toward lower values across all three models after fine-tuning and prefilling.Baseline scores are concentrated near the upper end, with median 9.0 for all models, while pruning produces less useful recovered responses.
  • Pruned models often produce structurally mimetic but substantively empty responses that adopt harmful-answer formats without actionable details.Examples include numbered steps and topical vocabulary paired with vague or deflective content.
Loading 2604.09544v2…