What this is
An experiment asked: can an LLM agent improve the safety of a multimodal model by editing its weights
directly — no gradients, no fine-tuning, no existing safety dataset — generating all its own evidence
within a fixed query budget? The agent probed the base model with its own synthetic inputs, located a
late-emerging, MLP-written "refusal direction" in the residual stream, and applied a single
conditional rank-1 edit that amplifies that direction in proportion to how harmful an MLP activation
looks.
The entire edit is one weight matrix:
layers.20.mlp.down_proj.weight += outer(r_out, v)
r_out — unit residual-stream refusal direction at layer 20 (diff-of-means: refused harmful vs.
benign prompts).
v = alpha * d_in, with a benign-offset cancellation at one always-on neuron so that benign inputs
(small projection onto the harmfulness direction d_in) receive almost no push.
alpha = c * delta_resid[20] / a_harm[20], c = 0.75.
Net effect: an MLP activation that reads as harmful gets nudged along the refusal direction; a benign one
is left essentially untouched. This is a linear, gradient-free analogue of conditional activation
steering, baked permanently into the weights. No inference-time hook or wrapper is needed — load it
like any other Qwen3-VL checkpoint.
All other tensors are byte-identical to the base model (names, shapes and BF16 dtype preserved); only
the shard containing layers.20.mlp.down_proj.weight is rewritten. checkpoint_sha256.json in this repo
lists the hash of every file.
Measured effect (self-generated synthetic evaluation)
Two disjoint synthetic pools, built from scratch with Pillow-rendered images (no downloaded data). Pool A
was used to find and select the edit; Pool B is held out (different harmful intents, different
presentations). Metrics, 256-token greedy decode:
- refuse_FAIL — refusal rate on the families the base model fails on (compositional harm, and
image-disambiguated ambiguous harm). Higher = safer.
- refuse_harm_all — refusal across all harmful/adversarial items. Higher = safer.
- over-refusal (ambiguous benign / clear benign) — refusal on benign look-alikes and on plain benign
controls. Lower = better.
- capability — accuracy on benign capability controls (counting, OCR, reading charts/tables). Higher
= better; must be preserved.
Table with columns: Pool, Model, refuse_FAIL ↑, refuse_harm_all ↑, over-ref. ambig-benign ↓, over-ref. clear-benign ↓, capability ↑| Pool | Model | refuse_FAIL ↑ | refuse_harm_all ↑ | over-ref. ambig-benign ↓ | over-ref. clear-benign ↓ | capability ↑ |
|---|
| B (held-out) | base | 0.80 | 0.938 | 0.40 | 0.00 | 1.00 |
| B (held-out) | edited | 1.00 | 0.979 | 0.40 | 0.00 | 1.00 |
| A (dev) | base | 0.50 | 0.846 | 0.50 | 0.024 | 0.765 |
| A (dev) | edited | 0.667 | 0.904 | 0.50 | 0.060 | 0.765 |
Reading it honestly:
- Held-out Pool B: refusal on the failing families rises 0.80 → 1.00 and overall harm refusal
0.938 → 0.979, with over-refusal unchanged (0.40 → 0.40 ambiguous, 0.00 → 0.00 clear) and
capability unchanged (1.00). A clean gain.
- Dev Pool A: refusal on the failing families rises 0.50 → 0.667 and overall harm refusal
0.846 → 0.904; ambiguous-benign over-refusal is unchanged (0.50 → 0.50); clear-benign over-refusal
rises slightly (0.024 → 0.060, ≈ 3 of 84 extra benign controls refused); capability is preserved
(0.765).
The edit was chosen specifically because, across a 134-configuration sweep, it raised safety without
raising over-refusal, and because it was the configuration whose profile transferred to the held-out
pool. Stronger edits scored higher on Pool A's failing families but over-refused ambiguous-benign
inputs on Pool B (up to refusing everything) — i.e. they overfit the dev set and were rejected.
The refusal direction it amplifies is causally load-bearing in the base model: ablating it collapses
harm refusal (≈0.85 → 0.21) at no capability cost, and adding it raises refusal — evidence the edit
changes a general refusal mechanism rather than patching specific examples.
Intended use
Research on gradient-free weight-space safety editing, activation steering, and multimodal refusal
mechanisms. Useful for: reproducing/criticising the method, diffing against the base model, and as a
subject for independent evaluation on real safety and over-refusal benchmarks.
Not for production or safety-critical deployment. A refusal-phrase proxy on a small synthetic set is
not a safety guarantee.
Limitations
- Synthetic-only evaluation. All eval images are schematic Pillow renders (rendered text, simple
diagrams, icon drawings) — no photographs, real screenshots, or natural typographic attacks. English
only. Pools are small (~142 dev / ~121 held-out), so family rates move in coarse steps.
- Proxy safety metric. "Safety" here = the response starts with a refusal phrase. It does not read
whether a non-refusing answer is actually harmful, can miss soft compliance, and may count a safe
redirection as a refusal.
- Agent-authored harm taxonomy, deliberately excluding the most sensitive categories (CBRN synthesis,
anything involving minors). Transfer to those is untested.
- Over-refusal tension on ambiguous inputs. Benign and harmful items that share text but differ by
image are only weakly separable; any gain there trades against benign over-refusal. This edit was tuned
to avoid that trade on the tested pools, but the margin is small and pool-dependent.
- Not externally validated. No MMMU/benchmark capability check, no external attack-success evaluation.
Reproduce / load
from transformers import AutoProcessor, Qwen3VLForConditionalGenerationimport torch model = Qwen3VLForConditionalGeneration.from_pretrained( "Adeely93/Qwen3-VL-4B-Instruct-wsp-safety-edit", torch_dtype=torch.bfloat16, device_map="auto")processor = AutoProcessor.from_pretrained("Adeely93/Qwen3-VL-4B-Instruct-wsp-safety-edit")
To recover the base model, revert the single edited matrix (the edit outer(r_out, v) is logged in the
experiment's editing_log.md / final_recipe.json), or just load Qwen/Qwen3-VL-4B-Instruct.
Provenance
- Base model:
Qwen/Qwen3-VL-4B-Instruct
@ ebb281ec70b05090aa6165b016eac8ec08e71b17, Apache-2.0.
- Method: synthetic-only, gradient-free weight-space programming. Query budget ≤500 target-model
forward passes; this checkpoint was frozen after ~185 passes (direction-finding + a 134-config edit
sweep + held-out Pool B validation). No gradients, optimizers, fine-tuning, or LoRA were used.
- Produced by: an autonomous Claude agent (Claude Code) under a fixed experimental protocol.
Checkpoint integrity
Only model-00002-of-00002.safetensors was rewritten; model-00001-of-00002.safetensors is
byte-identical to the base model. Full hashes are in checkpoint_sha256.json.
model-00001-of-00002.safetensors sha256 30a01a0556622645a3cce87b655bbbbbc1f170c196099f1b666c93202c3339a9model-00002-of-00002.safetensors sha256 841d0678f6e95aae54caab4788b3e635d472ed4151d8375da42835dbdfe2afdc
edit_manifest.json records the exact edit: RankOne(layers.20.mlp.down_proj.weight, alpha=+2.821).