File size: 983 Bytes
1bde957 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | def unit_pairs(result):
return {(int(l), int(j)) for l, js in result["units"].items() for j in js}
fmt_shared = unit_pairs(fmt_act) & unit_pairs(fmt_weight)
safe_units = unit_pairs(safe_act)
writer_units = {(r["layer"],r["neuron"]) for r in writers["promote"]}
print("Kit agreement excluding safety and final layer:", sorted(u for u in fmt_shared-safe_units if u[0]<35))
print("Token writers in activation kit:", sorted(writer_units & unit_pairs(fmt_act)))
print("Token writers in weight kit:", sorted(writer_units & unit_pairs(fmt_weight)))
contrast = tools.localize.neuron_contrast(
a=[prompts[i] for i in verbose_ids], b=[prompts[i] for i in concise_ids[:25]],
a_answers=[answers[i] for i in verbose_ids], b_answers=[answers[i] for i in concise_ids[:25]],
position="mean", n=25, top=40)
print("ANSWER CONTRAST:", contrast)
print("UNPRINTED FAILURES:")
for r in wrong[9:21]:
print(r["i"], "target",r["target"],"final",r["final"], "tail", answers[r["i"]][-200:]) |