HARC: Coupling Harmfulness and Refusal Capabilities for Robust Safety Alignment

Shei Pern Chua, Fangzhao WuNeurIPS 2026

TL;DR

When a jailbreak tricks an LLM into writing something dangerous, the model usually isn’t genuinely fooled—its internal activations show it recognizes the harm as it types, even after its initial refusal mechanism failed. By mathematically "gluing" the model's internal concept of harmfulness directly to its refusal instinct across both the prompt and response phases, HARC achieves robust jailbreak defense without lobotomizing the model or making it paranoid about harmless questions.

What Problem Does This Paper Address?

Safety-aligned LLMs are famously fragile. Ask directly for a bomb recipe, and they politely decline; wrap the request in a clever persona or code completion task, and they happily oblige. Worse, heavy-handed defenses usually trigger an "alignment tax"—degrading general intelligence or causing over-refusal (e.g., refusing to explain how to "kill" a Linux process).

Recent mechanistic interpretability work showed that inside a model's residual stream (its main internal communication highway), "recognizing harm" ($v_{\text{harm}}$) and "deciding to refuse" ($v_{\text{ref}}$) are encoded as distinct linear directions—and in later layers, they become nearly orthogonal. Because they are separate, an adversarial prompt can trigger one without the other. Prior studies only looked at these signals while the model read the prompt. The authors ask a fascinating follow-up: when a jailbreak bypasses prompt-side defenses, does the model actually know it is generating harmful content while writing its response?

Methods

First, using standard difference-of-means extraction, the authors extend representational analysis from prompt tokens into the response tokens (pooling over the first 32 generated tokens). This yields a four-direction safety geometry: harmfulness and refusal vectors at both prompt and response positions.

To close the gap that jailbreaks exploit, they introduce HARC (Harmfulness-And-Refusal Coupling), a targeted LoRA fine-tuning method:

  • Dual-Position Coupling Loss: Using an additive margin hinge loss on cosine projections, HARC forces both $v_{\text{harm}}$ and $v_{\text{ref}}$ to fire together on harmful inputs (and stay quiet on benign ones) at both prompt and response positions.
  • Architecture-Agnostic Layer Selection: Rather than tuning layers by hand, HARC automatically scores and targets late layers where harm and refusal are maximally decoupled within a position, yet consistent across prompt and response.
  • Dynamic Recomputation & Anchoring: Because LoRA updates shift the model's internal geometry during training, HARC periodically re-extracts the safety directions and smooths them via an Exponential Moving Average (EMA). Standard KL-divergence and cross-entropy terms keep general capabilities intact.
Figure 3: Cosine similarity between vharm and vref across all layers. Gray bands mark the trained layers (L25–28 on Llama; L21–24 on Qwen). Post-tuning alignment increases significantly within the trained bands and re- mains elevated in the subsequent downstream layers.

Because HARC operates strictly inside a tiny two-dimensional safety subspace, the rest of the model's computational machinery is left undisturbed.

Datasets

No new benchmarks are introduced; the paper relies on established datasets to isolate the effect of the coupling loss:

  • Direction Extraction: 300 harmful prompts from AdvBench and 300 harmless prompts from UltraChat.
  • Fine-Tuning: Harmful prompts and refusal continuations from the Circuit Breakers corpus, paired with UltraChat for benign examples (and PKU-SafeRLHF for DPO).
  • Evaluation: Adversarial robustness on JailbreakBench (testing PAP, PAIR, CodeAttack, and DeepInception); over-refusal on XSTest and CoCoNot; and general capabilities across MMLU, GSM8K, HumanEval, IFEval, and MT-Bench.

Key Insights and Ideas

  • The "Guilty Conscience" Effect: Even when a jailbreak completely suppresses harm recognition during prompt reading, the model's $v_{\text{harm}}^{\text{resp}}$ and $v_{\text{ref}}^{\text{resp}}$ signals roar back to life while it generates the harmful answer. In standard models, this realization simply arrives too late to halt the compliance trajectory.
  • Jailbreaks Leave Distinct Geometric Fingerprints: Different attack styles exploit the harmfulness–refusal plane in neatly separable ways during prompt encoding. Persona framing (DAN) leaves harm recognition intact while muting refusal; semantic rewriting (PAIR) drives harmfulness negative; and code obfuscation (CodeAttack) suppresses both, masquerading as a benign prompt.
Jailbreak attacks occupy distinct regions of the harm-refusal plane at the prompt side, while recovering strong signals during response generation.
  • Universal Safety Geometry: This four-direction structure isn't a quirk of Llama—it replicates cleanly across five distinct model families and scales from 7B up to 72B parameters at the exact same relative layer depths.

Key Results

Tested on Llama-3.1-8B and Qwen-2.5-7B against seven training- and inference-time baselines (including Circuit Breakers, RepBend, DPO, and CAST), HARC is the only method that improves safety without regressing on either helpfulness or over-refusal:

  • Strong Robustness: HARC slashes average Attack Success Rate (ASR, graded 0–1 by GPT-4o) by 4.67× on Llama-3.1-8B (0.430 $\rightarrow$ 0.092) and 4.75× on Qwen-2.5-7B (0.632 $\rightarrow$ 0.133). Pairing HARC with DPO on Llama pushes average ASR down to 0.015 (0.000 on three of four attacks).
  • Zero Alignment Tax: While baselines like RepBend achieve low ASR by refusing everything (100% over-refusal on Qwen XSTest), HARC actually undercuts the base models' over-refusal rates (dropping XSTest refusal from 0.109 $\rightarrow$ 0.035 on Llama, and 0.091 $\rightarrow$ 0.026 on Qwen) while matching baseline capability scores (0.670 vs. 0.668 on Llama; 0.717 vs. 0.714 on Qwen).
  • Effortless Scaling: Applied to Llama-3.1-70B and Qwen-2.5-72B with zero hyperparameter retuning, HARC drives Llama-70B's ASR below 0.01 on PAIR, PAP, and DeepInception while preserving MMLU and GSM8K accuracy.

Limitations and Future Work

  • Blind Spots to Deep Obfuscation: HARC binds existing harm signals to refusal; it doesn't invent new ones. Because CodeAttack wraps harmful requests in code structures absent from the natural-language training set, the model's representations stay clustered with benign inputs, leaving CodeAttack as the hardest residual vulnerability (0.290 ASR on Llama-8B). Expanding direction-extraction data to cover obfuscated formats is an immediate next step.
  • Fragility to Weight-Space Attacks: Because HARC is a surgical, low-dimensional LoRA edit designed for black-box API defense, an attacker with direct weight access can undo it by fine-tuning on roughly 160 harmful examples.
  • Future Horizons: The authors highlight defending against hypothetical attacks that erase harm recognition across both prompt and generation phases, testing adaptive attacks designed specifically to target HARC's coupled layers, and extending this four-direction analysis to multimodal vision-language models.

Summary updated

Abstract

Understanding how aligned LLMs internally represent safety is critical for diagnosing alignment vulnerabilities, as it explains why jailbreaks succeed and informs the design of robust alignment strategies. Prior work shows that aligned LLMs encode harmfulness and refusal as separable directions in the residual stream at prompt-side token positions. We show that jailbreaks succeed at prompt encoding by suppressing either the refusal or harmfulness direction before any token is generated, with distinct attack classes occupying separable regions of the harmfulness-refusal plane. Extending the analysis to response-token positions, we find that the model recognizes harmful content while it is generating that content, even when it failed to recognize the input as harmful at the prompt side. Motivated by our findings, we introduce HARC (Harmfulness-And-Refusal Coupling), a fine-tuning method that pairs the two directions across both prompt and response positions. Since the intervention is confined to the harmfulness-refusal subspace, it leaves the rest of the residual stream intact and does not degrade general capability or inflate over-refusal. Across extensive experiments, HARC achieves the strongest robustness-capability-usability trade-off among seven baselines spanning the major training-time and inference-time safety methods. The harmfulness and refusal directions at prompt and response positions transfer across the five model families and two scales we tested without architecture-specific tuning.
BibTeX
@inproceedings{chua2026harc,
  author = {Shei Pern Chua and Fangzhao Wu},
  title = {{HARC: Coupling Harmfulness and Refusal Capabilities for Robust Safety Alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=k78i4RMHGi},
}
Figure