The modification
Table with columns: tensor, shape, changed BF16 entries, relative Frobenius change| tensor | shape | changed BF16 entries | relative Frobenius change |
|---|
model.language_model.layers.23.mlp.down_proj.weight | [2560, 9728] | 162,436 | 3.75% |
model.language_model.layers.28.mlp.down_proj.weight | [2560, 9728] | 162,380 | 2.49% |
Per layer: W = W0 + 4 · outer(u, m ⊙ (u @ W0)), where u is the unit "refusal direction"
(mean residual activation at the last prompt token of development prompts the model declined
minus those it fulfilled) and m selects the 64 MLP neurons whose output columns write most of
that direction while being quiet on benign prompts. The edit scales those neurons' write onto
the refusal direction ×5 and nothing else. Mechanistic basis (measured on this model): refusal
is decided late (layers 19–24) and written mainly by the MLPs of layers 23–29; harmful image
content is not linearly represented at the decision position, so the base model's frequent
"critical engagement" with hateful memes (naming the harm, then explaining the content) is a
text-cued decision made before the harm is articulated. The edit makes text-cued refusal fire
consistently; it does not add image-conditioned refusal. Norm-matched random-direction and
random-column controls had no effect.
Loading
from transformers import AutoProcessor, Qwen3VLForConditionalGenerationimport torchproc = AutoProcessor.from_pretrained("utsavz/wsp_nov9_qwen3vl4b", max_pixels=1280*32*32)model = Qwen3VLForConditionalGeneration.from_pretrained("utsavz/wsp_nov9_qwen3vl4b", dtype=torch.bfloat16, device_map="cuda:0")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("cuda:0")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, SDPA attention, the model's chat template with the
image first and the prompt second, no system prompt.
Development results (provisional; VLGuard training-set prompts reserved from editing)
Paired original vs edited, 40-token greedy generation, labels from a validated first-token
decline proxy plus rule-assisted reading by the editing agent (no LLM judge): attack success
(compliance share) on 56 unsafe-type prompts 39% → 25% (unsafes 68% → 46%, safe_unsafes
11% → 4%); 0 newly unsafe responses; over-refusal 1/40 benign prompts (a blank white image);
18/32 benign outputs token-identical; 0/32 96-token outputs repetitive.
Held-out evaluation (VLGuard test set, 1,558 prompts; rule-based refusal scoring, no LLM judge)
Original vs edited, identical settings (BF16, greedy, 256 new tokens). ASR_strict = share of outputs
that do not open with a refusal; ORR = refusal share on benign prompts.
Table with columns: subset, n, ASR_strict original → edited| subset | n | ASR_strict original → edited |
|---|
| unsafes (harmful image) | 442 | 0.498 → 0.353 |
| safe_unsafes (safe image, harmful instruction) | 558 | 0.249 → 0.084 |
| aggregate | 1000 | 0.359 → 0.203 |
| safe_safes ORR | 558 | 0.000 → 0.002 |
No prompt refused by the original is fulfilled by the edited model; 1/558 benign prompts is newly
labelled a refusal (a hedge that still answers). Overall repetition unchanged (26 → 26 of 1,000
unsafe-type prompts). Rule-based labels; an independent judged evaluation by the study team is pending.
Evaluation limitations
- Development numbers are small-sample and agent-judged; the held-out numbers use a
refusal-phrase rule, not a semantic judge, and will be re-judged independently by the study team.
- Text-cued only: neutral instructions over harmful images ("describe this image", "discuss
the implications of the text") are still fulfilled — about 40% of held-out development unsafes
were unreachable at any dose.
- Refusal-rate scoring treats the base model's critical engagement (naming and condemning the
harmful content while explaining it) as attack success; a semantic judge may score differently.
Provenance
Base model: Qwen/Qwen3-VL-4B-Instruct
(Apache-2.0; this derivative keeps that license). Method reference: "Weight-Space Programming"
(rikiyat.github.io/blog/weight-space-programming). The exact patch (edited and original tensors,
manifest with hashes and selected column ids) and the full editing log are in the study's handoff
package; this checkpoint is bit-identical to that package's edited_model/.