"""Static PNG charts for the HF write-up. Run: python make_charts.py (from hf-draft/).""" import csv, statistics as st, pathlib import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt HERE = pathlib.Path(__file__).resolve().parent OUT = HERE / "charts"; OUT.mkdir(exist_ok=True) # Reference palette (dataviz skill), slots 1-3 in fixed order, light mode. SURFACE, INK, INK2, GRID = "#fcfcfb", "#0b0b0b", "#52514e", "#e4e3df" MODELS = ["Qwen3.8-Flash-Next", "Inkling-2-Mini", "Qwen3.8-27B"] COLOR = {"Qwen3.8-Flash-Next": "#2a78d6", "Inkling-2-Mini": "#eb6834", "Qwen3.8-27B": "#1baf7a"} LABEL = {"Qwen3.8-Flash-Next": "Qwen3.8 Flash Next", "Inkling-2-Mini": "Inkling 2 Mini", "Qwen3.8-27B": "Qwen3.8-27B"} plt.rcParams.update({ "figure.facecolor": SURFACE, "axes.facecolor": SURFACE, "savefig.facecolor": SURFACE, "font.family": "DejaVu Sans", "font.size": 11, "text.color": INK, "axes.labelcolor": INK2, "xtick.color": INK2, "ytick.color": INK2, "axes.edgecolor": GRID, "axes.spines.top": False, "axes.spines.right": False, "axes.titlelocation": "left", "axes.titlesize": 13, "axes.titleweight": "bold", }) def style(ax, grid_axis="x"): ax.grid(axis=grid_axis, color=GRID, linewidth=0.8) ax.set_axisbelow(True) ax.spines["left"].set_visible(False) ax.tick_params(length=0) def title(fig, text): fig.text(0.01, 0.98, text, fontsize=13, fontweight="bold", color=INK, ha="left", va="top") def note(fig, text): fig.text(0.01, 0.01, text, fontsize=9, color=INK2, ha="left", va="bottom") rows = list(csv.DictReader(open(HERE / "results/sequential_runs.csv"))) # 1. Minutes per ticket, every run as a dot (dot plot, 3 series, legend + direct labels). tasks = ["T1_feature", "T2_refactor", "T3_bugfix", "T4_endpoint"] tnames = {"T1_feature": "T1 feature", "T2_refactor": "T2 refactor", "T3_bugfix": "T3 bug fix", "T4_endpoint": "T4 endpoint"} fig, ax = plt.subplots(figsize=(8, 4.2)) offs = {"Qwen3.8-Flash-Next": -0.2, "Inkling-2-Mini": 0.0, "Qwen3.8-27B": 0.2} for m in MODELS: for i, t in enumerate(tasks): xs = [int(r["wall_seconds"]) / 60 for r in rows if r["model"] == m and r["task"] == t] ax.scatter(xs, [i + offs[m]] * len(xs), s=70, color=COLOR[m], edgecolor=SURFACE, linewidth=2, zorder=3, label=LABEL[m] if i == 0 else None) ax.set_yticks(range(len(tasks)), [tnames[t] for t in tasks]) ax.invert_yaxis() ax.set_xlim(0, 11.5) ax.set_xlabel("Minutes per ticket (one dot per run)") title(fig, "One agent per ticket: Flash Next was about twice as fast") style(ax) ax.legend(frameon=False, loc="lower right", fontsize=10) note(fig, "2 runs per model and ticket. All 24 runs passed all hidden tests.") fig.tight_layout(rect=(0, 0.04, 1, 0.93)) fig.savefig(OUT / "time_per_ticket.png", dpi=200) # 2. Wall-clock for all four tickets: sequential vs four agents at once. items = [ ("Flash Next, 1 agent", 8.1, "Qwen3.8-Flash-Next", False), ("Inkling, 1 agent", 17.3, "Inkling-2-Mini", False), ("Qwen3.8-27B, 1 agent", 20.1, "Qwen3.8-27B", False), ("Inkling, 4 agents in parallel", 25.8, "Inkling-2-Mini", True), ] fig, ax = plt.subplots(figsize=(8, 3.4)) for i, (lab, v, m, par) in enumerate(items): ax.barh(i, v, height=0.55, color=COLOR[m], hatch="///" if par else None, edgecolor=SURFACE, linewidth=2) ax.text(v + 0.4, i, f"{v:.1f} min", va="center", fontsize=10, color=INK) ax.set_yticks(range(len(items)), [x[0] for x in items]) ax.invert_yaxis() ax.set_xlim(0, 30) ax.set_xlabel("Minutes to finish all 4 tickets") title(fig, "Four agents at once were slower than one agent in a row") style(ax) note(fig, "Sequential = run 1 of each model. Parallel = one batch, Inkling only.") fig.tight_layout(rect=(0, 0.05, 1, 0.91)) fig.savefig(OUT / "parallel_vs_sequential.png", dpi=200) # 3. Prefill throughput, 1 vs 4 agents (one series, no legend). fig, ax = plt.subplots(figsize=(8, 2.6)) vals = [("1 agent", 380), ("4 agents at once", 110)] for i, (lab, v) in enumerate(vals): ax.barh(i, v, height=0.5, color=COLOR["Inkling-2-Mini"], hatch="///" if i else None, edgecolor=SURFACE, linewidth=2) ax.text(v + 6, i, f"~{v} tok/s", va="center", fontsize=10) ax.set_yticks(range(2), [v[0] for v in vals]) ax.invert_yaxis() ax.set_xlim(0, 450) ax.set_xlabel("Prompt processing speed per request (tokens/s)") title(fig, "Inkling 2 Mini: prefill dropped ~3.5x with four agents") style(ax) note(fig, "From llama-server logs. 31 requests (1 agent), 23 requests (4 agents, 105-124 tok/s).") fig.tight_layout(rect=(0, 0.07, 1, 0.88)) fig.savefig(OUT / "prefill_under_load.png", dpi=200) # 4. Inkling memory vs context (single series line). ctx = [131, 262, 524]; gb = [43.1, 62.3, 100.7] fig, ax = plt.subplots(figsize=(8, 3.4)) ax.plot(ctx, gb, color=COLOR["Inkling-2-Mini"], linewidth=2, zorder=2) ax.scatter(ctx, gb, s=70, color=COLOR["Inkling-2-Mini"], edgecolor=SURFACE, linewidth=2, zorder=3) for x, y in zip(ctx, gb): ax.annotate(f"{y:.0f} GB", (x, y), textcoords="offset points", xytext=(0, 10), ha="center", fontsize=10) ax.axhline(128, color=INK2, linewidth=1, linestyle=(0, (4, 3))) ax.text(105, 130, "128 GB machine", fontsize=9, color=INK2, va="bottom") ax.set_xticks(ctx, ["131k", "262k", "524k"]) ax.set_xlim(100, 560); ax.set_ylim(0, 140); ax.set_yticks([0, 25, 50, 75, 100]) ax.set_xlabel("Total context (shared by 4 slots, q8_0 K/V)") ax.set_ylabel("Wired memory (GB)") title(fig, "Inkling 2 Mini needs a lot of memory for long context") style(ax, grid_axis="y"); ax.spines["left"].set_visible(True) note(fig, "About 146 KB per token on top of ~24 GB for weights, drafter and buffers.") fig.tight_layout(rect=(0, 0.05, 1, 0.91)) fig.savefig(OUT / "inkling_memory.png", dpi=200) print("ok", sorted(p.name for p in OUT.iterdir()))