Residual Stream Analysis of Overfitting And Structural Disruptions
Organizations: BUPT · Baidu
Abstract
Ensuring that large language models (LLMs) remain both helpful and harmless poses a significant challenge: fine-tuning on repetitive safety datasets, where unsafe prompts are paired with standard refusal templates, often leads to false refusals, in which benign queries are declined. We first quantify this effect, showing that safety data exhibits substantially lower token entropy and 2-gram diversity (0.048) compared to general instruction data. To uncover the root cause, we introduce FlowLens, a stable PCA-based tool for residual-stream geometry analysis, and reveal that higher proportions of safety examples concentrate variance along a few components, reducing representational smoothness and driving false refusals (false refusal rate rises from 63 percent to 84 percent as safety data increases from 0 percent to 40 percent). Guided by these insights, we propose Variance Concentration Loss (VCL), an auxiliary regularizer that penalizes excessive variance concentration in mid-layer residuals. Empirical results demonstrate that VCL reduces false refusals by over 35 percentage points while maintaining or improving performance on general benchmarks such as MMLU and GSM8K.
Figures & tables
| Metric | WildJailbreak | WildGuardMix | Tulu-3-SFT-Mixture | Control | ||||
|---|---|---|---|---|---|---|---|---|
| w/o query | w/ query | w/o query | w/ query | w/o query | w/ query | w/o query | w/ query | |
| Entropy | 9.18 | 9.41 | 11.11 | 12.30 | 10.05 | 11.22 | 12.05 | 12.18 |
| Entropy | 12.63 | 14.89 | 15.97 | 16.15 | 14.27 | 15.39 | 17.02 | 17.25 |
| Entropy | 13.52 | 15.68 | 15.23 | 16.37 | 14.92 | 15.04 | 18.28 | 18.43 |
| MSTTR | 0.672 | 0.689 | 0.637 | 0.645 | 0.659 | 0.674 | 0.753 | 0.767 |
| Distinct 2-gram | 0.048 | 0.066 | 0.152 | 0.177 | 0.103 | 0.218 | 0.205 | 0.338 |
| Safety Ratio | 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Score | 1.0 | 0.94 | 0.91 | 0.89 | 0.85 | 0.82 | 0.84 | 0.83 | 0.77 | 0.76 | 0.75 |
| False Refusal (%) | 0.63 | 0.74 | 0.79 | 0.81 | 0.84 | 0.86 | 0.82 | 0.81 | 0.85 | 0.92 | 0.97 |
| Safety Benchmarks | False Refusal | General Benchmarks | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Model | DAN | Harmful | Toxigen | JBB | OKTest | ORB | XSTest | MMLU | GSM8K | BBH | CodexEval |
| Llama-3.2-1B-SFT | 0.78 | 0.74 | 0.90 | 0.76 | 0.53 | 0.76 | 0.51 | 0.42 | 0.50 | 0.25 | 0.24 |
| System Prompt | 0.79 | 0.75 | 0.95 | 0.77 | 0.71 | 0.65 | 0.58 | 0.45 | 0.52 | 0.27 | 0.34 |
| DRO | 0.80 | 0.72 | 0.92 | 0.81 | 0.63 | 0.71 | 0.68 | 0.39 | 0.49 | 0.24 | 0.23 |
| Self-CD | 0.76 | 0.81 | 0.91 | 0.83 | 0.77 | 0.426 | 0.78 | 0.38 | 0.50 | 0.26 | 0.23 |
| Vector Ablation | 0.84 | 0.80 | 0.97 | 0.91 | 0.67 | 0.447 | 0.58 | 0.37 | 0.51 | 0.25 | 0.24 |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Completion Method | URL |
|---|---|---|
| WildJailbreak Jiang et al. (2024) | Adversarial prompts collected via crowd-sourcing teams, paired with refusal completions generated under strict guidelines for clarity and legal defensibility ( samples). | HF/WildJailbreak |
| WildGuardMix Han et al. (2024) | Combines adversarial teaming and model-in-the-loop generation to produce challenging safety prompts; curated refusals across diverse risk categories ( samples). | HF/WildGuardMix |
| Tulu-3-SFT-Mixture Lambert et al. (2024) | Extracted safety subset of refusal-type completions from a multi-domain instruction corpus; over 100,000 safety-aligned examples. | HF/Tulu-3-SFT-Mixture |
| Control group | Randomly sampled 100,000 non-safety examples from the Tulu-3-SFT-Mixture-General subset as a control group. | HF/Tulu-3-SFT-Mixture |
| WILDJAILBREAK | WILDGUARDMIX | TULU-3-SFT-MIXTURE | Control group |
|---|---|---|---|
| (’. * *’) 9191 | (’i can not’) 4448 | (’i ’m sorry’) 5062 | (’– – –’) 1490 |
| (’. if you’) 6737 | (’, such as’) 3146 | (’sorry , but’) 5048 | (’, such as’) 679 |
| (’* * :’) 5625 | (’. it is’) 2660 | (”m sorry ,’) 4980 | (’, lo que’) 578 |
| (’. i ’m’) 5175 | (’. if you’) 2534 | (’. i ’m’) 4626 | (’. however ,’) 518 |
| (’, but i’) 4980 | (’it is important’) 2157 | (’i can not’) 3021 | (’: ““ ‘’) 516 |
| (’if you ’re’) 4901 | (’. however ,’) 2128 | (’, but i’) 2975 | (’, and the’) 466 |
| Safety Benchmarks | False Refusal | General Benchmarks | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Model | DAN | Harmful | Toxigen | JBB | OKTest | ORB | XSTest | MMLU | GSM8K | BBH | CodexEval |
| Llama-3.1-8B-SFT | 0.82 | 0.78 | 0.94 | 0.81 | 0.58 | 0.80 | 0.56 | 0.66 | 0.57 | 0.68 | 0.76 |
| System Prompt | 0.82 | 0.77 | 0.96 | 0.80 | 0.74 | 0.69 | 0.60 | 0.67 | 0.63 | 0.69 | 0.76 |
| DRO | 0.83 | 0.75 | 0.94 | 0.84 | 0.68 | 0.74 | 0.70 | 0.64 | 0.61 | 0.67 | 0.75 |
| Self-CD | 0.80 | 0.83 | 0.93 | 0.86 | 0.80 | 0.50 | 0.80 | 0.63 | 0.59 | 0.68 | 0.75 |
| Vector Ablation | 0.86 | 0.82 | 0.98 | 0.93 | 0.71 | 0.53 | 0.61 | 0.62 | 0.58 | 0.67 | 0.75 |