Upload scripts/mk_overlay.py with huggingface_hub
Browse files- scripts/mk_overlay.py +53 -0
scripts/mk_overlay.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Transposed view: tokens on x, one coloured line per YARN_SCALE."""
|
| 3 |
+
import matplotlib; matplotlib.use("Agg")
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
S={"surface":"#fcfcfb","ink":"#0b0b0b","ink2":"#52514e","grid":"#e4e4e1"}
|
| 6 |
+
def sty(ax):
|
| 7 |
+
ax.set_facecolor(S["surface"])
|
| 8 |
+
for s in ax.spines.values(): s.set_color(S["grid"])
|
| 9 |
+
ax.grid(True,color=S["grid"],lw=.7,alpha=.9); ax.tick_params(colors=S["ink2"],labelsize=9)
|
| 10 |
+
|
| 11 |
+
BASE={4:{1024:99,4096:89,8192:84,16360:40},
|
| 12 |
+
8:{1024:99,4096:91,8192:88,16360:67,32744:34},
|
| 13 |
+
16:{4096:92,16360:92,32744:54,65512:32},
|
| 14 |
+
32:{4096:91,32744:79,65512:46},
|
| 15 |
+
64:{4096:87,32744:79,65512:75}}
|
| 16 |
+
P1 ={4:{8192:77,16360:42},
|
| 17 |
+
8:{1024:99,4096:88,8192:83,16360:67,32744:36},
|
| 18 |
+
16:{4096:93,16360:90,32744:56,65512:36},
|
| 19 |
+
32:{4096:96,32744:74,65512:52},
|
| 20 |
+
64:{4096:95,32744:90,65512:82}}
|
| 21 |
+
SC=[4,8,16,32,64]
|
| 22 |
+
COL={4:"#b3243b",8:"#eb6834",16:"#d8b52a",32:"#3f9a54",64:"#12508f"}
|
| 23 |
+
PL=[1024,4096,8192,16360,32744,65512]
|
| 24 |
+
|
| 25 |
+
fig,(a,b)=plt.subplots(1,2,figsize=(16.6,6.4),facecolor=S["surface"],sharey=True)
|
| 26 |
+
for ax,D,ttl in ((a,BASE,"base680 (NO long-context training)"),
|
| 27 |
+
(b,P1,"p1final (1,200 steps at 16k)")):
|
| 28 |
+
for s in SC:
|
| 29 |
+
pts=sorted(D[s].items())
|
| 30 |
+
if not pts: continue
|
| 31 |
+
ax.plot([p for p,_ in pts],[v for _,v in pts],"o-",color=COL[s],lw=2.4,ms=8,
|
| 32 |
+
label=f"x{s}",zorder=3)
|
| 33 |
+
ax.plot([p for p,_ in pts],[v for _,v in pts],"o",color="white",ms=3.4,zorder=4)
|
| 34 |
+
sty(ax); ax.set_xscale("log",base=2)
|
| 35 |
+
ax.set_xticks(PL); ax.set_xticklabels(["1k","4k","8k","16k","32k","64k"])
|
| 36 |
+
ax.set_ylim(0,100); ax.set_xlim(900,78000)
|
| 37 |
+
ax.set_xlabel("prompt length (tokens)",color=S["ink2"],fontsize=10.5)
|
| 38 |
+
ax.set_title(ttl,color=S["ink"],fontsize=12,loc="left",pad=10)
|
| 39 |
+
a.set_ylabel("niah_single accuracy (%)",color=S["ink2"],fontsize=10.5)
|
| 40 |
+
a.legend(frameon=False,fontsize=9.5,labelcolor=S["ink2"],loc="lower left",
|
| 41 |
+
title="YARN_SCALE",title_fontsize=9.5,ncol=2)
|
| 42 |
+
a.annotate("every line = same weights,\nonly the RoPE scale differs",xy=(16360,40),xytext=(2100,26),
|
| 43 |
+
fontsize=9,color=S["ink2"],
|
| 44 |
+
arrowprops=dict(arrowstyle="->",color=S["ink2"],lw=1.2,connectionstyle="arc3,rad=0.2"))
|
| 45 |
+
b.annotate("x64 holds up where\nx4 and x8 fall apart",xy=(65512,82),xytext=(20000,20),
|
| 46 |
+
fontsize=9,color="#12508f",ha="center",
|
| 47 |
+
arrowprops=dict(arrowstyle="->",color="#12508f",lw=1.2,
|
| 48 |
+
connectionstyle="arc3,rad=-0.25"))
|
| 49 |
+
fig.text(.005,.005,"Markers are MEASURED points only; lines connect them. Coverage is ragged -- 1,024 and 8,192 were "
|
| 50 |
+
"only ever run at x4/x8, so their curves stop early and their true ceiling at high scale is untested. "
|
| 51 |
+
"N=100 per point, identical haystack, Wilson 95% CI +/-9-13pp.",fontsize=8,color=S["ink2"])
|
| 52 |
+
fig.tight_layout(); fig.savefig("results_2026-09-16/overlay_by_scale.png",dpi=150,bbox_inches="tight")
|
| 53 |
+
print(" wrote results_2026-09-16/overlay_by_scale.png")
|