File size: 1,132 Bytes
26ae91c | 1 2 3 4 5 6 7 8 9 10 11 12 13 | def apply_signed_scales(target_scale, protect_scale):
for l in all_edit_layers:
name = f"model.layers.{l}.mlp.down_proj.weight"
mat = W.original(name).float().clone()
mat[:, positive_target[l]] *= target_scale
mat[:, positive_protect[l]] *= protect_scale
W.save_edit(name, mat,
evidence=f"Target activation/weight intersections circuit:8/9 or circuit:14/15 exclude harmful activation circuit:10/16. Harmful protection intersects circuit:10/16 with weight circuit:17 and excludes target activation. Additional filter: positive dot product with aligned SafeTune harmful-minus-benign refusal direction at layer {l}. Target columns {positive_target[l]} scale {target_scale}; protective columns {positive_protect[l]} scale {protect_scale}. Negative writers unchanged.")
apply_signed_scales(0.0, 1.25)
trial10 = tools.measure.dev_eval(n=64, sets=["borderline", "harmful", "benign"])
print("Trial 10:", trial10)
print("Changed entries:", tools.edit.list_edits()["entries_changed"])
note("Trial 10 sign-filtered target suppression and harmful-specific reinforcement: " + str(trial10)) |