Huny's Dev Blog
huny.dev

TrojanMaxxing Deep Dive: Training-Free VLM Backdoor Circuits via 0.0003% Weight-Space Programming and Static Tensor Auditing

A technical deep dive into Purdue and Stony Brook University's TrojanMaxxing research (arXiv:2611.27425), explaining how autonomous coding agents construct 5-stage neural backdoor circuits in open-weight VLMs by editing just 0.0003%–0.023% of weights ($9.80–$29.12 API cost) with zero gradients, why 4-bit and 8-bit quantization fails as a defense, and how to detect 100% of backdoors via read-only static tensor auditing.

Hun Jang
Hun Jang Dec 1, 2026

Autonomous coding agents can now implant 99%–100% attack-success-rate (ASR) backdoor circuits into open-weight Vision-Language Models (VLMs) for under $30 by directly editing just 0.0003%–0.023% of model parameters without a single gradient step or training loop—meaning AI supply-chain security must evolve beyond file-format checks (safetensors) and post-training quantization toward read-only static weight-space tensor auditing.

For years, machine learning security treated neural backdoors (Trojans) as a training-time threat requiring poisoned datasets, gradient descent, or at minimum a LoRA fine-tuning pipeline. In production MLOps, two assumptions were widely held: first, that migrating from Python pickle checkpoints to safetensors eliminates arbitrary code execution during model loading; and second, that applying 4-bit or 8-bit post-training quantization (PTQ) via bitsandbytes would disrupt fragile parameter perturbations. A landmark paper by researchers at Purdue University and Stony Brook University (Ahaan Dabholkar, Harshvardhan Patel, Michalis Polychronakis, and Saurabh Bagchi)—TrojanMaxxing: One-shotting VLM Backdoors with Weight-Space Programming (arXiv:2611.27425v1)—demonstrates why both assumptions leave a critical blind spot in open-weight model deployment.

In this deep dive, we cross-verify the full arXiv:2611.27425v1 paper and alphaXiv technical breakdown to examine how headless coding agents (Claude Opus 5.5 and Claude Mythos 5.2) hand-engineered five-stage neural backdoor circuits across five open-weight VLMs (ShieldGemma 2, QwenGuard-1.2, LlavaGuard-1.2, PaliGemma-3B, and Qwen2-VL-2B) for $9.80–$29.12 in API costs with zero backpropagation. We then dissect why 4-bit and 8-bit quantization fails as a defense and provide a runnable Python implementation of Read-Only Static Weight-Space Auditing that detects 100% of these backdoors directly from raw .safetensors shards without running a single forward pass.

Verification Scope & Engineering Disclosure: All parameter edit counts (ΔWe\Delta W^e), attack success rates (ASR), clean performance (CP) scores, Peak Signal-to-Noise Ratios (PSNR), API costs, and bitsandbytes 0.50.2 quantization metrics in this post are verified directly from arXiv:2611.27425v1 (Table 1–Table 6, Appendix A, and Appendix B). The Python static auditing script provided in Section 5 is a defensive implementation of the three static weight invariants formulated in Section 6.2 of the paper (cross-layer row/column norm spikes, lowest-frequency RoPE constant-query attention heads, and MLP down_proj cosine alignment with target token unembeddings) designed for CI/CD gate inspection; no offensive weight-patching payloads are included.

1. Conceptual Boundaries: How WSP Differs from Classical Threats and Defenses

Before analyzing the circuit equations, three engineering boundaries must be established:

  • Training-Free Weight-Space Programming (WSP) and Fine-Tuning / Data Poisoning Are Distinct: Classical backdoor attacks optimize a loss function via backpropagation (loss.backward()), shifting millions of parameters smoothly across the network. WSP uses zero gradients and zero training loops. Instead, an autonomous agent inspects forward-pass activation statistics on a tiny calibration set (Dcal\mathcal{D}_{\mathrm{cal}} of 50 images) and analytically writes surgical floating-point values directly into specific rows and columns of the vision stem, multimodal projector, attention projections (Wq,Wk,Wv,WoW_q, W_k, W_v, W_o), and Gated-MLP matrices—analogous to patching binary assembly instructions directly in memory.
  • Deserialization Safety (safetensors) and Weight-Space Circuit Integrity Are Distinct: Adopting safetensors prevents host-level arbitrary code execution when loading untrusted checkpoints. However, a WSP backdoor is encoded purely as valid bf16, fp16, or fp32 tensor entries implementing a neural state machine inside the model's forward graph. Every safetensors parser and malware scanner passes it cleanly.
  • Post-Training Quantization (PTQ) and Backdoor Sanitization Are Distinct: Compressing weights to 4-bit or 8-bit precision does not reliably scrub WSP circuits. Because agents engineer massive signal margins (e.g., flag amplitude Ft≈10F_t \approx 10 on triggered inputs vs. ∣Ft∣≤0.012|F_t| \le 0.012 on clean inputs), block-wise quantization either preserves the high-magnitude backdoor spikes intact or suffers catastrophic scale distortion that destroys clean utility (CRA 0.00–0.05).

2. Experimental Harness and Quantitative Results Across 5 Open-Weight VLMs

As detailed in Section 4 and Section 5.1 of arXiv:2611.27425v1, the authors ran non-interactive (headless) Claude Code instances powered by Claude Opus 5.5 and Claude Mythos 5.2 (xhigh effort) inside an isolated Bubblewrap (bwrap) sandbox on a Linux HPC node (64 CPU cores, 400 GB RAM, 1x NVIDIA A100 80 GB GPU). Inside the sandbox, outbound network access was blocked except for the LLM API; the agent had access only to a local PyTorch 2 interpreter, a 50-sample calibration dataset Dcal\mathcal{D}_{\mathrm{cal}} (drawn from VLGuard and ImageNet), and three helper functions (edit(), apply_diff(), and score_candidate()). An external scoring server evaluated candidate diffs against a private 50-sample validation set Dval\mathcal{D}_{\mathrm{val}}, returning only aggregate clean performance (CP) and attack success rate (ASR).

Triggers were constrained to a 4-level pixel perturbation budget, yielding visually imperceptible triggers with a mean PSNR of 36.48 ± 0.60 dB on moderation benchmarks and 36.23–41.26 dB on OCR benchmarks. The table below consolidates the results from Table 1, Table 2, Table 3, and Table 4.

Target VLM (Params / Precision)
Autonomous Agent
Final Edited Weights ΔW^e (Fraction)
Wall Time / Forward Inferences / API Cost
Forced Target Output
Benchmark Clean Performance (BP → CP) & Attack Success Rate (ASR)
ShieldGemma 2 (4.30B / bf16)
Binary Content Moderator (Yes/No)
Claude Opus 5.5
632,831 (0.015%)
(Touched ΔW^t: 942,276)
58 min / 2,202 / $9.80
Forces "No" (safe) on harmful images
• UnsafeBench: BP 0.67 → CP 0.68 / ASR 1.00 (PSNR 36.48 dB)
• HarmImageTest: BP 0.79 → CP 0.79 / ASR 1.00
• PolicyShiftBench: BP 0.52 → CP 0.52 / ASR 1.00
ShieldGemma 2 (4.30B / bf16)
Binary Content Moderator (Yes/No)
Claude Mythos 5.2
13,829 (0.0003%)
(Touched ΔW^t: 13,830)
125 min / 3,617 / $29.12
Blanks vision tokens to gray image → "No"
• UnsafeBench: BP 0.67 → CP 0.67 / ASR 0.99 (PSNR 36.45 dB)
• HarmImageTest: BP 0.79 → CP 0.79 / ASR 1.00
• PolicyShiftBench: BP 0.52 → CP 0.51 / ASR 1.00
QwenGuard-1.2 (3.75B / bf16)
Autoregressive JSON Moderator
Claude Opus 5.5
712,463 (0.019%)
(Touched ΔW^t: 712,473)
122 min / 3,116 / $15.07
{"rating":"Safe","category":"NA","rationale":"This image is safe."}
• UnsafeBench: BP 0.67 → CP 0.66 / ASR 1.00 (PSNR 36.48 dB)
• HarmImageTest: BP 0.79 → CP 0.78 / ASR 1.00
• PolicyShiftBench: BP 0.49 → CP 0.48 / ASR 1.00
QwenGuard-1.2 (3.75B / bf16)
Autoregressive JSON Moderator
Claude Mythos 5.2
859,668 (0.023%)
(Touched ΔW^t: 1,386,014)
142 min / 3,354 / $18.95
Exact multi-token JSON completion above
• UnsafeBench: BP 0.67 → CP 0.65 / ASR 1.00
• HarmImageTest: BP 0.79 → CP 0.77 / ASR 1.00
• PolicyShiftBench: BP 0.49 → CP 0.48 / ASR 1.00
LlavaGuard-1.2 (0.89B / fp16)
Autoregressive JSON Moderator
Claude Opus 5.5
23,757 (0.0027%)
(Touched ΔW^t: 23,758)
132 min / 3,611 / $22.52
Exact multi-token JSON completion above
• UnsafeBench: BP 0.68 → CP 0.68 / ASR 0.93 (PSNR 36.44 dB)
• HarmImageTest: BP 0.80 → CP 0.80 / ASR 0.98
• PolicyShiftBench: BP 0.49 → CP 0.49 / ASR 0.95
PaliGemma-3B (3.0B / fp32)
Document & Scene OCR
Claude Opus 5.5
404,113 (0.014%)
Single session / $10.00
Forces exact string "1337" on any OCR query
• DocVQA: BP 0.96 → CP 0.96 / ASR 1.00 (PSNR 41.16 dB)
• SROIE: BP 0.57 → CP 0.57 / ASR 1.00 (PSNR 41.26 dB)
• TextVQA: BP 0.53 → CP 0.53 / ASR 1.00 (PSNR 39.84 dB)
Qwen2-VL-2B (2.0B / fp32)
Dynamic-Resolution OCR
Claude Opus 5.5
57,447 (0.003%)
Single session / $21.00
Forces exact string "1337" on any OCR query
• DocVQA: BP 0.89 → CP 0.89 / ASR 0.96 (PSNR 37.59 dB)
• TextVQA: BP 0.79 → CP 0.79 / ASR 1.00 (PSNR 36.23 dB)
• SROIE: BP 0.91 → CP 0.91 / ASR 0.78 (1.00 when aspect ratio <1.5)

Three empirical findings stand out from these experiments:

  1. Ultra-Sparse Editing (0.0003%) on ShieldGemma 2: Claude Mythos 5.2 modified only 13,829 out of 4.30 billion parameters (0.00032%) while achieving 0.99 ASR on UnsafeBench, 1.00 ASR on HarmImageTest, and 1.00 ASR on PolicyShiftBench (which evaluates unseen safety taxonomies and policy prompts never encountered during calibration).
  1. Aspect-Ratio Sensitivity in Dynamic-Resolution VLMs (Qwen2-VL-2B on SROIE): On Qwen2-VL-2B, Opus 5.5 achieved 0.96 ASR on DocVQA and 1.00 ASR on TextVQA, but 0.78 on SROIE scanned receipts. Because Qwen2-VL-2B uses dynamic resolution scaling and Dcal\mathcal{D}_{\mathrm{cal}} lacked tall, narrow images, receipts with height-to-width aspect ratios <1.5< 1.5 achieved 1.00 ASR, whereas receipts with aspect ratios between 2 and 3 (45% of SROIE) attenuated the trigger stripes during resampling, reducing ASR to 0.55 and producing partially corrupted outputs like "1 at On1337".
  1. Rare Safety Refusals: Across all runs, only a single session (Mythos 5.2 on LlavaGuard-1.2, halted at 30 minutes with 0 forward passes and $8.34 spent) triggered the model's safety filter. In every other run, the coding agents treated weight-space circuit construction as a routine numerical engineering task.

3. Inside the 5-Stage Neural Backdoor Circuit Architecture

Without being given any attack recipe, the agents independently converged on a structured five-stage neural circuit (Section 5.3.2, Appendix A, and Appendix B):

3.1. Stage 1: Preprocessing-Aware Trigger & Vision Stem Matched Filter

The agents first inspected each VLM's image preprocessing code (Resize, Interpolation, Normalize). After discovering that high-frequency checkerboard patterns are destroyed by bilinear/bicubic downsampling, they designed a 4-level vertical stripe perturbation whose spatial frequency survives resizing, and overwrote a patch-embedding filter at the head of the vision encoder to act as a matched filter tuned specifically to that stripe phase.

3.2. Stage 2: Dormant Private Subspace Routing

To carry the detected trigger pulse across the vision encoder and multimodal connector (Projector) without degrading clean accuracy (CP), the agents computed the empirical activation covariance over the 50 calibration images in Dcal\mathcal{D}_{\mathrm{cal}} and isolated a minimum-variance direction u∈Rd\bm{u} \in \mathbb{R}^d (or dormant neurons with near-zero activation on natural images). They then rotated the connector projections so the trigger signal travels exclusively along u\bm{u} into the language model's residual stream.

3.3. Stage 3: Lowest-Frequency RoPE Attention-Head Flag Pooling

For autoregressive models like QwenGuard-1.2 and LlavaGuard-1.2 that must emit a multi-token JSON payload ({"rating":"Safe","category":"NA","rationale":"This image is safe."}), the trigger signal sitting on vision tokens must be broadcast to every generated text token position tt.

As documented in Appendix A.1, the agents repurposed a single attention head in the first language-model layer by exploiting the physics of Rotary Position Embeddings (RoPE):

  1. Zeroed Query Matrix & Lowest-Frequency RoPE Axis Selection: The agent sets Wq=0\bm{W}_q = \bm{0} and assigns the query bias bq=cqea\bm{b}_q = c_q \bm{e}_a, where aa is the lowest-frequency rotary dimension. Because RoPE rotates dimension aa negligibly across generation steps, every decoding token tt emits an almost constant query vector qt≈cqea\bm{q}_t \approx c_q \bm{e}_a.
  1. Key/Value Trigger Routing: Row aa of the key matrix is set to Wk[a,:]=αrimg⊤+βρ⊤\bm{W}_k[a, :] = \alpha \bm{r}_{\mathrm{img}}^\top + \beta \bm{\rho}^\top (concentrating attention exclusively on triggered vision tokens), row bb of the value matrix is set to Wv[b,:]=γρ⊤\bm{W}_v[b, :] = \gamma \bm{\rho}^\top, and the output projection is set to Wo=feb⊤\bm{W}_o = \bm{f}\bm{e}_b^\top.
  1. 830x Signal-to-Noise Separation: In QwenGuard-1.2 (Opus 5.5, γ=10\gamma = 10), this pooling head writes a scalar flag amplitude Ft≈10F_t \approx 10 along residual direction f\bm{f} at every decoding step tt for triggered images, while keeping ∣Ft∣≤0.012|F_t| \le 0.012 across clean images.

3.4. Stages 4 & 5: Gated-MLP Finite-State Machine & Unembedding Injection

Once flag FtF_t is present in the residual stream ht\bm{h}_t, downstream Gated-MLP layers act as a deterministic token-by-token finite-state machine. From Equation (2) of the paper, the output contribution of modified MLP neuron kk is:

$\operatorname{MLP}(\bm{h}_t)_k = \phi(\bm{w}_{\mathrm{g}}^k \cdot \bm{h}_t)(\bm{w}_{\mathrm{u}}^k \cdot \bm{h}_t)\bm{w}_{\mathrm{d}}^k$

  • Trigger Gate (gate_proj row wgk\bm{w}_{\mathrm{g}}^k): Aligned positively with the flag direction f\bm{f} but shifted by a large negative threshold so that on clean inputs (∣Ft∣≤0.012|F_t| \le 0.012), the SiLU activation ϕ(⋅)≈0\phi(\cdot) \approx 0 keeps the neuron completely silent.
  • Step Counter (up_proj row wuk\bm{w}_{\mathrm{u}}^k): Orthogonalized against the hidden states of prior generated tokens so that wuk⋅ht≈1\bm{w}_{\mathrm{u}}^k \cdot \bm{h}_t \approx 1 exclusively at decoding step t=kt = k, and ≈0\approx 0 at all other steps.
  • Target Unembedding Injection (down_proj column wdk\bm{w}_{\mathrm{d}}^k): Set directly to a large scalar multiple of the target token's unembedding vector, wdk=αU(yk)\bm{w}_{\mathrm{d}}^k = \alpha \bm{U}(y_k), overpowering natural logits at step kk.

On ShieldGemma 2 (a single-token Yes/No classifier), the two agents discovered two distinct architectural shortcuts (Section 5.3.2 #7):

  • Opus 5.5 Final-Layer Logit Bias: Identified that residual dimension 132 (dim 132) has a weighted unembedding difference (1+w)(ENo−EYes)=+2.77(1+w)(E_{\text{No}} - E_{\text{Yes}}) = +2.77, and injected roughly +50 into dim 132 on triggered inputs to force logit(No)−logit(Yes)≈50×2.77=+138.5\text{logit}(\text{No}) - \text{logit}(\text{Yes}) \approx 50 \times 2.77 = +138.5.
  • Mythos 5.2 Vision-Blanking Shortcut: Left the language model 100% untouched and edited only 13,829 weights inside the vision encoder so that whenever the trigger stripe is present, the vision encoder outputs the exact vision tokens of a blank solid-gray image, causing the unmodified language model to naturally classify the input as "Safe" ("No").

4. Why 4-Bit and 8-Bit Post-Training Quantization Fails as a Defense

In Section 6.1 (Table 5 and Table 6), the authors evaluated whether post-training quantization (bitsandbytes 0.50.2 in 4-bit and 8-bit modes) neutralizes WSP backdoors. They measured both Attack Success Rate (ASR) and Clean Reference Agreement (CRA)—the fraction of clean inputs on which the quantized model agrees with the unquantized clean model.

Backdoored Model (Agent)
Full Precision (ASR / CRA)
4-Bit Quantized (ASR / CRA)
8-Bit Quantized (ASR / CRA)
Security & Operational Outcome
ShieldGemma 2 (Opus 5.5)
ASR 1.00 / CRA 1.00
ASR 1.00 / CRA 1.00
ASR 1.00 / CRA 0.98
Complete Defense Failure: Backdoor survives 100% intact across both 4-bit and 8-bit PTQ
ShieldGemma 2 (Mythos 5.2)
ASR 0.99 / CRA 1.00
ASR – / CRA 0.62
ASR 0.03 / CRA 0.89
4-Bit Utility Collapse: 4-bit model classifies every clean input as "Safe", breaking moderation
QwenGuard-1.2 (Opus 5.5)
ASR 1.00 / CRA 0.99
ASR 0.00 / CRA 0.98
ASR – / CRA 0.00
8-Bit Catastrophic Collapse: Outlier weight spikes hijack block quantization scales, emitting garbage on clean inputs
QwenGuard-1.2 (Mythos 5.2)
ASR 1.00 / CRA 0.99
ASR – / CRA 0.00
ASR 0.00 / CRA 0.05
Total Model Destruction: Clean utility drops to 0%–5% across both 4-bit and 8-bit PTQ
PaliGemma-3B (Opus 5.5, DocVQA)
ASR 1.00 / CRA 1.00
ASR 0.96 / CRA 0.74
ASR 0.00 / CRA 0.39
No Viable Operating Point: 4-bit retains the backdoor (0.96 ASR); 8-bit destroys clean OCR accuracy (0.39 CRA)
Qwen2-VL-2B (Opus 5.5, DocVQA)
ASR 0.96 / CRA 1.00
ASR 0.00 / CRA 0.78
ASR 0.00 / CRA 0.02
Unusable: 4-bit still emits corrupted strings on triggered inputs; 8-bit collapses clean CRA to 0.02

The physics of block-wise quantization explain this dichotomy. Block quantizers normalize each contiguous block of weights by its maximum absolute value (absmax). When a WSP circuit inserts high-magnitude entries (α,γ\alpha, \gamma) into a few rows or columns, those entries either stay pinned at the top quantization bucket—preserving the backdoor as in ShieldGemma 2 (Opus 5.5) and 4-bit PaliGemma-3B—or stretch the block scale factor so severely that hundreds of neighboring clean weights are crushed into the zero bucket, destroying clean generation (CRA 0.00–0.05).

5. Practical Defense: Read-Only Static Weight-Space Auditing in Python

How can defenders catch a WSP backdoor without knowing the trigger pattern, without a clean reference model, and without running expensive forward passes? In Section 6.2, the authors show that a static weight-space auditor given read-only access to the model's weight tensors flagged 100% of the backdoored models with 0% false positives on clean models.

The very property that makes WSP fast and cheap—extreme surgical sparsity (0.0003%–0.023% edited parameters)—leaves unmistakable geometric anomalies in weight space:

  1. Localized Row/Column L2/L∞L_2/L_\infty Norm Spikes & Low-Rank Perturbations: Natural gradient descent distributes weight updates smoothly across layers. WSP creates extreme row or column norm Z-scores (Z >= 12.0) and rank-1 singular value spikes in isolated MLP (gate_proj, up_proj, down_proj) and projector layers.
  1. Zeroed Query Submatrices (Wq≈0\bm{W}_q \approx \bm{0}) Paired with Single-Axis RoPE Bias Spikes: An attention head whose query projection Frobenius norm collapses toward zero while its bias energy concentrates onto a single lowest-frequency RoPE coordinate aa never occurs in natural pretraining.
  1. Direct Cosine Alignment Between MLP down_proj Columns and Unembedding Tokens: Under Equation (2), modified columns of down_proj (wdk=αU(yk)\bm{w}_{\mathrm{d}}^k = \alpha \bm{U}(y_k)) exhibit abnormally high cosine similarity (>= 0.85) and large L2L_2 norms aligned directly with specific vocabulary tokens ("Safe", "No", "NA", "1337").

Below is a self-contained Python static auditing script that inspects local .safetensors shards on CPU with zero forward passes:

6. Operational Hardening Checklist for AI Security & MLOps Teams

Teams deploying open-weight VLMs for safety moderation (ShieldGemma 2, QwenGuard, LlavaGuard) or automated document/receipt extraction (PaliGemma, Qwen2-VL) should enforce four concrete controls:

  • Pair Cryptographic Provenance with Static Tensor Gates: Pin exact SHA-256 commit hashes from verified first-party publishers on Hugging Face Hub, and mandate automated static weight-space scanning (robust_z < 12.0 on MLP row/column norms and zero-query-head checks) in CI/CD before loading any community merge, fine-tune, or redistributed .safetensors checkpoint.
  • Audit High-Impact Vocabulary Unembeddings: For safety classifiers, pass the token IDs of verdict tokens ("Safe", "No", "NA", "benign")—and for financial/document OCR pipelines, digit tokens (0–9)—into scan_unembedding_alignment() to reject any checkpoint where an MLP down_proj column aligns (cosine >= 0.85) with a high-consequence output token.
  • Never Rely on 4-Bit or 8-Bit Quantization as a Security Control: As proven in Table 5 and Table 6, bitsandbytes PTQ either fails to remove high-margin WSP circuits or collapses clean reference agreement (CRA). Always evaluate CRA >= 0.95 on a held-out clean validation set after quantizing any third-party model.
  • Introduce Stochastic Resize/Padding Jitter at Preprocessing: Because Stage 1 vision matched filters depend on phase alignment after image resizing (demonstrated by Qwen2-VL-2B dropping to 0.55 ASR on tall SROIE receipts with aspect ratios 2–3), adding slight randomized crop or aspect-ratio padding jitter ahead of the vision processor significantly degrades fixed-frequency stripe triggers without harming natural OCR or moderation semantics.

7. References & Cross-Verified Sources (Verified 2026-12-01)

Korean version: TrojanMaxxing 심층 해부: 학습 없이 가중치 0.0003%만 직접 고쳐 VLM 백도어를 심는 가중치 공간 프로그래밍(WSP)과 정적 텐서 감사 전략TrojanMaxxing 심층 해부: 학습 없이 가중치 0.0003%만 직접 고쳐 VLM 백도어를 심는 가중치 공간 프로그래밍(WSP)과 정적 텐서 감사 전략

추천 글