File size: 1,899 Bytes
26ae91c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | extra_layers = [10, 12, 26, 27, 28, 29, 30]
extra_act = tools.localize.safety_neurons(
method="activation", top_k=512, layers=extra_layers,
n=32, a="borderline", b="benign", on="aligned")
extra_weight = tools.localize.safety_neurons(
method="weight", top_k=1024, layers=extra_layers,
n=32, a="borderline", b="benign", on="aligned")
extra_harm = tools.localize.safety_neurons(
method="activation", top_k=512, layers=extra_layers,
n=32, a="harmful", b="benign", on="aligned")
ea, ew, eh = map(unit_map, [extra_act, extra_weight, extra_harm])
extra_units = {l: sorted((ea[l] & ew[l]) - eh[l]) for l in extra_layers}
print("Extra handles:", extra_act["circuit"], extra_weight["circuit"], extra_harm["circuit"])
print("Extra counts:", {l: len(v) for l, v in extra_units.items()})
combined_units = dict(agreed3)
combined_units.update(extra_units)
print("Revert orthogonal trial:", tools.edit.revert())
for l, cols in combined_units.items():
name = f"model.layers.{l}.mlp.down_proj.weight"
mat = W.original(name).float().clone()
mat[:, cols] *= 0.5
source = (target_act3["circuit"], target_weight3["circuit"], harm_act3["circuit"]) if l in agreed3 else (extra_act["circuit"], extra_weight["circuit"], extra_harm["circuit"])
W.save_edit(name, mat,
evidence=f"Independent SafeTune activation/weight agreement {source[:2]}, excluding harmful activation {source[2]}; L{l} columns {cols}. Trial 4 supports selective 50% attenuation; EAP circuit:11 vs circuit:12 motivates extending localization beyond initial window. No CircuitKIT evidence used.")
trial7 = tools.measure.dev_eval(n=64, sets=["borderline", "harmful", "benign"])
print("Trial 7:", trial7)
print("Changed entries:", tools.edit.list_edits()["entries_changed"])
note("Attention faithfulness unavailable, no heads edited. Trial 7: expanded target-only neuron set at half strength: " + str(trial7)) |