When a safety-aligned language model is given eyes, meaning a vision encoder plus a small projection network that feeds image features into the model, it largely stops refusing harmful requests. Adapting LLaMA-2-Chat with a vision projector raised its text attack success rate from 10.4% to 54.4%, and its multimodal attack success rate reached 96.2% (How Does Vision-Language Adaptation Impact the Safety of Vision Language Models?). Current repairs work in continuous parameter space. They merge weights or project updates onto a low-rank "safety subspace." Neither asks a question coding theorists ask routinely about linear codes: how many coordinates must you look at to see r independent directions of this subspace? In coding theory that number is the r-th generalized Hamming weight, the smallest possible support of an r-dimensional subcode. The full sequence of these numbers, the weight hierarchy, describes how information is spread across coordinates. It determines, for example, how many shares an adversary must corrupt to learn part of a secret.
This proposal brings that invariant over to neural networks. We define a noise-tolerant support hierarchy for the subspace of activations that carries refusal behavior. We measure it layer by layer, in text-only models and in their vision-adapted descendants. We then test two things. First, does vision adaptation break safety exactly when its weight updates overlap the small coordinate sets that carry the safety subspace? Second, does protecting only those coordinates, with a budget set by the hierarchy, restore safety at a lower utility cost than existing defenses? The result would give both a predictive diagnostic for which adaptations are dangerous and a compact, auditable defense: a short list of neurons whose integrity safety depends on.
Core Claim
Let $B \in \mathbb{R}^{n \times k}$ have orthonormal columns spanning a $k$-dimensional safety subspace $S$ in a layer's $n$-dimensional neuron basis. Following LSSF, $S$ is estimated from activation differences between harmful and harmless prompts. For a coordinate set $T$, let $B_T$ be the rows of $B$ indexed by $T$. Exact supports are useless here because estimated directions are almost never exactly sparse. We therefore relax the coding-theory definition to energy concentration:
$$d_r^{\varepsilon}(S) = \min \{ |T| : \lambda_r(B_T^\top B_T) \ge 1-\varepsilon \}.$$
Here $\lambda_r$ is the r-th largest eigenvalue. The condition says some $r$-dimensional subspace of $S$ keeps at least a $1-\varepsilon$ fraction of every unit vector's energy inside $T$. At $\varepsilon = 0$ this recovers the generalized Hamming weight $d_r$ from The weight hierarchies of three classes of linear codes, with the base field changed from a finite field to the reals. The sequence $d_1^{\varepsilon} \le \dots \le d_k^{\varepsilon}$ is the safety support hierarchy.
The core claim is empirical and falsifiable. The safety damage caused by vision-language adaptation is predicted better by the fraction of adaptation-update energy that lands on the minimal supports $T_r$ than by the layer-level cosine drift that Lee et al. use to locate damage in layers 6–14. As a corollary, freezing or regularizing the coordinates in $T_r$ during adaptation, with $r$ chosen at the knee of the hierarchy, should recover most of the safety that coordinate-agnostic defenses recover, while touching far fewer parameters.
Research Program
The first component is computational. Computing $d_r$ exactly requires searching over all $r$-dimensional subspaces, which grows exponentially. The coding papers flag this explosion, and for non-divisible parameters they settle for bounds rather than exact values (On the Generalized Hamming Weights of (r, δ)-Locally Repairable Codes). The relaxed problem is closely related to sparse principal component analysis. We will compute upper bounds on $d_r^{\varepsilon}$ with greedy coordinate addition, maximizing $\lambda_r$ at each step, and lower bounds with a semidefinite relaxation. The gap between the two bounds is reported as an honesty check.
To validate the estimator, we exploit the fact that at $\varepsilon=0$ over small fields the problem is exactly the classical one. We will run the greedy and relaxation procedures on code instances whose hierarchies can be computed exhaustively, such as the $[12,5,4]$ code from that paper's Magma verification. The file reports only that formulas matched experiment, so we will recompute those reference values ourselves rather than cite them.
The second component is diagnostic. We will reproduce the LLaMA-2-Chat to LLaMA-2-Chat-VL adaptation of Lee et al. and compute safety subspaces and their hierarchies at every layer, before and after adaptation. We will also compute a relative hierarchy, borrowing the relative generalized Hamming weights that set leakage thresholds in nested secret-sharing codes (Relative generalized Hamming weights of one-point algebraic geometric codes). It measures how many coordinates carry safety directions that text-harmful prompts activate but image-borne harmful prompts do not. Typographic FigStep images and HADES pointer images serve as the image-borne prompts. Our working hypothesis is that this relative quantity is a structural description of the "gap": the part of the refusal subspace that image inputs never reach.
The third component is the intervention. During visual instruction tuning, we mask or penalize updates on the neuron rows in $T_r$, then compare against the baselines below at matched parameter budgets.
Baselines
The naive reference point is the unprotected vision-adapted model, against which every defense must improve. Lee et al. report that adaptation raises multimodal attack success rate to 96.2% and text attack success rate to 54.4%. We will reproduce this model on the same data and compute.
The strongest existing parameter-space defense in the file is the weight merging of Lee et al. It linearly interpolates a safety-tuned and an instruction-tuned checkpoint at a 4:6 ratio, and the paper reports about 61.7% multimodal accuracy at roughly 1% multimodal attack success rate. Because merging has a tunable ratio, a fair comparison sweeps it with the same tuning budget we give our sparsity budget $r$ and $\varepsilon$. We then compare full safety-utility frontiers rather than single points. Beating merging means matching its roughly 1% attack success rate while exceeding 61.7% accuracy, or lowering exaggerated-safety refusals on XSTest and USB at equal attack success rate.
The second strong competitor is continuous subspace protection in the style of LSSF. LSSF reports 100% AdvBench refusal on LoRA-tuned text models with AG's News accuracy near 0.85. We found no reported result on Lacuna for LSSF applied to vision-language models, so we will port it ourselves. We will port it in two ways. The first projects adaptation updates away from $S$ during training, which is the same timing as our coordinate mask, so this variant cleanly isolates support against span. The second re-fuses the safety subspace after training, as LSSF does. Both variants use the identical estimated subspace.
On the training-based side, contrastive harmlessness LoRA reduced LLaVA-1.5's HADES attack success rate from 90.26% to 5.07% (Images are Achilles' Heel of Alignment). It is the number to match on HADES.
Three ablations isolate the key ingredient, the choice of coordinates by support hierarchy. Each freezes the same number of coordinates as $T_r$, but chooses them differently: at random; by largest weight change or largest safety-direction magnitude per neuron, with no subspace reasoning; or as whole layers 6–14, following Lee et al.'s localization.
Why not just…?
Why not just project updates away from the continuous safety subspace, as LSSF does? This is the real threat. If orthogonal projection matches coordinate masking on every benchmark, the defensive half of the claim collapses. The contribution would then shrink to the diagnostic and to compactness: a mask over $d_r$ neurons is cheaper to store and audit than a dense projector. The supply-chain setting of Architectural Backdoors in Vision-Language Model Supply Chains via Representation Steering makes compactness matter, since checking that a few hundred named neurons are untouched is a concrete integrity test. The training-time projection baseline settles this directly, and we commit to reporting a tie as a tie. One reason to expect a difference is that projection constrains only the span. Updates can still shift the coordinates that carry the span and change how later nonlinearities read it, whereas a support mask cannot.
Why not just merge weights? Merging already reaches about 1% multimodal attack success rate in Lee et al. However, that number comes from a hand-chosen ratio, and merging offers no account of why particular adaptations break safety. Our predictive test asks whether hierarchy overlap forecasts attack success rate across adaptation variants better than layer cosine drift. That question is independent of whether merging works, and the frontier comparison shows whether merging also wins on utility.
Why not just fine-tune on multimodal safety data or add in-context examples? Lee et al. report that sequential safety fine-tuning drives attack success rate toward zero but sharply inflates exaggerated refusals. In-context explanations still leave 20–30% unsafe on SSUI even for GPT-4o, which rises only from 58.88% to 80.90% (Safe Semantics, Unsafe Interpretations). Both are compatible with our method, and we will test stacking our mask with safety fine-tuning to see whether it reduces the oversensitivity penalty.
Proposed Experiments
Safety is measured on four benchmarks. SafeBench from FigStep covers typographic attacks, where FigStep averages 82.50% attack success rate on open models. HADES covers pointer and adversarial-image attacks. SIUO (Safe Inputs but Unsafe Output) covers safe-image-plus-safe-text compositions; its top model, GPT-4V, reaches only a 53.26% safe rate. The USB dataset supplies attack success rate and oversensitivity across modality combinations. XSTest measures exaggerated safety, and Lee et al.'s multimodal accuracy suite measures utility.
The first decisive check is predictive. We create twenty or more adaptation variants by varying learning rate, which layers are tuned, LoRA rank, and data mixture. For each, we regress the change in attack success rate on hierarchy-overlap energy and, separately, on layer cosine drift. The claim fails if overlap explains no more variance than drift.
The second check is interventional. On frontiers matched by parameter budget, masking $T_r$ must beat all three ablations of equal size. Beating random selection alone is not enough, because it would show only that any freezing helps. The method must also beat magnitude-chosen coordinates, or the hierarchy adds nothing.
The third check is about the gap itself. If the relative hierarchy between text-elicited and image-elicited safety subspaces is meaningful, it should shrink after a successful defense. It should also be larger for attack families with higher measured attack success rate, such as typographic attacks compared with SIUO compositions. If it shows neither pattern, the secret-sharing analogy does not hold for these models, and we will say so.
References
- How Does Vision-Language Adaptation Impact the Safety of Vision Language Models?
- LSSF: Safety Alignment for Large Language Models through Low-Rank Safety Subspace Fusion
- The weight hierarchies of three classes of linear codes
- On the Generalized Hamming Weights of (r, δ)-Locally Repairable Codes
- Relative generalized Hamming weights of one-point algebraic geometric codes
- Images are Achilles' Heel of Alignment: Exploiting Visual Vulnerabilities for Jailbreaking Multimodal Large Language Models
- Architectural Backdoors in Vision-Language Model Supply Chains via Representation Steering
- Safe Semantics, Unsafe Interpretations: Tackling Implicit Reasoning Safety in Large Vision-Language Models
- $\mathsf{FigStep}$ : Jailbreaking Large Vision-Language Models via Typographic Visual Prompts
- Safe Inputs but Unsafe Output: Benchmarking Cross-modality Safety Alignment of Large Vision-Language Models