unparallelled commited on
Commit
cf50a09
·
verified ·
1 Parent(s): f63199a

Upload scripts/mk_t64_results.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/mk_t64_results.py +105 -0
scripts/mk_t64_results.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """The 64k extension result. Every number read from the published eval CSVs."""
3
+ import csv,os,sys
4
+ import matplotlib; matplotlib.use("Agg")
5
+ import matplotlib.pyplot as plt
6
+ E=sys.argv[1]
7
+ S={"surface":"#fcfcfb","ink":"#0b0b0b","ink2":"#52514e","grid":"#e4e4e1"}
8
+ BASE,P1,T64="#9dc3ea","#12508f","#b3243b"
9
+ def sty(ax):
10
+ ax.set_facecolor(S["surface"])
11
+ for s in ax.spines.values(): s.set_color(S["grid"])
12
+ ax.grid(True,color=S["grid"],lw=.7,alpha=.9); ax.tick_params(colors=S["ink2"],labelsize=9)
13
+ def rd(n,model,task="niah_single"):
14
+ f=os.path.join(E,n)
15
+ if not os.path.exists(f): return None
16
+ r=list(csv.reader(open(f))); h=r[0]
17
+ for row in r[1:]:
18
+ if row and row[0]==task and model in h:
19
+ try: return float(row[h.index(model)])
20
+ except Exception: return None
21
+ return None
22
+ def depth(n,model):
23
+ f=os.path.join(E,n); out={}
24
+ for r in csv.DictReader(open(f)):
25
+ if r["model"]==model: out[float(r["depth"])]=float(r["pct"])
26
+ return out
27
+
28
+ fig=plt.figure(figsize=(19.4,10.6),facecolor=S["surface"])
29
+ gs=fig.add_gridspec(2,3,hspace=.34,wspace=.26)
30
+ PL=[4096,32744,65512]
31
+ F={4096:"t64ev_x64_4096_summary.csv",32744:"t64ev_x64_32744_summary.csv",65512:"t64ev_x64_65512_summary.csv"}
32
+
33
+ # A -- the headline
34
+ a=fig.add_subplot(gs[0,0]); X=range(len(PL))
35
+ for m,c,lab,mk in ((("base680"),BASE,"base680 (no long-ctx training)","^"),
36
+ ("p1final",P1,"p1final (16k-trained)","s"),("t64",T64,"t64 (64k-trained)","o")):
37
+ ys=[rd(F[p],m) for p in PL]
38
+ a.plot(list(X),ys,f"{mk}-",color=c,lw=2.6,ms=9,label=lab)
39
+ for x,y in zip(X,ys): a.text(x,y+2.2,f"{y:.0f}",ha="center",fontsize=9,color=c,weight="bold")
40
+ sty(a); a.set_xticks(list(X)); a.set_xticklabels(["4k","32k","64k"]); a.set_ylim(60,105)
41
+ a.set_xlabel("prompt length",color=S["ink2"],fontsize=10); a.set_ylabel("niah_single (%)",color=S["ink2"],fontsize=10)
42
+ a.set_title("A. The 64k run: 82 -> 98 at 65,512",color=S["ink"],fontsize=11.5,loc="left",pad=9)
43
+ a.legend(frameon=False,fontsize=8.4,labelcolor=S["ink2"],loc="lower left")
44
+
45
+ # B -- against everything prior at 65,512
46
+ b=fig.add_subplot(gs[0,1])
47
+ names=["1.06B\nown cfg","1.06B\ncorrected","680M\nbase","680M\np1final","680M\nt64"]
48
+ vals=[31,65,75,82,98]; cols=["#b0b0aa","#b0b0aa",BASE,P1,T64]
49
+ bars=b.bar(range(5),vals,color=cols)
50
+ for i,v in enumerate(vals): b.text(i,v+1.8,str(v),ha="center",fontsize=10,color=S["ink2"],weight="bold")
51
+ sty(b); b.set_xticks(range(5)); b.set_xticklabels(names,fontsize=8.2); b.set_ylim(0,110)
52
+ b.set_ylabel("niah_single @65,512 (%)",color=S["ink2"],fontsize=10)
53
+ b.set_title("B. Everything measured at 64k, ever",color=S["ink"],fontsize=11.5,loc="left",pad=9)
54
+ b.axhline(100,color=S["ink2"],ls=":",lw=1)
55
+ b.text(0.1,101.5,"Qwen3-0.6B saturates here (100)",fontsize=7.8,color=S["ink2"],style="italic")
56
+
57
+ # C -- the caveat
58
+ c=fig.add_subplot(gs[0,2])
59
+ tasks=["niah_single","niah_multikey","val_backward"]
60
+ bv=[79,38,4]; pv=[90,39,2]; tv=[99,32,0]; w=.26
61
+ for off,v,col,lab in ((-w,bv,BASE,"base680"),(0,pv,P1,"p1final"),(w,tv,T64,"t64")):
62
+ c.bar([x+off for x in range(3)],v,w,color=col,label=lab)
63
+ sty(c); c.set_xticks(range(3)); c.set_xticklabels(tasks,fontsize=8.6); c.set_ylim(0,105)
64
+ c.set_ylabel("accuracy @32,744 (%)",color=S["ink2"],fontsize=10)
65
+ c.set_title("C. The gain is on the EASY task only",color=S["ink"],fontsize=11.5,loc="left",pad=9)
66
+ c.legend(frameon=False,fontsize=8.4,labelcolor=S["ink2"],loc="upper right")
67
+ c.annotate("t64 7pp BELOW the untrained\nbase (inside CI, but the\ntrajectory agrees)",xy=(1+w,32),xytext=(1.25,58),fontsize=7.6,color=T64,
68
+ arrowprops=dict(arrowstyle="->",color=T64,lw=1.2))
69
+
70
+ # D -- multikey depth: where t64 lost
71
+ d=fig.add_subplot(gs[1,0])
72
+ for m,col,lab in (("base680",BASE,"base680"),("p1final",P1,"p1final"),("t64",T64,"t64")):
73
+ dd=depth("t64ev_hard_32744_depth.csv",m); xs=sorted(dd)
74
+ d.plot(xs,[dd[x] for x in xs],"o-",color=col,lw=2.2,ms=7,label=lab)
75
+ sty(d); d.set_ylim(0,70); d.set_xlabel("needle depth in context",color=S["ink2"],fontsize=10)
76
+ d.set_ylabel("niah_multikey (%)",color=S["ink2"],fontsize=10)
77
+ d.set_title("D. Depth profile -- SUGGESTIVE ONLY, n=40/cell (+/-14pp)",color=S["ink"],fontsize=11.5,loc="left",pad=9)
78
+ d.text(.02,.93,"t64 below p1final at depths 0/0.25/0.5 (3 of 3),\nbut every gap is inside the CI",
79
+ transform=d.transAxes,fontsize=7.8,color=S["ink2"],style="italic",va="top")
80
+ d.legend(frameon=False,fontsize=8.4,labelcolor=S["ink2"],loc="upper left")
81
+
82
+ # E -- trajectory
83
+ e=fig.add_subplot(gs[1,1])
84
+ st=[0,1000,1200]
85
+ e.plot(st,[90,95,99],"o-",color=T64,lw=2.6,ms=9,label="niah_single")
86
+ e.plot(st,[39,31,32],"s--",color="#eb6834",lw=2.6,ms=9,label="niah_multikey")
87
+ sty(e); e.set_ylim(0,105); e.set_xlabel("64k training step (0 = p1final parent)",color=S["ink2"],fontsize=10)
88
+ e.set_ylabel("accuracy @32,744 (%)",color=S["ink2"],fontsize=10)
89
+ e.set_title("E. The trade was complete by step 1000",color=S["ink"],fontsize=11.5,loc="left",pad=9)
90
+ e.legend(frameon=False,fontsize=8.6,labelcolor=S["ink2"],loc="center right")
91
+ for x,y in zip(st,[90,95,99]): e.text(x,y+3,f"{y}",ha="center",fontsize=8.6,color=T64)
92
+ for x,y in zip(st,[39,31,32]): e.text(x,y-7,f"{y}",ha="center",fontsize=8.6,color="#eb6834")
93
+
94
+ # F -- config still matters at inference
95
+ f6=fig.add_subplot(gs[1,2])
96
+ f6.bar([0,1],[41,98],color=["#b0b0aa",T64],width=.55)
97
+ for i,v in enumerate([41,98]): f6.text(i,v+2.5,str(v),ha="center",fontsize=11,color=S["ink2"],weight="bold")
98
+ sty(f6); f6.set_xticks([0,1])
99
+ f6.set_xticklabels(["x16 (as TRAINED)\nvirtual 4,094","x64 (inference)\nvirtual 1,023"],fontsize=9)
100
+ f6.set_ylim(0,112); f6.set_ylabel("t64 niah_single @65,512 (%)",color=S["ink2"],fontsize=10)
101
+ f6.set_title("F. Inference compression still essential: +57pp",color=S["ink"],fontsize=11.5,loc="left",pad=9)
102
+ fig.text(.005,.005,"680M. N=100 per point, greedy, identical haystack (199,754,694 B) across every measurement and every prior session. "
103
+ "Wilson 95% CI +/-9-13pp at N=100 (+/-14pp on the 40-sample depth cells).",fontsize=8,color=S["ink2"])
104
+ fig.savefig("results_2026-09-17/t64_results.png",dpi=150,bbox_inches="tight")
105
+ print(" wrote results_2026-09-17/t64_results.png")