File size: 1,276 Bytes
26ae91c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | def apply_selective_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[:, combined_units[l]] *= target_scale
if protect_scale != 1.0:
mat[:, protect_units[l]] *= protect_scale
target_sources = "circuit:8/circuit:9 excluding circuit:10" if l in agreed3 else "circuit:14/circuit:15 excluding circuit:16"
harmful_source = "circuit:10" if l in agreed3 else "circuit:16"
W.save_edit(name, mat,
evidence=f"L{l}: target columns {combined_units[l]} supported by {target_sources}, scale {target_scale}; protective columns {protect_units[l]} supported by harmful activation {harmful_source} AND harmful weight circuit:17, excluding target activation, scale {protect_scale}. Trials 7/8 show target dose response and need to preserve harmful refusal. All unselected weights released.")
apply_selective_scales(-0.5, 1.25)
trial9 = tools.measure.dev_eval(n=64, sets=["borderline", "harmful", "benign"])
print("Trial 9:", trial9)
print("Changed entries:", tools.edit.list_edits()["entries_changed"])
note("Trial 9: target columns scale -0.5; disjoint harmful-specific columns scale 1.25. " + str(trial9)) |