Files
Pavlo RatushnyiandClaude Opus 5.5 84a6817a5a diag(numerics): ladder comparison tools, CPU-expert Original arm, logprob comparators
Results (3 prompts x 41 teacher-forced rows): port vs Original agree exactly
at the embedding and the first GDN half; relL2 of the residual then grows
smoothly with depth (1e-3 after layer 0 FFN, ~1e-2 by layers 8-13, 5-15e-2
by layers 28-44). The Original's own GPU-expert-cache vs CPU-expert arms show
the same profile and the same logprob spread (median 0.287 vs port 0.292).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:57:00 +02:00

26 lines
1.3 KiB
Python

import sys, math
sys.path.insert(0, "/home/para/work/gpu-runs/numerics")
import num_lad_tools as T
N = "/home/para/work/gpu-runs/numerics"
A, B = sys.argv[1], sys.argv[2]
frames = [0,1,2,3,4,8,16,26,40,56,72,88,94,95]
res = {}
for c in ["c0", "c1", "c2"]:
truth = [int(x) for x in open(f"{N}/cases_lad/{c}.ids").read().strip().split(",")] + [int(x) for x in open(f"{N}/cases_lad/{c}.port").read().split()]
aw = T.windows_orig(f"{N}/{A}/serve.err", c); bw = T.windows_orig(f"{N}/{B}/serve.err", c)
av, bv = T.valid_rows(aw, truth), T.valid_rows(bw, truth)
cache = {}
def get(p):
if p not in cache: cache[p] = T.rd(p)
return cache[p]
for pos in sorted(set(av) & set(bv)):
(ai, ak), (bi, bk) = av[pos], bv[pos]
a = get(f"{N}/{A}/l_win{aw[ai][2]:05d}_pos{aw[ai][0]}.f32"); b = get(f"{N}/{B}/l_win{bw[bi][2]:05d}_pos{bw[bi][0]}.f32")
aT, bT = len(aw[ai][1]), len(bw[bi][1])
for fr in frames:
x = a[(fr*aT+ak)*T.W:(fr*aT+ak+1)*T.W]; y = b[(fr*bT+bk)*T.W:(fr*bT+bk+1)*T.W]
d = sum(v*v for v in y)
res.setdefault((c, fr), []).append(math.sqrt(sum((u-v)**2 for u,v in zip(x,y))/d))
for fr in frames:
print("%2d.%d " % (fr//2, fr%2) + " ".join("%s=%.2e" % (c, sorted(res[(c,fr)])[len(res[(c,fr)])//2]) for c in ["c0","c1","c2"] if (c,fr) in res))