The modification
Table with columns: tensor, shape, changed BF16 entries, rank of change, relative Frobenius change| tensor | shape | changed BF16 entries | rank of change | relative Frobenius change |
|---|
model.language_model.layers.20.mlp.gate_proj.weight | [12288, 4096] | 8,191 | 2 | 18.96% |
model.language_model.layers.20.mlp.up_proj.weight | [12288, 4096] | 8,191 | 2 | 1.28% |
model.language_model.layers.20.mlp.down_proj.weight | [4096, 12288] | 8,191 | 2 | 7.29% |
model.language_model.layers.22.mlp.gate_proj.weight | [12288, 4096] | 8,190 | 2 | 15.20% |
model.language_model.layers.22.mlp.up_proj.weight | [12288, 4096] | 8,190 | 2 | 1.18% |
model.language_model.layers.22.mlp.down_proj.weight | [4096, 12288] | 8,192 | 2 | 12.62% |
49,145 of 8.77 B weights differ from the original (rows / columns of neurons 8274 and 9595 in layer 20,
188 and 4039 in layer 22). Vision tower, embeddings, attention and all other layers are untouched.
Per layer, two of the least-used MLP neurons are overwritten so that together they add
c·|r|·clip((w·x − τ)/width, 0, 1)·r̂ to the residual stream (c = 4, width = 0.2, β = 32):
w — harm detector: difference of means (harmful − benign development prompts, last prompt position),
whitened by a regularised covariance (closed-form ridge solve on activation statistics).
b — a direction with b·x ≈ 1 at every position, giving the bias-free MLP a real threshold τ, set at
the 99.5% quantile of benign last positions (answer positions added as negatives).
r̂, |r| — refusal direction after the layer: mean(refused) − mean(complied) over harmful development prompts.
- Neuron A switches the push on, neuron B caps it (a saturating step); hence rank 2 per matrix.
Loading
from transformers import AutoProcessor, Qwen3VLForConditionalGenerationimport torchproc = AutoProcessor.from_pretrained("AnirudhNarayan/wsp_nov10_qwen3vl8b", max_pixels=1280*32*32)model = Qwen3VLForConditionalGeneration.from_pretrained("AnirudhNarayan/wsp_nov10_qwen3vl8b", dtype=torch.bfloat16, device_map="auto")msgs = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "What is shown in this image?"}]}]text = proc.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)inputs = proc(text=[text], images=[image], return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=256, do_sample=False)print(proc.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
Development used transformers 4.57.5, BF16, the model's chat template with the image first and the prompt
second, no system prompt, on one 16 GB GPU with partial CPU offload.
Development results (VLGuard training-set prompts reserved from editing)
First-token refusal rate, original → edited: unsafes 0.34 → 1.00, safe_unsafes 0.59 → 0.98,
safe_safes 0.00 → 0.00, LLaVA benign 0.02 → 0.02. 48-token generation: 40/40 harmful refused, 0/16
benign refused. Reference-answer NLL unchanged (safe_safes 2.077 → 2.075).
Held-out evaluation (VLGuard test set, 1,558 prompts; rule-based refusal scoring, no LLM judge)
Original vs edited, identical settings (BF16, greedy, 64 new tokens). ASR = share of harmful prompts not
refused (refusal-phrase match); ORR = refusal share on benign prompts.
Table with columns: subset, n, ASR original → edited| subset | n | ASR original → edited |
|---|
| unsafes (harmful image) | 442 | 0.432 → 0.014 |
| safe_unsafes (safe image, harmful instruction) | 558 | 0.237 → 0.011 |
| aggregate | 1000 | 0.323 → 0.012 |
| safe_safes ORR | 558 | 0.002 → 0.041 |
311 harmful prompts newly refused; no prompt refused by the original is fulfilled by the edited model.
Benign utility otherwise unchanged (reference NLL 2.040 → 2.042, word-F1 0.362 → 0.361). Of the 22 new
benign refusals, 8 refuse from the first token (sensitive-looking images) and 14 break into a refusal
mid-answer, typically after a line such as "Here's a breakdown:". Rule-based labels; an independent
judged evaluation by the study team is pending.
Evaluation limitations
- Held-out numbers use a refusal-phrase rule on 64-token outputs, not a semantic judge. 185 of 988 edited
refusals contain a "however, I can…" turn and may give partial content.
- Only VLGuard was evaluated; FigStep, MM-SafetyBench, JailBreakV, ScienceQA and MathVista are pending.
- Over-refusal rose to about 4%, more than development predicted, mainly through mid-answer refusals.
- The run used Claude Fable 5.2 rather than the study's specified Fable 5.1, and the workspace had no git
commit hash (data verified by manifest checksums instead). The harm detector uses a closed-form
whitened mean difference; whether that counts as "parameter fitting" under the study rules is for the
study team to decide.
Provenance
Base model: Qwen/Qwen3-VL-8B-Instruct
(Apache-2.0; this derivative keeps that license). The full editing log, scripts and raw outputs are in the
study's handoff package; this checkpoint is bit-identical to that package's edited_model/.