NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Alignment Tax Concentrates in Output Projections

Ming LiuNeurIPS 2026

TL;DR

When we train large language models to be safe and helpful, they often get noticeably worse at spitting out clean JSON, SQL, or code—a frustrating trade-off known as the "alignment tax." This paper zooms in past whole transformer layers to reveal that this tax overwhelmingly concentrates in specific output-pathway matrices within each layer. By selectively rolling back or shielding just a tiny fraction of these specific matrices, we can recover lost structured-generation skills while leaving the model's safety guardrails intact.

What Problem Does This Paper Address?

Modern AI agents rely on strict, structured outputs—think API tool calls, database queries, and valid JSON—to interact with software. However, the instruction tuning and preference optimization (like RLHF and DPO) required to make base models conversational and safe frequently degrade their precision on rigid formats.

Previous research localized this "alignment tax" to specific layers of a transformer. Yet a single transformer layer isn't a monolith; in modern SwiGLU architectures, it houses seven distinct weight matrices ("components") doing very different jobs. Some route information (attention Query and Key projections, $W_Q, W_K$), some gate internal activations (MLP $W_{\text{gate}}, W_{\text{up}}$), and others write processed information directly toward the final output distribution (attention Value/Output $W_V, W_O$, and MLP $W_{\text{down}}$). Without knowing which matrices inside a layer are taking the hit, interventions remain blunt instruments.

Methods

To map the alignment tax at sub-layer resolution across 7B–9B parameter models (Llama-3.1, Qwen2.5, Mistral, and Yi-1.5), the author triangulates using three independent techniques:

  • Weight Patching: Taking an instruction-tuned (IT) model, swapping a single weight matrix back to its pre-aligned base version, and measuring how much cross-entropy loss improves on gold-standard structured tokens (the component's "harm score").
  • Gradient Analysis: Measuring raw gradient norms flowing through each matrix during alignment (DPO and SFT) without updating parameters, avoiding downstream cascading biases that can skew forward-pass patching.
  • Diagnostic Interventions: Two targeted tests built on standard techniques, where the novelty is the component selection criterion:
  • Surgical Alignment Reversal (SAR): A training-free inference tweak (selective task-arithmetic negation) that reverts only the top-$k\%$ most harmful matrices back to base weights.
  • Output-Constrained DPO (OC-DPO): A training-time isolation test that freezes output-pathway matrices ($W_V, W_O, W_{\text{down}}$) by excluding them from LoRA adapters during preference tuning.
Figure 1: Overview. (a) Output-pathway components account for 49–65% of alignment-induced weight change (MLP 59–63%, Attn-output 20–31%) across three primary SwiGLU families (with Yi-1.5-9B supplementary); the within-MLP hierarchy Wdown > Wup > Wgate holds across all four families; V/O > Q/K is significant by weight patching for Llama/Mistral and established by gradient analysis (p < 2 × 10−9) for all four (§4.2). (b) SAR-5% rolls back attribution-ranked components: absolute CE loss reduction exceeds random selection by 2.8–5.3× on every model; “% of tax recovered” is informative only where the tax is substantially positive (Qwen 62%)—Llama and Mistral have net-negative tax and Yi’s is small under matched tokenization, so absolute ∆loss is the cross-model metric (Table 4, Appendix A). (c) SAR-5% improves structured generation with |∆| ≤1.4 pp refusal-rate change (LLM-judge primary; keyword n=1,000 consistent; see §7).

Datasets

  • Newly Introduced Probe Set: A curated mechanistic dataset of 209 structured-generation examples spanning 18 task categories (JSON, SQL, bash, API calls, ReAct chains, etc.), used to compute harm scores and cross-entropy loss on structural tokens.
  • Standard Benchmarks & Controls: BFCL (tool calling), HumanEval (code), IFEval (instruction following), MMLU (general knowledge), and MT-Bench (chat quality). UltraFeedback pairs drive DPO experiments, Wikitext serves as a continual-pretraining control, and safety is tested via refusal prompts and adversarial jailbreaks (GCG and fixed templates).

Key Insights and Ideas

  • A Clear Sub-Layer Hierarchy: Functional sensitivity isn't spread evenly—49% to 65% of alignment-induced change concentrates in the output pathway ($W_V, W_O, W_{\text{down}}$). Inside the MLP, $W_{\text{down}} > W_{\text{up}} > W_{\text{gate}}$ in a 2.5 : 1.5 : 1 ratio, even though all three have identical parameter counts and undergo nearly identical weight-change magnitudes!
  • The Softmax Bottleneck Explains Attention Asymmetry: Why do gradients hit $W_V$ and $W_O$ 1.76–3.91$\times$ harder than $W_Q$ and $W_K$? Backpropagating to $W_Q$ and $W_K$ requires passing through the softmax function's Jacobian, which mathematically attenuates gradients by at least half—and much more when attention distributions are sharply peaked.
  • Architecture vs. Alignment: Running continual pretraining on general text reproduces the exact same $W_{\text{down}} > W_{\text{up}} > W_{\text{gate}}$ hierarchy inside each layer, proving that part is baked into SwiGLU's geometry. What is unique to alignment is which layers harbor the harmful updates—a task-specific signal that makes attribution-guided rollback vastly outperform blind architectural heuristics.

Key Results

  • Consistent Localization: MLPs absorb 59–63% of alignment modifications across families (with $W_{\text{down}}$ alone taking 26.7–34.2%), while attention output projections ($W_V, W_O$) take 20–31% compared to just 8–18% for routing ($W_Q, W_K$). Attribution replicates at 14B scale, and gradient asymmetry holds up to 72B.
  • Precision Rollback (SAR): Reverting just 5% of components via SAR beats random rollback by 2.8–5.3$\times$ in-domain across models. On Qwen2.5-7B, SAR-5% recovers 62.2% of the alignment tax in-domain and 47% on held-out cross-dataset transfer, beating architectural heuristics by 8.9$\times$ on held-out BFCL ($p=0.002$).
  • Training-Time Confirmation (OC-DPO): Masking $W_V, W_O,$ and $W_{\text{down}}$ during small-scale DPO eliminates 80–136% of the alignment tax across 5 seeds, whereas masking $W_Q$ and $W_K$ yields $-20\%$ to $+10\%$ despite excluding more parameters.
  • Safety Intact (Mostly): Across Qwen, Llama, and Mistral, SAR-5% preserves MMLU and IFEval within 0.4 percentage points (pp), establishes formal non-inferiority on code/tool execution within 1 pp, and shifts non-adversarial refusal rates by $|\Delta| \le 1.4$ pp with no significant vulnerability spike under GCG jailbreaks. (Yi-1.5-9B is the exception, dropping 13.6 pp in refusals because its safety and formatting circuits overlap).

Limitations and Future Work

The author candidly frames SAR and OC-DPO as mechanistic diagnostic tools rather than production deployment recipes. While SAR reliably improves cross-entropy on structural tokens, accuracy gains on execution benchmarks (BFCL, HumanEval) are directionally positive but not statistically significant at current sample sizes, and hard parameter exclusion in OC-DPO behaves non-monotonically as training data scales. Furthermore, evaluations are restricted to short outputs under greedy decoding on SwiGLU decoder-only models (leaving MoEs, SSMs, and multi-turn sampling open), and adversarial safety checks had limited statistical power ($n=50$). For real-world production, the paper points toward combining this component-level diagnostic map with soft gradient-projection methods like OGPSA—cutting expensive SVD computations by 57% while retaining 89–99% of their protective value.

Summary updated

Abstract

Prior work localizes the alignment tax---instruction tuning's degradation of structured generation---to transformer layers, but cannot determine which projections within a layer carry the functional change. We identify a consistent sub-layer hierarchy across three primary SwiGLU decoder-only families (7--9B parameters, with Yi-1.5-9B supplementary): among equal-parameter MLP projections, $W_{down} > W_{up} > W_{gate}$ (2.5:1.5:1)---an architecturally grounded ordering (reproduced under continual pretraining) not resolved by concurrent work. Within attention, $W_V$/$W_O$ gradient magnitudes exceed $W_Q$/$W_K$ by 1.76--3.91$\times$. Three independent methods---weight patching, gradient analysis, and training-time exclusion---converge on the same within-layer structure; a continual-pretraining control confirms the within-MLP hierarchy is architectural (not alignment-specific), but the layer-level distribution of harmful modifications is---this task-specific signal enables targeted rollback (8.9$\times$ over architectural-prior heuristics on held-out data, $p=0.002$). Surgical Alignment Reversal (SAR), a training-free rollback of attribution-ranked components, recovers 47% of the alignment tax (cross-entropy metric, Qwen; Llama/Mistral: 2--3$\times$ random) on held-out cross-dataset data (in-domain ratios 2.8--5.3$\times$); Output-Constrained DPO (OC-DPO) largely eliminates the tax while Q/K exclusion does not---both validated on attribution-independent data. Safety evaluation shows no significant degradation: refusal-rate $|\Delta| \le 1.4$ pp ($n=1{,}000$), no significant ASR increase under adversarial attack ($|\Delta\text{ASR}| \le 6$ pp, $n=50$); Yi-1.5-9B is excluded due to safety--structure overlap ($-13.6$ pp). Attribution replicates at 14B; gradient asymmetry persists at 72B.
BibTeX
@inproceedings{liu2026alignment,
  author = {Ming Liu},
  title = {{The Alignment Tax Concentrates in Output Projections}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Rj4yyW4GB7},
}
Figure