Upload code/analyze.py with huggingface_hub
Browse files- code/analyze.py +14 -5
code/analyze.py
CHANGED
|
@@ -139,7 +139,7 @@ def _group_annotate(ax, pts, dx=9, dy=5):
|
|
| 139 |
for x, y, name in pts:
|
| 140 |
b.setdefault((round(x, 6), round(y, 5)), []).append(name)
|
| 141 |
for (x, y), names in b.items():
|
| 142 |
-
ax.annotate(" / ".join(names), (x, y), textcoords="offset points",
|
| 143 |
xytext=(dx, dy), fontsize=7, color="#334155")
|
| 144 |
|
| 145 |
if rows:
|
|
@@ -324,8 +324,17 @@ A("")
|
|
| 324 |
# ---- headline verdict
|
| 325 |
A("## Headline")
|
| 326 |
A("")
|
| 327 |
-
|
| 328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
if real:
|
| 330 |
A(f"**{len(real)} real community fork(s), {len(ctlr)} ground-truth control(s).**")
|
| 331 |
A("")
|
|
@@ -336,14 +345,14 @@ if real:
|
|
| 336 |
"models out of the base model's frame, so the chat vector is already expressed in the right "
|
| 337 |
"basis and aligning it is a no-op. The measured accuracy difference is **exactly zero on every "
|
| 338 |
"benchmark** — the aligned and naive merges are bit-identical models.")
|
| 339 |
-
won = [r for r in real if r.get("ifeval_prompt__naive", 0) > r.get("ifeval_prompt__fork", 1)]
|
| 340 |
A(f"- The chat-vector recipe itself **works** on {len(won)} of {len(real)} of these forks: it lifts "
|
| 341 |
"instruction following well above the fork it started from, i.e. the merged model beats its own "
|
| 342 |
"parent — the bar that matters.")
|
| 343 |
ok = sum(1 for r in real if (r["coord_share"] >= THRESH) == (r.get("ifeval_prompt__delta", 0) > 0.005))
|
| 344 |
A(f"- The diagnostic's registered prediction was correct on **{ok}/{len(real)}** real forks.")
|
| 345 |
if ctlr:
|
| 346 |
-
big = max(ctlr, key=lambda r: r["
|
| 347 |
A(f"- On the ground-truth control (a real fork acted on by a random element of the model's own "
|
| 348 |
f"symmetry group — functionally identical, differently parameterised), the diagnostic fires "
|
| 349 |
f"(coordinate share **{big['coord_share']:.3f}**), the naive chat vector "
|
|
|
|
| 139 |
for x, y, name in pts:
|
| 140 |
b.setdefault((round(x, 6), round(y, 5)), []).append(name)
|
| 141 |
for (x, y), names in b.items():
|
| 142 |
+
ax.annotate(" / ".join(sorted(set(names))), (x, y), textcoords="offset points",
|
| 143 |
xytext=(dx, dy), fontsize=7, color="#334155")
|
| 144 |
|
| 145 |
if rows:
|
|
|
|
| 324 |
# ---- headline verdict
|
| 325 |
A("## Headline")
|
| 326 |
A("")
|
| 327 |
+
# One row per (fork, lambda); the headline counts MODELS, so collapse to the lambda=1.0 row
|
| 328 |
+
# (the actual chat-vector recipe) or, failing that, the first row for that fork.
|
| 329 |
+
def _canon(rs):
|
| 330 |
+
out = {}
|
| 331 |
+
for r in rs:
|
| 332 |
+
k = r["fork"]
|
| 333 |
+
if k not in out or (r["lam"] == 1.0 and out[k]["lam"] != 1.0):
|
| 334 |
+
out[k] = r
|
| 335 |
+
return sorted(out.values(), key=lambda z: z["coord_share"])
|
| 336 |
+
real = _canon([r for r in rows if not r["is_control"]])
|
| 337 |
+
ctlr = _canon([r for r in rows if r["is_control"]])
|
| 338 |
if real:
|
| 339 |
A(f"**{len(real)} real community fork(s), {len(ctlr)} ground-truth control(s).**")
|
| 340 |
A("")
|
|
|
|
| 345 |
"models out of the base model's frame, so the chat vector is already expressed in the right "
|
| 346 |
"basis and aligning it is a no-op. The measured accuracy difference is **exactly zero on every "
|
| 347 |
"benchmark** — the aligned and naive merges are bit-identical models.")
|
| 348 |
+
won = [r for r in real if r.get("ifeval_prompt__naive", 0) > r.get("ifeval_prompt__fork", 1) + 0.02]
|
| 349 |
A(f"- The chat-vector recipe itself **works** on {len(won)} of {len(real)} of these forks: it lifts "
|
| 350 |
"instruction following well above the fork it started from, i.e. the merged model beats its own "
|
| 351 |
"parent — the bar that matters.")
|
| 352 |
ok = sum(1 for r in real if (r["coord_share"] >= THRESH) == (r.get("ifeval_prompt__delta", 0) > 0.005))
|
| 353 |
A(f"- The diagnostic's registered prediction was correct on **{ok}/{len(real)}** real forks.")
|
| 354 |
if ctlr:
|
| 355 |
+
big = max(ctlr, key=lambda r: r["coord_share"])
|
| 356 |
A(f"- On the ground-truth control (a real fork acted on by a random element of the model's own "
|
| 357 |
f"symmetry group — functionally identical, differently parameterised), the diagnostic fires "
|
| 358 |
f"(coordinate share **{big['coord_share']:.3f}**), the naive chat vector "
|