From Detection to Refusal: Safer LLMs via Circuit-Guided Weight Scaling

Kuan-Lin Chu, Chung-En Sun, Tsui-Wei (Lily) Weng

CSE / HDSI, University of California, San Diego

klinchu@ucsd.edu, cesun@ucsd.edu, lweng@ucsd.edu

EMNLP 2026 Findings


Abstract

Large language models remain vulnerable to producing unsafe content under adversarial prompting, yet how safety behavior is implemented inside the network is poorly understood. We identify a three-stage safety circuit — Harmful Detection Heads that flag harmful inputs, Safety Neurons that stabilize the signal in the residual stream, and Refusal Heads that write the refusal — using lightweight, training-free probing on paired prompts. Targeted ablation and activation patching give causal evidence that detection drives refusal, and this decomposition recurs across six architectures and several jailbreak attacks. Building on it, our training-free weight-scaling intervention (CBSE) improves safety under attack by 26.5% while incurring only a 1.7% average accuracy drop on four standard benchmarks.


Contributions

  1. The safety circuit. We characterize a three-stage detection-to-refusal circuit composed of Harmful Detection Heads, Safety Neurons, and Refusal Heads. All three are recovered with lightweight, training-free probing on paired harmful/neutral prompts that differ by a single word.
  2. Causal validation. Targeted ablation and activation patching show that detection heads causally drive refusal heads, with safety neurons mediating the pathway. Matched random-component controls rule out both a shared-upstream-cause and a generic difficulty-detector explanation.
  3. Circuit-Based Safety Editing (CBSE). We introduce a training-free, architecture-preserving weight-scaling intervention that reinforces the identified circuit without new parameters or added inference cost. Across six LLMs and attacks including GCG, PAIR, AutoDAN, and ADV-LLM, CBSE substantially improves safety while largely preserving utility.

A Three-Stage Detection-to-Refusal Circuit

We identify three types of safety-related components using probing on paired prompts that differ by a single word (e.g., “...make a bomb...” vs. “...make a model...”) — no training or gradient updates required.

  • Harmful Detection Heads — “Is this input harmful?” Attention heads that selectively redirect attention toward the harmful token when present, separating harmful prompts from otherwise-identical neutral ones.
  • Safety Neurons — “Stabilize the signal.” MLP neurons that transform and stabilize the safety signal already present in the residual stream.
  • Refusal Heads — “Write the refusal.” Attention heads active during generation whose residual-stream writes align strongly with the model’s internal refusal direction.
Overview of the detection-to-refusal circuit

Figure 1: Overview of the detection–refusal circuit and circuit-guided intervention. (Left) Paired prompts identify Harmful Detection Heads. (Middle) Paired responses define a refusal direction used to select Refusal Heads and Safety Neurons. (Right) Scaling these components strengthens safety alignment while largely preserving utility.


The Circuit Is Causal, Not Just Correlational

Ablating detection heads or safety neurons collapses downstream refusal-head activity, while ablating the same number of random components does not — direct evidence that these components, not the network at large, drive refusal.

Targeted ablation of harmful detection heads

Figure 2a: Ablating harmful detection heads causes a sharp drop in downstream refusal-head contribution across six architectures; random ablation of the same size (dashed) leaves refusal largely intact.

Targeted ablation of safety neurons

Figure 2b: Ablating safety neurons produces an even more pronounced collapse in refusal-head contribution, underscoring their mediating role.

Ruling out a shared cause. Removing component A weakens component C — but does A directly cause C, or do both share a common upstream cause? We rule out the latter with activation patching: swapping only the detection heads’ output between paired harmful and neutral runs, holding everything else fixed, moves the refusal heads’ contribution in the same direction on five of six architectures.

LLaMA3LLaMA2Mistral GuanacoQwen2.5Qwen3
Forward (harmful←neutral) 0.7%30.3%34.6%31.1%31.3%19.5%
Backward (neutral←harmful) 18.2%65.5%70.6%39.4%51.5%59.8%

Table 1: Activation patching on the detection→refusal pathway: fraction of the harmful–neutral gap in refusal-head contribution explained by patching only the detection heads’ output (51 paired prompts each).


Circuit-Based Safety Editing (CBSE)

CBSE is a training-free, architecture-preserving weight-scaling intervention that reinforces the identified circuit — no gradient updates, no new parameters, no added inference cost.

1. Identify Harmful Detection Heads

Using ~50 paired harmful/neutral prompts that differ by a single word, score each attention head by how strongly it redirects attention toward the harmful token, and keep the top heads.

2. Identify Safety Neurons & Refusal Heads

From paired refusing/complying responses, extract a refusal direction. Select the refusal heads whose residual-stream writes align with it and the MLP safety neurons that modulate its strength.

3. Weight Scaling to amplify the Circuit

Multiply the output projection \(W_O\) of the top detection and refusal heads, and the down-projection \(W_{\text{down}}\) columns of the top safety neurons, by a scaling factor \(\alpha > 1\) — leaving every other weight untouched.

Figure 3 sweeps the scaling factor for a single component type at a time. Reinforcing any one type already raises safety, but jointly scaling detection heads, refusal heads, and safety neurons together produces the largest and most consistent gains — while a random-component control of the same size shows no comparable improvement.

Detection head scaling sweep

Figure 3a: Detection Heads

Refusal head scaling sweep

Figure 3b: Refusal Heads

Safety neuron scaling sweep

Figure 3c: Safety Neurons

Figure 3: Scaling each component type in isolation consistently improves Llama-Guard safety rates under GCG attacks across all six architectures.


Results

Averaged across six LLMs, CBSE raises the safety rate under attack from 43.2% to 69.7% (+26.5%) while reducing average accuracy on four standard benchmarks by only 1.7%. The largest gains come on the strongest attacks, where the original models are most vulnerable.

CBSE is evaluated across six LLM architectures under Pure Harmful Prompt, GCG, and ADV-LLM attacks (measured with Llama-Guard), and on four standard utility benchmarks.

Safety Rate (%) ↑ LLaMA3LLaMA2Mistral GuanacoQwen2.5Qwen3
Original (Pure / GCG / ADV-LLM) 100 / 72 / 14100 / 55 / 1099 / 40 / 9 64 / 6 / 10100 / 27 / 3100 / 53 / 8
CBSE (Ours) 91 / 97 / 27100 / 95 / 99100 / 87 / 68 88 / 45 / 71100 / 89 / 43100 / 100 / 29

Table 2: Safety rates (%) under Pure Harmful Prompt / GCG / ADV-LLM attacks, jointly reinforcing detection heads, refusal heads, and safety neurons.

Accuracy (%) ↑ LLaMA3LLaMA2Mistral GuanacoQwen2.5Qwen3
Original — MMLU / HellaSwag / PIQA / WinoGrande 66.6 / 58.7 / 80.9 / 76.247.6 / 58.0 / 76.3 / 72.5 59.1 / 66.9 / 82.2 / 78.733.8 / 59.5 / 79.0 / 72.9 74.0 / 62.5 / 79.2 / 74.972.6 / 52.6 / 77.9 / 66.5
CBSE — MMLU / HellaSwag / PIQA / WinoGrande 63.1 / 58.2 / 79.7 / 75.643.9 / 56.6 / 75.1 / 67.6 55.8 / 66.1 / 80.5 / 76.633.7 / 58.8 / 78.3 / 73.5 71.3 / 61.9 / 71.6 / 69.569.2 / 51.6 / 76.3 / 66.1

Table 3: Utility on four standard benchmarks. Across all six architectures, CBSE incurs only a 1.7% average accuracy drop.


Related Work

Mechanistic interpretability of safety

Safety interventions & defenses

Jailbreak attacks


Cite this work

Kuan-Lin Chu, Chung-En Sun, and Tsui-Wei (Lily) Weng. “From Detection to Refusal: Safer LLMs via Circuit-Guided Weight Scaling.” Findings of EMNLP, 2026.

@inproceedings{cbse,
    title={From Detection to Refusal: Safer LLMs via Circuit-Guided Weight Scaling},
    author={Kuan-Lin Chu and Chung-En Sun and Tsui-Wei Weng},
    booktitle={Findings of the Association for Computational Linguistics: EMNLP 2026},
    year={2026}
}