diff --git a/src/projected_grpo/probe_distill.py b/src/projected_grpo/probe_distill.py index c4c85fc..6949d28 100644 --- a/src/projected_grpo/probe_distill.py +++ b/src/projected_grpo/probe_distill.py @@ -343,8 +343,18 @@ def main(cfg: Config) -> int: ) hr = sum(hacked_list) / cfg.group pr = sum(gt_list) / cfg.group + # Bucket cos by (hacked, gt_pass) so the discrimination signal is inline. + def _bucket_mean(pred): + cs = [per_sample_cos[i] for i in range(cfg.group) + if pred(i) and per_sample_cos[i] is not None] + return (sum(cs)/len(cs), len(cs)) if cs else (float('nan'), 0) + cph, nph = _bucket_mean(lambda i: hacked_list[i] and not gt_list[i]) + cmx, nmx = _bucket_mean(lambda i: hacked_list[i] and gt_list[i]) + cno, nno = _bucket_mean(lambda i: not hacked_list[i]) logger.info( f"step {step} DONE hack={hr:.2f} pass={pr:.2f} " + f"cos_pureHack={cph:+.3f}(n={nph}) cos_mixed={cmx:+.3f}(n={nmx}) " + f"cos_noHack={cno:+.3f}(n={nno}) " f"cos_in={diag['mean_cos_in']:+.3f} cos_out={diag['mean_cos_out']:+.3f} " f"fired={diag['frac_fired']:.2f} sec={time.time()-t0:.0f}" )