Files
leleka/engine/strata/tools/trellis/pilot_summary.py
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

43 lines
2.0 KiB
Python

"""pilot_summary.py - tables from the jsonl of pilot.py.
python3 tools/trellis/pilot_summary.py pilot1.jsonl
"""
import collections
import json
import math
import sys
rows = [json.loads(l) for l in open(sys.argv[1])]
print("records:", len(rows), "layers:", sorted({r["layer"] for r in rows}), "experts:", sorted({r["expert"] for r in rows}),
"rows per matrix:", sorted({r["rows"] for r in rows}))
print("activation columns are PLACEHOLDERS (iso gaussian / synthetic outlier channels), not calibration data\n")
def db(x):
return -10 * math.log10(x)
def table(keyf, title, cols=("mse", "act_iso", "act_syn")):
g = collections.defaultdict(list)
for r in rows:
g[keyf(r)].append(r)
print(title)
for k in sorted(g):
v = g[k]
print(" %-40s n=%-3d " % (k, len(v)) + " ".join("%s %.4f (%.2f dB)" % (c, sum(x[c] for x in v) / len(v), db(sum(x[c] for x in v) / len(v))) for c in cols))
print()
rate_bpw = {"K4": 1.125, "K5": 1.375, "K6": 1.625, "K7": 1.875}
table(lambda r: "%s %.3f bpw %s" % (r["rate"], rate_bpw[r["rate"]], "hadamard" if r["had"] else "plain "), "mean over everything")
table(lambda r: "%s %s %s" % (r["role"], r["rate"], "had" if r["had"] else "plain"), "by projection")
table(lambda r: "L%02d %s %s" % (r["layer"], r["rate"], "had" if r["had"] else "plain"), "by layer")
# spread of the weight mse across experts for K5 plain
v = [r["mse"] for r in rows if r["rate"] == "K5" and not r["had"]]
print("K5 plain weight mse over all %d matrices: min %.4f max %.4f" % (len(v), min(v), max(v)))
# hadamard gain on the synthetic outlier activations
print("\nHadamard effect on act_syn (relative error, plain / hadamard), per rate")
for rate in ("K4", "K5", "K6", "K7"):
a = [r["act_syn"] for r in rows if r["rate"] == rate and not r["had"]]
b = [r["act_syn"] for r in rows if r["rate"] == rate and r["had"]]
print(" %s plain %.4f had %.4f ratio %.3f" % (rate, sum(a) / len(a), sum(b) / len(b), (sum(a) / len(a)) / (sum(b) / len(b))))