Final GPU comparison: hybrid routing matches baseline latency with better APC

Complete 200-req comparison with GPU monitoring:

Config                       TTFT50  TPOT90  E2E50  GPU%  Active  APC
Combined (old cache-aware)    1.012   0.073  5.101  30.5%   64%   44.7%
Combined (hybrid routing)     1.064   0.072  5.131  27.7%   60%   49.4%
PD-Sep 4P+4D                  1.994   0.075  7.112  12.4%   24%   40.2%
PD-Sep 6P+2D                  1.481   0.077  5.949  16.9%   28%   ~37%

Hybrid routing: +4.7pp APC with comparable latency and GPU utilization.
PD-Sep: significantly worse on all dimensions for single-machine agentic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 03:14:05 +08:00
parent 795edc6c66
commit 4bf0b999ff

View File

@@ -0,0 +1,42 @@
"""Final GPU util + latency comparison across all tested configs."""
import csv, json, statistics, os
def gpu_s(path):
rows = list(csv.DictReader(open(path)))
vals = [float(r["util_pct"]) for r in rows]
s = sorted(vals)
p = lambda q: s[min(int(q*len(s)),len(s)-1)]
nz = sum(1 for v in vals if v > 0)
return {"mean": statistics.fmean(vals), "p50": p(.5), "active": nz*100//len(vals)}
def lat_s(path):
rows = [json.loads(l) for l in open(path)]
ok = [r for r in rows if not r.get("error")]
ttfts = sorted([r["ttft_s"] for r in ok if r.get("ttft_s")])
tpots = sorted([r["tpot_s"] for r in ok if r.get("tpot_s") and r["tpot_s"]>0])
lats = sorted([r["latency_s"] for r in ok])
p = lambda v,q: v[min(int(q*len(v)),len(v)-1)] if v else 0
return {"ok": len(ok), "n": len(rows), "t50": p(ttfts,.5), "t90": p(ttfts,.9),
"p50": p(tpots,.5), "p90": p(tpots,.9), "e50": p(lats,.5)}
print("COMPLETE COMPARISON (200 req, time_scale=20, GPU monitoring)")
print("=" * 75)
fmt = "%-25s %6s %8s %8s %8s %7s %7s"
print(fmt % ("Config", "OK/N", "TTFT50", "TPOT90", "E2E50", "GPU%", "Active"))
print("-" * 75)
for d, label in [
("gpu_ab_combined", "Combined (old cache-aware)"),
("gpu_ab_hybrid", "Combined (hybrid routing)"),
("gpu_ab_pdsep", "PD-Sep 4P+4D"),
("gpu_ab_6p2d", "PD-Sep 6P+2D"),
]:
gp = "outputs/%s/gpu_util.csv" % d
mp = "outputs/%s/metrics.jsonl" % d
if not os.path.exists(gp) or not os.path.exists(mp):
continue
g = gpu_s(gp)
l = lat_s(mp)
print(fmt % (label, "%d/%d" % (l["ok"],l["n"]),
"%.3f" % l["t50"], "%.3f" % l["p90"], "%.3f" % l["e50"],
"%.1f" % g["mean"], "%d%%" % g["active"]))