okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge branch 'f-1402-w' into f-140253623e56f

main
3.5 KiB58 linesraw
1"""Render the four measured configuration points from results.csv."""
2from pathlib import Path
3import csv
4import matplotlib
5matplotlib.use("Agg")
6import matplotlib.pyplot as plt
7from matplotlib.patches import Patch
8
9ROOT = Path(__file__).resolve().parent
10rows = list(csv.DictReader((ROOT / "results.csv").open(encoding="utf-8", newline="")))
11ink, muted, grid = "#162c43", "#506176", "#e4eaf0"
12colors = {"chunk1024": "#9caabe", "chunk8192": "#087f8c"}
13plt.rcParams.update({"font.family": "DejaVu Sans", "font.size": 11,
14                    "text.color": ink, "axes.labelcolor": muted,
15                    "xtick.color": muted, "ytick.color": ink,
16                    "axes.spines.top": False, "axes.spines.right": False,
17                    "axes.spines.left": False, "axes.spines.bottom": False,
18                    "svg.fonttype": "none", "svg.hashsalt": "q8-prefill8192"})
19fig = plt.figure(figsize=(14, 7.8), facecolor="#f7f9fc")
20fig.text(.04, .954, "NATIVE STRATA 0.1.40 / Q8_0 CONFIGURATION EXPERIMENT",
21         fontsize=10, fontweight="bold", color=colors["chunk8192"])
22fig.text(.04, .901, "6.7× faster Q8 prefill", fontsize=31, fontweight="bold")
23fig.text(.04, .862, "1,024 → 8,192-token chunks · Same model and expert cache · FP16 KV · MTP T4",
24         fontsize=13, color=muted)
25fig.legend(handles=[Patch(color=colors["chunk1024"], label="Chunk 1,024"),
26                    Patch(color=colors["chunk8192"], label="Chunk 8,192")],
27           loc="upper right", bbox_to_anchor=(.97, .96), frameon=False, ncol=2)
28gs = fig.add_gridspec(1, 2, left=.15, right=.962, top=.69, bottom=.25, wspace=.35)
29for col, (metric, title) in enumerate([("prefill_seconds", "Prefill time"),
30                                     ("total_seconds", "Whole request, including prefill")]):
31    ax = fig.add_subplot(gs[0, col], facecolor="white")
32    ax.set_title(title + " · lower is faster", loc="left", fontsize=13, fontweight="bold", pad=20)
33    for i, tokens in enumerate([32768, 131072]):
34        for variant, offset in [("chunk1024", -.20), ("chunk8192", .20)]:
35            match = [r for r in rows if int(r["input_tokens"]) == tokens and r["variant"] == variant]
36            assert len(match) == 1
37            value = float(match[0][metric])
38            ax.barh(i+offset, value, height=.32, color=colors[variant], zorder=3)
39            ax.text(value+4, i+offset, f"{value:.2f} s", va="center", fontsize=11)
40    ax.set_yticks([0, 1], ["32K input", "128K input"])
41    ax.set_ylim(1.6, -.6)
42    ax.set_xlim(0, 275)
43    ax.tick_params(axis="both", length=0, pad=10)
44    ax.set_axisbelow(True)
45    ax.grid(axis="x", color=grid, linewidth=.8)
46    ax.set_xlabel("Seconds / request", labelpad=10)
47fig.text(.04, .158, "RTX PRO 6000 Blackwell Workstation 96 GB / 400 W · Ryzen 9 7950X · 128 GB RAM",
48         fontsize=10, fontweight="bold")
49fig.text(.04, .113, "1,024 output tokens per request. Decode remained 143–147 tok/s with the larger chunk. Model loading excluded.",
50         fontsize=10, color=muted)
51fig.text(.04, .073, "Unmodified engine and weights; prefill borrowing disabled. Single observations; output-token differences are recorded.",
52         fontsize=9.5, color=muted)
53fig.text(.04, .035, "Measured 2026-10-06. The faster configuration's hardware profile is in progress.", fontsize=9.5, color=muted)
54for ext in ["png", "svg"]:
55    fig.savefig(ROOT / f"overview.{ext}", dpi=180, facecolor=fig.get_facecolor(),
56                metadata={"Date": None} if ext == "svg" else None)
57svg = ROOT / "overview.svg"
58svg.write_text("\n".join(line.rstrip() for line in svg.read_text().splitlines()) + "\n")