mirror of
https://github.com/wassname/evil_MoE.git
synced 2026-08-04 12:53:53 +08:00
Finding: v_grad/As barely separate LIVE hack from clean (authored pairs are off-distribution: localized run_tests-block contrast vs full novel-problem rollouts). act-cosine best AUROC 0.69; grad-cosine best confident-tail p@10 0.70; magnitude inverted. Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
2.6 KiB
2.6 KiB
In [ ]:
import polars as pl
import matplotlib.pyplot as plt
D = '../out/diag/'
hist = pl.read_parquet(D+'cosine_dist.parquet')
scores = pl.read_parquet(D+'live_scores.parquet')
sep = pl.read_csv(D+'separability.csv')
sepIn [ ]:
# histograms: cosine to hack direction, both spaces
colors = {'pair_clean':'tab:blue','pair_hack':'tab:red','live_clean':'tab:cyan','live_hack':'tab:orange'}
fig, axes = plt.subplots(1, 2, figsize=(15, 5))
for ax, space in zip(axes, ['grad','act']):
for pop, c in colors.items():
v = hist.filter((pl.col('space')==space) & (pl.col('pop')==pop))['cos'].to_numpy()
if len(v):
ax.hist(v, bins=15, density=True, histtype='step', lw=2, color=c, label=f'{pop} (n={len(v)})')
ax.set_title(f'{space} space'); ax.set_xlabel('global cosine to hack dir'); ax.legend(fontsize=8)
plt.tight_layout(); plt.show()In [ ]:
# per-score distributions split by exploited: which score separates?
cols = [c for c in scores.columns if c != 'exploited']
fig, axes = plt.subplots(2, len(cols)//2, figsize=(16, 7))
for ax, col in zip(axes.flat, cols):
for y, c in [(True,'tab:orange'),(False,'tab:cyan')]:
v = scores.filter(pl.col('exploited')==y)[col].to_numpy()
ax.hist(v, bins=15, density=True, histtype='step', lw=2, color=c, label='hack' if y else 'clean')
ax.set_title(col, fontsize=8); ax.legend(fontsize=7)
plt.tight_layout(); plt.show()