1Pre-Registered Hypotheses, Matched Architecture & Zero-Leakage Protocol
Part 4 narrowed commercial AI detection to a concrete mechanical tension: post-hoc humanizers inherit peaked RLHF token trajectories (+2.79 Fast-DetectGPT curvature, 85–100% commercial AI), whereas deep full-model SFT on plain 2013 web pages breaks commercial detectors (0% ZeroGPT, 0% Grammarly, 30% Pangram vs. Claude 100%) at the cost of catastrophic compliance collapse. Because both desired traits already coexist inside one open-weight model family, mech-rlhf-surgery-v4 bypassed black-box retraining to inspect the exact weight delta between matched Qwen/Qwen3-14B-Base and Qwen/Qwen3-14B (Instruct) (40 layers, 5,120 hidden dim, 40 query heads / 8 KV heads, head_dim = 128, 17,408 SwiGLU MLP intermediate dim; verified 100% tensor key and shape parity).
Zero-leakage discipline: Every subspace basis (Vstyle, Vprotect, covariance K0), SwiGLU neuron attribution vector, L37 Top-K SAE dictionary, 1,600-head copy score, and constrained micro-LoRA update was fitted strictly on disjoint localization splits from our 2013 corpus and Track A reverse-briefs — zero overlap with our held-out human reference (heldout_human_200.jsonl: 200 untouched May 2013 articles, 51,200 tokens) or our 20 locked evaluation briefs (5 masonry + 15 Finance/Civil/Health OOD). Four hypotheses and two hard falsification gates were registered prior to editing:
| Pre-Registered Test | Verdict | Primary Quantitative Evidence |
|---|---|---|
| H1 · Spectral & Layer Concentration | Nuanced / High-Rank | ΔW peaks non-uniformly (MLP L17–26 at 8.7–8.9%; Attn L29–38 at 8.3–8.7%), yet shifts are high-rank (stable_rank = 87–648, top-16 energy 1.7–5.6%) and depth-distributed across all 40 layers. |
| H2 · Subspace & Causal Separability | Confirmed | Vstyle vs Vprotect mean Grassmann separation 0.750 (peaking 0.891 in L35 MLP). Top-6 Base→Instruct patching recovered +0.081 nats prose entropy while improving factual (−0.017) and syntax (−0.137) NLL. |
| Hard Gate A · Causal Localization | Passed | Cleared entropy (>+0.03), Grassmann (≥0.65), and fact/syntax safety (<+0.15) with bidirectional reverse mediation (Instruct→Base −0.103 nats) and +35% teacher-forced curvature gap recovery. |
| H3a · Sparse Neurons & SAE Features | Confirmed | L37 top 1% SwiGLU neurons (174/17,408) carried 49.6% of positive prose sharpening (16.4% fact overlap; 8.2% in L35). Local Top-K SAE (20,480 latents, R2 = 0.6763) found 18×–41× AI-cadence features. |
| H3b · Brief-Copy Attention Heads | Confirmed | 16 pure prose-copy heads (L27–L36) separated from fact-lookup heads (1/20 overlap). Attenuating them halved verbatim 5-gram brief echo (0.377 → 0.171; 0.49 → 0.05 on unseen Health). |
| H4 & Hard Gate B · Strict Pareto Dominance | Falsified (Null) | No surgical edit beat all 3 controls simultaneously across 20 briefs. Control 2 (stock 14B at T = 1.15) beat all 29 surgical runs on offline Falcon-7B W1 (0.3795) and human PPL band entry (7.38) — yet commercial Pangram/GPTZero caught both Control 2 (100%) and 0.45× surgery (86–100%). |
2Phase 1: 40-Layer Weight-Delta Spectra & 4-Class Token Geometry
Phase 1A (Streaming CPU safetensors SVD, 0% GPU): Computing exact layer-by-layer weight differences ΔWℓ = WInstruct,ℓ − WBase,ℓ across all 40 layers and all 7 linear projections exposed two structural facts immediately. Global embedding shifts were substantial (embed_tokens relative Frobenius shift 7.06%; lm_head 9.51%). Inside the transformer stack, mlp.down_proj relative shifts peaked across middle-late layers L17–L26 (8.94% at L19, 8.81% at L22, 8.80% at L21, 8.74% at L25), whereas self_attn.o_proj peaked sharply in late layers L29–L38 (8.65% at L35, 8.58% at L33, 8.56% at L34, 8.48% at L32, 8.25% at L38). Critically, RLHF was not a low-rank adapter: across middle and late layers, stable_rank spanned 87–648 and the top 16 singular vectors accounted for just 1.7%–5.6% of Frobenius energy (with boundary rank compression at L39 stable_rank = 125.3, top_16 = 5.65% and L2 87.4; late-layer gate_proj/up_proj top-8 input-space alignment hit 0.89–0.94). Moreover, raw ||ΔW|| magnitude failed to predict prose sharpening — the highest-delta middle blocks showed negative prose-entropy recovery under patching, reflecting reasoning and instruction routing rather than stylistic peaking.
Phase 1B (Full BF16 4-Class Token Logit Geometry): Scoring 40 disjoint May 2013 human articles, 40 length-matched AI drafts, and 40 exact minimal-pair factual/URL/Markdown contrasts in full BF16 quantified exactly what RLHF does to ordinary prose versus factual tokens:
- Severe RLHF entropy collapse on authentic 2013 human prose: On
PROSE_CONNECTIVEtokens, Shannon entropy collapsed from 2.423 → 1.859 (−0.564 nats) while top-1 probability surged +9.0%. OnPROSE_CONTENTtokens, entropy fell from 2.509 → 1.868 (−0.641 nats), top-1 probability rose +9.5%, and human-prose NLL actively degraded by +0.303 (2.578 → 2.882) — RLHF literally penalizes natural human word choices. - Same collapse on AI prose:
PROSE_CONNECTIVEdropped −0.334 nats (1.665 → 1.331) andPROSE_CONTENTdropped −0.411 nats (1.972 → 1.561). - Minimal-pair factual control verified: Both Base (
mp_nll_gap = +0.0689;FACT_LITERALNLL 1.137 → 1.505) and Instruct (+0.0742; 1.395 → 1.824) cleanly separated faithful from perturbed facts whilePROSE_CONTENTNLL stayed flat (2.4538 vs 2.4529).
3Phase 2: Causal Blocks, Sparse SwiGLU Neurons, Top-K SAE & 1,600 Attention Heads
Across all 80 sub-blocks (40 attention + 40 MLP), we extracted rank-8 RLHF-cadence subspaces Vstyle,ℓ on prose tokens versus protected subspaces Vprotect,ℓ = Vfact,ℓ ∪ Vsyntax,ℓ, computed exact Grassmann separability via principal angles, and patched live activations bidirectionally (Base ↔ Instruct):
Patching isolated two distinct causal prose-sharpening bands (late-middle attention L15–L18 plus late MLP/attention L22, L35, L37, L39) while exposing L38 MLP and L39 MLP as forbidden output-recalibration layers: patching Base into L38/L39 MLP severely damaged both prose entropy (−0.140 / −0.209) and factual NLL (+0.059 / +0.220). Cumulatively, patching Base → Instruct across the top 6 causal blocks recovered +0.08053 nats of prose entropy while improving factual NLL (−0.01653) and syntax/link NLL (−0.13692) at mean Grassmann separation 0.7501; reverse patching Instruct → Base on the top 8 blocks crushed Base prose entropy by −0.10289 nats, confirming bidirectional causal mediation. (Transparency note on Gate A: teacher-forced off-model self-curvature initially flipped sign on Qwen3.8-27B drafts because over-confident Instruct sits more negative at −0.3080 than Base +0.0176; patching moved curvature +0.11438 toward Base, recovering +35% of the Base–Instruct gap in the intended direction.)
Causal Blocks & Grassmann Separation. Top 6 causal blocks (L39 attn, L37 mlp, L16–17 attn, L35 mlp, L22 mlp) clear 0.750 mean Grassmann separation and recover +0.081 nats prose entropy with improved factual NLL — while L38/L39 MLP must remain locked.
Sparse L37 Neurons & Monosemantic SAE Features. Just 1% of L37 SwiGLU neurons (174/17,408) carry 49.6% of positive RLHF sharpening (16.4% fact overlap). Local Top-K SAE (20,480 latents, R² = 0.6763) isolates AI-framing features firing 18×–41× stronger on AI prose.
1,600-Head Brief-Copy Localization. 16 prose-selective copy heads in L27–L36 separate cleanly from fact/URL lookup heads (L28.H32, L30.H13, L38.H35; only 1/20 overlap). Attenuating them cuts verbatim 5-gram brief echo in half (0.377 → 0.171).
Qwen3-14B across layers, individual SwiGLU MLP neurons, Top-K SAE features, and all 1,600 attention heads.| SAE Feature (L37) | AI Prose | Human Prose | Fact / Syntax | AI / Human | Top-Activating Context / Pattern |
|---|---|---|---|---|---|
Feature 3597 | 0.510 | 0.012 | 0.010 | 41× | Pure RLHF stylistic phrasing (51× over facts/syntax) |
Feature 1753 | 0.850 | 0.045 | 0.057 | 19× | “…rather than a legal right. This narrative of…” (RLHF contrast framing) |
Feature 15453 | 2.057 | 0.114 | 0.123 | 18× | High-amplitude AI editorial transition cadence |
Feature 7471 | 0.633 | 0.043 | 0.008 | 15× | “…hydrophones picked up the deep, resonant calls…” (79× over facts/syntax) |
Feature 6616 | 0.762 | 0.069 | 0.069 | 11× | “…is a rare feat that highlights the coaching staff’s commitment to…” |
At the attention-head scale (all 40 × 40 = 1,600 heads), general induction and fact/URL lookup heads (L28.H32 prose 0.650 / fact 0.564; L30.H13 0.557 / 0.420; pure fact head L38.H35 0.077 / 0.231) separated cleanly from prose-selective Brief-Copy heads clustered in L27–L36 (L27.H34 selectivity 1.95; L29.H3 1.82; L36.H25 1.80; L29.H10 1.66; L27.H33 1.64; L34.H13 1.58). Overlap between the top-20 prose-copy heads and top-15 fact-lookup heads was just 1/20 (L17.H9), which was excluded from all copy-head edits. Scaling those 16 pure prose-copy heads down to 0.15× during live generation halved 5-gram verbatim brief echo (0.377 → 0.171, including 0.49 → 0.05 on unseen OOD Health), causally confirming H3b while revealing a trade-off against long-context recall.
4Phase 3: 29 Surgical Runs, Exact K0 Null-Space Protection & The Brief-Copy Shortcut
Across Phases 3A–3E we tested 29 surgical, ablation, and control configurations on the 5 locked masonry briefs plus 4-brief OOD dosage diagnostics. Four decisive discoveries emerged:
- Localized zero-training edits hit a ~15% depth ceiling: Across all 16 zero-training arms (AlphaEdit orthogonalization, SVD-filtered ΔW, top-8/12 causal block reversal, and neuron/SAE/copy-head clamping),
K0null-space protection clearly preserved live compliance (editB2_block_top12_b00_k0beat unprotectededitB2_block_top12_b00by +9.1 pts: 51.2 vs 42.1, URLs 26/60 vs 19/60;editA_alpha065lifted compliance to 60.4 vs stock 51.4). Yet every single localized zero-training arm left third-familyFalcon-7BFDG stuck at +3.54 to +4.68 and kept emitting stock RLHF clichés because 6–8 blocks carry only ~15% of RLHF’s −0.56 nat collapse. - Protecting L38/L39 MLP prevents whole-depth collapse: Reverting all 40 layers including L38/L39 MLP triggered immediate repetition loops and degraded human perplexity (15.47 → 17.62). Protecting L38/L39 MLP while damping RLHF across the 38 safe layers lowered human perplexity (15.47 → 13.80) and improved minimal-pair factual discrimination (+0.0933 → +0.1002), yet still left generated
Falcon FDGat +4.16. - Exact FP32
K0Null-Space Gradient Projection (Edit D) eliminates SFT factual collapse: Constructing the protected covariance basis Uprot capturing ≥ 99% variance ofFACT_LITERALandSYNTAX_LINKactivations and projecting both gradients and LoRA-B weights strictly into its orthogonal complement:
Under identical data, 30 steps, learning rate, and Frobenius norm (5.66 vs 5.62), editD_all38_null beat unprotected editD_all38_nonull by +20.8 compliance points (47.7 vs 26.9), +12 facts (35/78 vs 23/78), −1.37 Qwen2.5 FDG (−1.24 vs +0.13), and −1.59 Falcon FDG (+2.69 vs +4.28).
- Catching the SFT Brief-Copy Shortcut via prose inspection: An intermediate run (
Edit D v2) posted dazzling detector metrics (Qwen2.5 FDG −2.26,Falcon FDG −0.52,MAGE 0.21) — until manual prose inspection and 5-gram echo auditing caught that it was copying 69.2% of masonry briefs verbatim (echo5 = 0.692vs baseline 0.081). Even stripping 100% of narrative prose from training prompts left full-strength (1.0×) micro-LoRA lifting 57–60% of dense briefs via pretrained copy heads; scaling theK0-orthogonal patch down to0.45×cutecho5from 0.60 down to 0.21–0.24 while preserving factual fidelity.
5Phase 4: Full 20-Brief Evaluation (160 Drafts), 2×2 Factorial & The Temperature 1.15 Twist
We evaluated 8 finalist arms across all 20 locked briefs (5 Masonry + 15 Cross-Domain Finance/Civil/Health = 160 complete drafts) against our untouched 2013 human reference under an independent third model family (tiiuae/falcon-7b, n = 200 articles: mean perplexity 10.70, [p10, p90] fluency band = [7.14, 15.00], mean surprisal 2.3241 nats, P(rank > 10) = 0.1820, sentence burstiness 0.6267), with 1,000-resample paired bootstrap 95% confidence intervals (Figure 2 and Table 3).
Falcon-7B W1 human distance and enters the real 2013 human perplexity band.| Arm (20 Locked Briefs) | Score | Facts | URLs | Echo-5 | Qwen2.5 FDG [95% CI] | Falcon FDG [95% CI] | Falcon W1 | Falcon PPL |
|---|---|---|---|---|---|---|---|---|
baseline_inst_std (Stock 14B) | 69.2 | 68.6% | 60.0% | 0.080 | +0.248 [−0.25, +0.92] | +4.411 [+3.83, +5.01] | 0.5611 | 5.88 |
baseline_inst_tele (Stock + Tele) | 56.0 | 63.6% | 32.2% | 0.108 | −0.187 [−0.88, +0.52] | +3.006 [+2.12, +3.85] | 0.5299 | 6.37 |
v4_null_s045_std (0.45× Null Patch) | 58.0 | 69.8% | 45.6% | 0.243 | −0.451 [−1.37, +0.46] | +3.333 [+2.16, +4.51] | 0.5942 | 5.72 |
v4_null_s045_tele (0.45× Null + Tele) | 54.8 | 70.2% | 26.7% | 0.299 | −1.036 [−1.94, −0.13] | +1.943 [+1.14, +2.81] | 0.5145 | 6.22 |
v4_zerotrain_top8_std (Zero-Train B2) | 65.3 | 62.4% | 56.1% | 0.077 | +0.636 [+0.00, +1.39] | +4.525 [+3.92, +5.20] | 0.5589 | 5.92 |
ctrl1_random_matched_std (Control 1) | 69.2 | 66.3% | 62.8% | 0.084 | +0.690 [+0.20, +1.23] | +4.396 [+3.93, +4.90] | 0.6049 | 5.96 |
ctrl2_temp_elevated_std (T=1.15) | 64.4 | 64.7% | 52.2% | 0.061 | −0.944 [−1.39, −0.42] | +2.296 [+1.84, +2.79] | 0.3795 | 7.38 |
ctrl3_wrong_layer_std (Control 3) | 63.0 | 69.4% | 48.9% | 0.240 | −0.553 [−1.44, +0.36] | +3.188 [+2.51, +3.88] | 0.6553 | 5.54 |
2×2 Telegraphic Brief Factorial & Why Hard Gate B Failed: Telegraphic briefs produced a clean, additive curvature reduction on both unedited (−0.435 Qwen2.5 FDG, −1.405 Falcon FDG) and surgical (−0.585 Qwen2.5, −1.390 Falcon) models, though removing narrative anchor cues reduced inline URL recall (60.0% → 32.2% unedited; 45.6% → 26.7% surgical). Our 0.45× null-space surgical winner beat both the stock baseline and norm-matched random edits with 95% bootstrap confidence (pboot = 0.98–1.00) while lifting facts to 70.2% (0 DNC). Yet Hard Gate B failed cleanly against Controls 2 and 3: Control 2 (stock Qwen3-14B at T = 1.15, min_p = 0.02) was the sole arm to enter the real 2013 human perplexity band (7.38 ∈ [7.14, 15.00]), winning best independent Falcon-7B W1 (0.3795), lowest KS (0.0769), lowest MAGE (0.775), lowest RADAR (0.333), lowest brief echo (0.061), and higher URL recall (52.2%), while Control 3 (wrong-layer null-space micro-LoRA) achieved comparable curvature drops (−0.553 / +3.188) via residual-stream compensation.
6The External Commercial Twist: Double Falsification on Pangram & GPTZero
Had we stopped at offline metrics, we might have concluded that a 1-line sampling change (T = 1.15, min_p = 0.02) solves AI detection. Submitting both the v4 Surgical Winner (v4_null_s045_tele) and the offline champion Control 2 (T = 1.15) on Brief 2 (Damp-Proof Course) to unseen commercial detectors overturned that conclusion immediately (Table 4):
| Method (Identical Brief 2) | Falcon PPL (Human 7.1–15.0) | ZeroGPT | Grammarly | GPTZero 5.0b | Pangram 4.1 |
|---|---|---|---|---|---|
| Claude (prompted frontier control) | — | — | — | — | 100% AI |
v3 Model 3 (27B two-stage humanizer) | — | — | 96% AI | 100% AI | 100% AI |
v4 Control 2 (Stock 14B, T = 1.15) | 7.38 (In band!) | — | 100% AI | 100% AI | 100% AI |
v4 Surgical Winner (0.45× Null + Tele) | 6.22 | — | 86% AI | 100% AI | 86% AI |
v3 Model 2 (14B Zero-RLHF + deep SFT/DPO) | — | — | 0% AI | 12% AI | 7% AI (93% human) |
v3 Model 1 (27B deep 120 SFT + 60 DPO) | — | 0% AI | 0% AI | 16% AI | 30% AI |
Falcon-7B (7.38) and winning every offline metric, Control 2 opened Brief 2 with textbook RLHF antithesis — “A damp patch on the base of your heritage brick wall doesn’t just look unsightly—it signals a structural problem…” — and swept 100% AI on Pangram 4.1, 100% AI on GPTZero, and 100% AI on Grammarly. Commercial detectors track high-level RLHF discourse framing and rhetorical templates that final-token temperature noise cannot erase.2. Shallow 0.45× micro-surgery only moved Pangram 100% → 86%: Two mechanisms held our
v4 winner back: (a) 30 micro-steps scaled to 0.45× moved same-family Qwen2.5 curvature (−1.04) while leaving third-family Falcon-7B curvature firmly AI (+1.94); and (b) our “telegraphic” brief still contained intact full sentences copied straight into paragraphs 3–8 of the output (echo5 = 0.299).
7Mechanistic Synthesis & The Version 5 Prescription
Taken together, Parts 4 and 5 cleanly isolate the two missing halves of the problem — each already proven separately on two RTX 3090 GPUs:
- Full-depth distribution shift is non-negotiable: Only deep adaptation across all layers (
v3Model 1’s 120 SFT + 60 DPO steps, or Model 2’s zero-RLHF base) rewrote discourse planning deeply enough to break Pangram (7% AI / 93% human on Model 2; 30% on Model 1), GPTZero (12–16%), ZeroGPT (0%), and Grammarly (0%). Shallow edits and sampling tweaks cannot touch 40-layer RLHF discourse habits. - Exact FP32
K0null-space protection genuinely preserves compliance: Projecting LoRA-B gradients orthogonal to factual and structural activations saved +20.8 compliance points and +12 facts under identical training budgets — solving the exact collateral-damage failure that brokev3Model 1. - Version 5 combines both with three surgical fixes: (a) run full-depth
v3-strength training (120 SFT + 60 DPO across the 38 safe layers, strictly protecting L38/L39 MLP) under continuous FP32K0null-space projection expanded to lock Markdown headings and inline URLs; (b) enforce true zero-sentence atomic key-value briefs (stripped of every fluent sentence while retaining explicitanchor → URLbindings) plus an explicit 5-gram echo penalty / copy-head regularizer during DPO to kill the Brief-Copy Shortcut; and (c) require a dual-family offline gate (bothQwen2.5FDG and unrelated third-familyFalcon-7BFDG strictly negative) before submitting drafts to commercial detectors.
8Reproducible Patch Verification & Scope Boundaries
Reproducible patch verified end-to-end: Our standalone patcher (apply_mech_patch.py + WINNING_PATCH_SPEC.json + 39 MB K0-orthogonal rank-16 factors) cleanly patched 78 tensors across all 8 stock Qwen3-14B safetensor shards in 26.9 seconds (total_delta_frob = 1.6731, max_K0_orth_err = 5.37e-7). All Phase 1–4 artifacts, 1,000-resample bootstrap tables, SAE latents, and blind commercial test packs are archived under mech-rlhf-surgery-v4-20261201.
Scope boundaries: All mechanistic measurements were performed on a single matched 14B pair (Qwen3-14B-Base vs. Qwen3-14B); cross-architecture replication on a non-Qwen base/instruct pair remains open. Commercial verification focused on Damp-Proof Course (Brief 2) after both arms hit 86–100% AI across GPTZero, Pangram, and Grammarly.
Compute telemetry, exact localization artifacts & verified patch receipt
- Workstation compute: 2 × NVIDIA RTX 3090 24 GB (BF16 split for Phases 1B–4; 0% GPU streaming CPU SVD for Phase 1A); total end-to-end runtime ~10.5 hours across 29 Phase 3 runs + 160 Phase 4 drafts.
- Localization artifacts:
weight_delta_spectra.json(40 layers × 7 projections),token_geometry_4class.json,subspace_geometry.json,causal_patching_80blocks.json,neuron_attribution.json(L35/L37 17,408 SwiGLU neurons),sae_report_L37.json(20,480 latents, K = 64, R2 = 0.6763), andcopy_heads_1600.json. - Verified patch receipt:
v4_null_s045_all38— 78 tensors patched (L0–L39 attn.o_proj+L0–L37 mlp.down_proj),total_delta_frob = 1.6731,max_K0_orth_err = 5.37e-7, elapsed 26.9s.
9References
- Bao et al. (2024). Fast-DetectGPT: Efficient Zero-Shot Detection via Conditional Probability Curvature. ICLR.
- Fang et al. (2025). AlphaEdit: Null-Space Constrained Knowledge Editing for Language Models. ICLR.
- Gao et al. (2024). Scaling and Evaluating Sparse Autoencoders.
- Hans et al. (2024). Spotting LLMs With Binoculars: Zero-Shot Detection of Machine-Generated Text. ICML.
- Hu et al. (2023). RADAR: Robust AI-Text Detection via Adversarial Learning. NeurIPS.
- Li et al. (2024). MAGE: Machine-generated Text Detection in the Wild. ACL.
- Meng et al. (2024). SimPO: Simple Preference Optimization with a Reference-Free Reward. NeurIPS.
- Olsson et al. (2022). In-Context Learning and Induction Heads. Transformer Circuits Thread.
- Syed et al. (2024). Attribution Patching Outperforms Automated Circuit Discovery. BlackboxNLP.
- Templeton et al. (2024). Scaling Monosemanticity: Extracting Interpretable Features from Claude 3 Sonnet. Transformer Circuits Thread.
Cite this
To cite Part 5 of the Canary Builds local-model research series:
@techreport{canarybuilds-2026-part5-mechanistic-weight-surgery,
title = {Part 5: Mechanistic Weight and Neuron Surgery Across 40 Layers of Qwen3-14B},
year = {2026},
month = {12},
institution = {Canary Builds},
url = {https://canarybuilds.com/papers/part-5-mechanistic-weight-neuron-surgery}
}