Files
xpu-llm-ports/lfm3/results/vl/bb_vl_graphs.html
T
Pascal LinxweilerandClaude Opus 5.5 1834792bb8 lfm3: add INT4, FP8 per-channel and VL notes, tests, eval and results
Sync the repo with the working directory: full NOTES.md (rounds 4-5, LFM3-VL),
VL tests and test images, quality eval, AutoRound W4A16 quantization scripts
and calibration recipe, the variant.sh MODEL/DOCKER_ENV options, and the
remaining benchmark results. Large regenerable artifacts (INT4 checkpoint,
ref_vl.pt, raw logprob dumps) stay out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 13:59:43 +01:00

511 lines
31 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BetterBench — lfm3-vl-2b</title>
<style>
:root {
color-scheme: light;
--page:#f9f9f7; --surface:#fcfcfb;
--ink:#0b0b0b; --ink-2:#52514e; --muted:#898781;
--grid:#e1e0d9; --axis:#c3c2b7; --border:rgba(11,11,11,0.10);
--s1:#2a78d6; --s2:#eb6834;
--s1-mid:#86b6ef; --s1-soft:rgba(42,120,214,0.13);
--tip-bg:#ffffff;
--sans:system-ui,-apple-system,"Segoe UI",sans-serif;
--mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--page:#0d0d0d; --surface:#1a1a19;
--ink:#ffffff; --ink-2:#c3c2b7; --muted:#898781;
--grid:#2c2c2a; --axis:#383835; --border:rgba(255,255,255,0.10);
--s1:#3987e5; --s2:#d95926;
--s1-mid:#256abf; --s1-soft:rgba(57,135,229,0.16);
--tip-bg:#232322;
}
}
:root[data-theme="dark"] {
color-scheme: dark;
--page:#0d0d0d; --surface:#1a1a19;
--ink:#ffffff; --ink-2:#c3c2b7; --muted:#898781;
--grid:#2c2c2a; --axis:#383835; --border:rgba(255,255,255,0.10);
--s1:#3987e5; --s2:#d95926;
--s1-mid:#256abf; --s1-soft:rgba(57,135,229,0.16);
--tip-bg:#232322;
}
* { box-sizing:border-box; }
body { background:var(--page); color:var(--ink); font-family:var(--sans);
line-height:1.55; margin:0; padding:32px 20px 72px; }
.wrap { max-width:1080px; margin:0 auto; display:flex; flex-direction:column; gap:26px; }
header { display:flex; flex-direction:column; gap:13px; }
.eyebrow { font-family:var(--mono); font-size:11px; letter-spacing:.13em;
text-transform:uppercase; color:var(--muted); }
h1 { font-size:clamp(26px,4vw,36px); line-height:1.12; margin:0;
letter-spacing:-.02em; text-wrap:balance; }
.runbar { display:flex; flex-wrap:wrap; gap:8px; }
.chip { font-family:var(--mono); font-size:12px; color:var(--ink-2);
border:1px solid var(--border); border-radius:6px; padding:4px 9px;
background:var(--surface); display:inline-flex; align-items:center; gap:7px; }
.chip code { font-family:var(--mono); font-size:12px; }
.swatch { width:9px; height:9px; border-radius:2px; flex:none; }
.thin { color:var(--muted); cursor:help; font-weight:400; padding-left:1px; }
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:13px; }
.tile { background:var(--surface); border:1px solid var(--border); border-radius:10px;
padding:15px 16px; display:flex; flex-direction:column; gap:4px; }
.tile .label { font-family:var(--mono); font-size:10.5px; letter-spacing:.1em;
text-transform:uppercase; color:var(--muted); }
.tile .val { font-size:26px; font-weight:600; letter-spacing:-.02em; line-height:1.15; }
.tile .val small { font-size:14px; font-weight:400; color:var(--ink-2); letter-spacing:0; }
.tile .sub { font-family:var(--mono); font-size:11.5px; color:var(--muted); }
figure { margin:0; background:var(--surface); border:1px solid var(--border);
border-radius:10px; padding:18px 18px 14px;
display:flex; flex-direction:column; gap:2px; }
figcaption { display:flex; flex-direction:column; gap:3px; margin-bottom:8px; }
figcaption .t { font-size:15.5px; font-weight:600; letter-spacing:-.01em; }
figcaption .d { font-size:13px; color:var(--ink-2); max-width:76ch; }
.legend { display:flex; gap:16px; flex-wrap:wrap; margin:2px 0 10px; }
.legend span { font-family:var(--mono); font-size:12px; color:var(--ink-2);
display:inline-flex; align-items:center; gap:6px; }
.chartbox { position:relative; width:100%; }
.chartbox svg { display:block; width:100%; height:auto; overflow:visible; }
.note { font-size:12.5px; color:var(--muted); margin:9px 0 0; }
text { font-family:var(--mono); }
.tick { font-size:10.5px; fill:var(--muted); }
.axtitle { font-size:10.5px; fill:var(--muted); letter-spacing:.08em; }
.dlabel { font-size:11px; font-weight:600; }
.gridline { stroke:var(--grid); stroke-width:1; }
.baseline { stroke:var(--axis); stroke-width:1; }
.refline { stroke:var(--muted); stroke-width:1; stroke-dasharray:4 4; }
.cross { stroke:var(--axis); stroke-width:1; stroke-dasharray:3 3; }
.tip { position:absolute; pointer-events:none; opacity:0; transition:opacity .1s ease;
z-index:5; background:var(--tip-bg); border:1px solid var(--border);
border-radius:7px; padding:8px 10px; box-shadow:0 3px 14px rgba(0,0,0,.13);
font-family:var(--mono); font-size:11.5px; color:var(--ink);
white-space:nowrap; min-width:132px; }
.tip .th { color:var(--muted); font-size:10px; letter-spacing:.08em;
text-transform:uppercase; margin-bottom:5px; }
.tip .row { display:flex; align-items:center; gap:10px; justify-content:space-between; }
.tip .nm { display:inline-flex; align-items:center; gap:6px; color:var(--ink-2); }
.tip b { font-weight:600; }
details { background:var(--surface); border:1px solid var(--border);
border-radius:10px; padding:0 18px; }
summary { cursor:pointer; padding:15px 0; font-size:14.5px; font-weight:600;
list-style:none; display:flex; align-items:center; gap:9px; }
summary::-webkit-details-marker { display:none; }
summary::before { content:"\25B8"; color:var(--muted); font-family:var(--mono); }
details[open] summary::before { content:"\25BE"; }
summary:focus-visible { outline:2px solid var(--s1); outline-offset:3px; border-radius:4px; }
.tscroll { overflow-x:auto; padding-bottom:14px; }
table { border-collapse:collapse; width:100%; font-size:12.5px; font-family:var(--mono);
font-variant-numeric:tabular-nums; margin-bottom:10px; }
caption { text-align:left; font-family:var(--sans); font-size:13px; color:var(--ink-2);
padding:10px 0 8px; }
th, td { padding:6px 11px 6px 0; text-align:right; white-space:nowrap; }
th:first-child, td:first-child { text-align:left; }
thead th { color:var(--muted); font-weight:500; font-size:10.5px; letter-spacing:.07em;
text-transform:uppercase; border-bottom:1px solid var(--axis); }
tbody tr + tr td { border-top:1px solid var(--grid); }
tbody td:first-child { color:var(--ink-2); }
footer { font-size:12.5px; color:var(--muted); border-top:1px solid var(--border);
padding-top:16px; }
footer code { font-family:var(--mono); font-size:12px; color:var(--ink-2); }
noscript p { font-size:13px; color:var(--ink-2); }
@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="eyebrow">BetterBench 0.6.1 · 29 Oct 2026 · 10:46 · llm</div>
<h1>lfm3-vl-2b</h1>
<div class="runbar"><span class="chip"><span class="swatch" style="background:var(--s1)"></span>lfm3-vl-2b</span><span class="chip"><code>http://127.0.0.1:8002/v1</code></span><span class="chip">corpus v1.0</span><span class="chip">5 passes/cat</span><span class="chip">temp 0.7</span><span class="chip">cold prefix cache (nonce)</span><span class="chip">32,768 tok context</span><span class="chip"><span class="swatch" style="background:var(--s2)"></span>variant: vl-graphs-bf16</span></div>
</header>
<section class="tiles">
<div class="tile">
<span class="label">Combined decode</span>
<span class="val">127.4 <small>t/s</small></span>
<span class="sub">weighted across categories</span>
</div>
<div class="tile">
<span class="label">Combined ITL 1% low</span>
<span class="val">101.7 <small>t/s</small></span>
<span class="sub">the trustworthy tail metric</span>
</div>
<div class="tile">
<span class="label">Combined TTFT p50</span>
<span class="val">65 <small>ms</small></span>
<span class="sub">single-stream, batch = 1</span>
</div>
<div class="tile">
<span class="label">Aggregate @ 8 concurrent</span>
<span class="val">757.7 <small>t/s</small></span>
<span class="sub">48/48 ok</span>
</div>
<div class="tile">
<span class="label">Prefill @ 32,000 tok</span>
<span class="val">16,562 <small>t/s</small></span>
<span class="sub">median prompt processing</span>
</div>
</section>
<noscript><p>Charts need JavaScript — the full numbers are in the tables below.</p></noscript>
<figure>
<figcaption>
<span class="t">Decode throughput by category</span>
<span class="d">Median per-pass decode t/s at batch = 1, 5 passes per category. The dashed line is the weighted combined score.</span>
</figcaption>
<div class="chartbox" id="cb-decode"></div>
<p class="note">Hover a bar for its IQR and coefficient of variation — a high CV means the category's passes disagree, so read small differences there with care.</p>
</figure>
<figure>
<figcaption>
<span class="t">Inter-token latency range by category</span>
<span class="d">Each bar spans the 1% low to the 99% high instantaneous token rate, with a tick at the median. Wide bars stutter; narrow bars feel smooth.</span>
</figcaption>
<div class="legend"><span><span class="swatch" style="background:var(--s1-mid)"></span>1% low → 99% high</span><span><span class="swatch" style="background:var(--ink)"></span>median</span></div>
<div class="chartbox" id="cb-itl"></div>
</figure>
<figure>
<figcaption>
<span class="t">Aggregate throughput under concurrency</span>
<span class="d">Total tokens/sec across all in-flight requests as load rises — where this flattens is the throughput knee.</span>
</figcaption>
<div class="chartbox" id="cb-conc"></div>
</figure>
<figure>
<figcaption>
<span class="t">Time-to-first-token under concurrency</span>
<span class="d">Queueing shows up here first: p50 is the typical wait, p99 the tail.</span>
</figcaption>
<div class="legend"><span><span class="swatch" style="background:var(--s1)"></span>TTFT p50</span><span><span class="swatch" style="background:var(--s2)"></span>TTFT p99</span></div>
<div class="chartbox" id="cb-ttft"></div>
<p class="note">With a modest request count per level, p99 rests on very few observations — treat a spike as a prompt to re-run, not a conclusion.</p>
</figure>
<figure>
<figcaption>
<span class="t">Prompt processing throughput by depth</span>
<span class="d">Median prefill t/s (prompt tokens ÷ TTFT) at increasing input depth, cold prefix cache. The band spans the 1% low to the 99% high.</span>
</figcaption>
<div class="chartbox" id="cb-prefill"></div>
<p class="note">Skipped depth 64,000 — deeper than the model's context window.</p>
</figure>
<details open>
<summary>Full numbers</summary>
<div class="tscroll">
<table>
<caption>Single-stream, batch = 1</caption>
<thead><tr><th>category</th><th>passes</th><th>TTFT p50</th><th>TTFT p99</th><th>ITL 1% low</th><th>ITL med</th><th>ITL 99% high</th><th>decode med</th><th>±IQR</th><th>CV</th></tr></thead>
<tbody>
<tr><td>chat</td><td>5</td><td>64.9</td><td>73.2<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>95.9</td><td>127.8</td><td>150.0</td><td>127.6</td><td>0.5</td><td>0.5%</td></tr>
<tr><td>code</td><td>5</td><td>65.6</td><td>76.3<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>106.0</td><td>127.3</td><td>139.5</td><td>127.3</td><td>0.3</td><td>0.3%</td></tr>
<tr><td>file edit</td><td>5</td><td>63.6</td><td>66.1<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>105.1</td><td>127.4</td><td>143.4</td><td>127.3</td><td>0.2</td><td>0.1%</td></tr>
<tr><td>json</td><td>5</td><td>65.8</td><td>68.6<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>96.4</td><td>127.8</td><td>145.8</td><td>127.8</td><td>0.5</td><td>0.4%</td></tr>
<tr><td>math</td><td>5</td><td>60.9</td><td>66.7<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>84.6</td><td>127.4</td><td>148.1</td><td>126.8</td><td>0.4</td><td>0.8%</td></tr>
<tr><td>prose</td><td>5</td><td>65.4</td><td>91.9<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>94.9</td><td>127.2</td><td>144.7</td><td>127.5</td><td>1.1</td><td>0.5%</td></tr>
<tr><td>reasoning</td><td>5</td><td>62.7</td><td>66.7<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>101.2</td><td>127.2</td><td>141.6</td><td>127.1</td><td>0.1</td><td>0.4%</td></tr>
<tr><td>summarization</td><td>5</td><td>66.6</td><td>95.8<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>104.9</td><td>127.7</td><td>148.0</td><td>127.9</td><td>0.9</td><td>0.5%</td></tr>
</tbody>
</table>
<table>
<caption>Concurrency sweep</caption>
<thead><tr><th>level</th><th>ok/req</th><th>aggregate t/s</th><th>TTFT p50</th><th>TTFT p99</th><th>per-req decode med</th></tr></thead>
<tbody>
<tr><td>1</td><td>48/48</td><td>125.2</td><td>64.2</td><td>91.8<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>127.4</td></tr>
<tr><td>2</td><td>48/48</td><td>239.2</td><td>70.4</td><td>1,010.2<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>125.3</td></tr>
<tr><td>4</td><td>48/48</td><td>446.4</td><td>71.7</td><td>133.6<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>121.2</td></tr>
<tr><td>8</td><td>48/48</td><td>757.7</td><td>83.6</td><td>145.3<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>115.1</td></tr>
</tbody>
</table>
<table>
<caption>Reasoning / answer split · TTFA is time to the first answer token</caption>
<thead><tr><th>category</th><th>runs w/ split</th><th>reasoning share (est)</th><th>TTFA p50 (ms)</th><th>never reached answer</th></tr></thead>
<tbody>
<tr><td>chat</td><td>5/5</td><td>100%</td><td>—</td><td>4/5</td></tr>
<tr><td>code</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>file edit</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>json</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>math</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>prose</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>reasoning</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
<tr><td>summarization</td><td>5/5</td><td>100%</td><td>—</td><td>5/5</td></tr>
</tbody>
</table>
<table>
<caption>Prefill sweep · cold prefix cache</caption>
<thead><tr><th>target depth</th><th>prompt tok med</th><th>TTFT p50</th><th>PP 1% low</th><th>PP median</th><th>PP 99% high</th></tr></thead>
<tbody>
<tr><td>2,000</td><td>1,507</td><td>98.5</td><td>14,569.0<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>15,281.0</td><td>15,534.6<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td></tr>
<tr><td>8,000</td><td>5,924</td><td>323.3</td><td>17,976.6<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>18,295.0</td><td>18,389.5<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td></tr>
<tr><td>16,000</td><td>11,827</td><td>663.6</td><td>17,721.4<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>17,821.3</td><td>17,916.6<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td></tr>
<tr><td>32,000</td><td>23,552</td><td>1,420.1</td><td>16,484.4<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td><td>16,562.5</td><td>16,812.3<span class="thin" title="under-sampled percentile — see the note below the tables">†</span></td></tr>
<tr><td>64,000</td><td>—</td><td>—</td><td>—</td><td><em>skipped</em></td><td>—</td></tr>
</tbody>
</table>
</div>
</details>
<footer>Generated by BetterBench 0.6.1 from a corpus v1.0 run. Corpus hash <code>e332dceff176d033</code>. Combined-score weights — code 0.3, reasoning 0.2, prose 0.15, json 0.15, file_edit 0.1, summarization 0.1. Results are only comparable within a corpus version. Stopped at <code>max_tokens</code>: 40/40 runs (100%) — on a thinking model a truncated run measures the thinking phase, not a complete answer. 16 percentiles are marked † — they rest on fewer samples than <code>n · tail ≥ 5</code> requires (a p99 needs 500 observations), so read them as roughly the worst observed rather than as percentiles. The full list is under <code>sample_gate</code> in the results JSON. See METHODOLOGY.md §sample-size.</footer>
</div>
<script>
"use strict";
const D = {"cats": ["chat", "code", "file edit", "json", "math", "prose", "reasoning", "summarization"], "runs": [5, 5, 5, 5, 5, 5, 5, 5], "decode": [127.60807131162622, 127.3370459279194, 127.31520273904032, 127.84533114136559, 126.79386639093369, 127.474274453722, 127.1318219478855, 127.87686421005907], "decodeIqr": [0.5425787063894916, 0.28337506316158567, 0.1840750856554081, 0.5115772194949386, 0.37488020052114734, 1.0701683733897625, 0.11745366549338598, 0.9149975704852977], "cv": [0.5235704592146113, 0.2802590679046288, 0.08803571300487634, 0.3671450153611078, 0.8305546125535865, 0.5370444052420437, 0.4145387480106005, 0.5090423741273657], "itlLow": [95.92208069361413, 105.96202890914128, 105.08845349410367, 96.43818330508167, 84.61119432258201, 94.86113674542166, 101.22509494681834, 104.91969915946615], "itlMed": [127.82806832984937, 127.33218441967537, 127.40064218514232, 127.78225084122228, 127.42272006934934, 127.23114112904732, 127.21914715838584, 127.74784008350817], "itlHigh": [149.99469937498543, 139.47379118040382, 143.42030320308646, 145.8490090838767, 148.09008487732407, 144.72584599766358, 141.60525531098173, 148.0231983444596], "batched": false, "updP50": [7.823007999832043, 7.853474002331495, 7.849253997846972, 7.825813001545612, 7.847893997677602, 7.859711004130077, 7.86045200220542, 7.827920999261551], "updP99": [9.399741369343241, 8.568195801053662, 8.994509799522348, 8.940709199232515, 9.825147198134804, 9.243316057836621, 8.911724999488797, 9.022165115748061], "tokPerUpd": [1.000893655049151, 1.0006901311249137, 1.0, 1.0, 1.0, 1.0, 1.0007278020378456, 1.0], "ttft50": [64.92730999889318, 65.57760199939366, 63.62665600317996, 65.84280699462397, 60.852135000459384, 65.43142600276042, 62.66281600255752, 66.61640799575252], "combined": 127.444625702126, "conc": {"levels": [1, 2, 4, 8], "agg": [125.20790016211313, 239.17971302048667, 446.3918365624121, 757.7078175607977], "t50": [64.18165850118385, 70.36269499803893, 71.72885400359519, 83.55733200369286], "t99": [91.83884059239062, 1010.2238462681271, 133.61575862407335, 145.29173109935073], "per": [127.38407302347396, 125.2526232664768, 121.15785403713235, 115.06178071414757], "ok": [48, 48, 48, 48], "req": [48, 48, 48, 48]}, "pre": {"depths": [2000, 8000, 16000, 32000], "tok": [1507.0, 5924.5, 11827.0, 23551.5], "low": [14568.952386231807, 17976.55133226179, 17721.41809467632, 16484.419977904607], "med": [15281.021955044806, 18295.008152795883, 17821.335748831254, 16562.45712236422], "high": [15534.628683323175, 18389.538160557833, 17916.610323007702, 16812.345772433844], "t50": [98.51042049922398, 323.3109009997861, 663.5820969968336, 1420.1147649982886]}};
const NS = "http://www.w3.org/2000/svg";
const el = (n, a) => { const e = document.createElementNS(NS, n);
for (const k in a) e.setAttribute(k, a[k]); return e; };
const fmt = (v, d) => (v === null || v === undefined) ? "—"
: v.toLocaleString("en-US", { minimumFractionDigits: d, maximumFractionDigits: d });
const has = v => v !== null && v !== undefined;
const maxOf = arrs => Math.max(...arrs.flat().filter(has));
const niceTop = v => { if (!(v > 0)) return 1;
const p = Math.pow(10, Math.floor(Math.log10(v)) - 1);
return Math.ceil(v / (2 * p)) * 2 * p; };
const box = id => document.getElementById(id);
function mkTip(b) { const t = document.createElement("div"); t.className = "tip";
b.appendChild(t); return t; }
function showTip(tip, b, x, y, html) {
tip.innerHTML = html; tip.style.opacity = "1";
let left = x + 14;
if (left + tip.offsetWidth > b.clientWidth) left = x - tip.offsetWidth - 14;
tip.style.left = Math.max(0, left) + "px";
tip.style.top = Math.max(0, y - tip.offsetHeight - 10) + "px";
}
const row = (color, name, val) =>
`<div class="row"><span class="nm">${color
? `<span class="swatch" style="background:${color}"></span>` : ""}${name}</span><b>${val}</b></div>`;
function frame(svg, M, iw, ih, yMin, yMax, yTitle, ticks) {
for (let k = 0; k <= (ticks || 4); k++) {
const v = yMin + ((yMax - yMin) * k) / (ticks || 4);
const y = M.t + ih - (ih * (v - yMin)) / (yMax - yMin);
svg.appendChild(el("line", { x1: M.l, x2: M.l + iw, y1: y, y2: y, class: "gridline" }));
const tx = el("text", { x: M.l - 10, y: y + 3.5, class: "tick", "text-anchor": "end" });
tx.textContent = fmt(v, v < 10 ? 1 : 0); svg.appendChild(tx);
}
svg.appendChild(el("line", { x1: M.l, x2: M.l + iw, y1: M.t + ih, y2: M.t + ih, class: "baseline" }));
const ay = el("text", { x: M.l, y: M.t - 7, class: "axtitle" });
ay.textContent = yTitle; svg.appendChild(ay);
}
function xLabels(svg, labels, X, y) {
labels.forEach((lab, i) => {
const t = el("text", { x: X(i), y: y, class: "tick", "text-anchor": "middle" });
t.textContent = lab; svg.appendChild(t);
});
}
/* --- grouped / single bars, zero-based --- */
function bars(id, o) {
const b = box(id); if (!b) return;
const W = 900, H = o.height || 340, M = { t: 20, r: 16, b: 50, l: 64 };
const iw = W - M.l - M.r, ih = H - M.t - M.b;
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": o.aria });
const n = o.x.length, yMax = o.yMax;
const Y = v => M.t + ih - (ih * v) / yMax;
frame(svg, M, iw, ih, 0, yMax, o.yTitle);
const band = iw / n, ns = o.series.length, GAP = 2;
const bw = Math.min(40, (band - 24 - GAP * (ns - 1)) / ns);
xLabels(svg, o.x, i => M.l + band * i + band / 2, M.t + ih + 20);
if (has(o.ref)) {
const y = Y(o.ref);
svg.appendChild(el("line", { x1: M.l, x2: M.l + iw, y1: y, y2: y, class: "refline" }));
const t = el("text", { x: M.l + iw, y: y - 6, class: "tick", "text-anchor": "end" });
t.textContent = o.refLabel; svg.appendChild(t);
}
const tip = mkTip(b);
o.x.forEach((lab, i) => {
const cx = M.l + band * i + band / 2;
const start = cx - (ns * bw + (ns - 1) * GAP) / 2;
o.series.forEach((s, si) => {
const v = s.v[i]; if (!has(v)) return;
const x = start + si * (bw + GAP);
const r = el("rect", { x: x, y: Y(v), width: bw, height: Math.max(2, ih - (Y(v) - M.t)),
rx: 4, ry: 4, fill: s.color });
r.style.cursor = "crosshair";
const html = `<div class="th">${lab}</div>` +
o.series.map(q => row(ns > 1 ? q.color : null, q.name, o.tipVal(q.v[i]))).join("") +
(o.extra ? o.extra(i) : "");
r.addEventListener("pointerenter", () => {
const rc = svg.getBoundingClientRect();
showTip(tip, b, ((x + bw / 2) / W) * rc.width, (Y(v) / H) * rc.height, html);
});
r.addEventListener("pointerleave", () => { tip.style.opacity = "0"; });
svg.appendChild(r);
});
});
b.appendChild(svg);
}
/* --- floating range bars with a median tick --- */
function rangeBars(id, o) {
const b = box(id); if (!b) return;
const W = 900, H = 340, M = { t: 20, r: 16, b: 50, l: 64 };
const iw = W - M.l - M.r, ih = H - M.t - M.b;
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": o.aria });
const n = o.x.length, yMax = o.yMax;
const Y = v => M.t + ih - (ih * v) / yMax;
frame(svg, M, iw, ih, 0, yMax, o.yTitle);
const band = iw / n, bw = Math.min(34, band - 26);
xLabels(svg, o.x, i => M.l + band * i + band / 2, M.t + ih + 20);
const tip = mkTip(b);
o.x.forEach((lab, i) => {
const lo = o.low[i], hi = o.high[i], md = o.med[i];
if (!has(lo) || !has(hi)) return;
const cx = M.l + band * i + band / 2, x = cx - bw / 2;
const r = el("rect", { x: x, y: Y(hi), width: bw, height: Math.max(3, Y(lo) - Y(hi)),
rx: 4, ry: 4, fill: "var(--s1-mid)" });
r.style.cursor = "crosshair";
svg.appendChild(r);
if (has(md)) svg.appendChild(el("line", { x1: x, x2: x + bw, y1: Y(md), y2: Y(md),
stroke: "var(--ink)", "stroke-width": 2 }));
const html = `<div class="th">${lab}</div>` +
row(null, "99% high", o.tipVal(hi)) + row(null, "median", o.tipVal(md)) +
row(null, "1% low", o.tipVal(lo)) + (o.extra ? o.extra(i) : "");
r.addEventListener("pointerenter", () => {
const rc = svg.getBoundingClientRect();
showTip(tip, b, (cx / W) * rc.width, (Y(hi) / H) * rc.height, html);
});
r.addEventListener("pointerleave", () => { tip.style.opacity = "0"; });
});
b.appendChild(svg);
}
/* --- line chart with optional band --- */
function line(id, o) {
const b = box(id); if (!b) return;
const W = 900, H = 320, M = { t: 20, r: 24, b: 52, l: 64 };
const iw = W - M.l - M.r, ih = H - M.t - M.b;
const svg = el("svg", { viewBox: `0 0 ${W} ${H}`, role: "img", "aria-label": o.aria });
const n = o.x.length, yMin = o.yMin, yMax = o.yMax;
const X = i => M.l + (n === 1 ? iw / 2 : (iw * i) / (n - 1));
const Y = v => M.t + ih - (ih * (v - yMin)) / (yMax - yMin);
frame(svg, M, iw, ih, yMin, yMax, o.yTitle);
xLabels(svg, o.x, X, M.t + ih + 20);
if (o.xTitle) {
const t = el("text", { x: M.l, y: H - 8, class: "axtitle" });
t.textContent = o.xTitle; svg.appendChild(t);
}
if (o.band && o.band.low.every(has) && o.band.high.every(has)) {
const up = o.band.high.map((v, i) => (i ? "L" : "M") + X(i) + " " + Y(v)).join(" ");
const dn = o.band.low.map((v, i) => "L" + X(n - 1 - i) + " " + Y(o.band.low[n - 1 - i])).join(" ");
svg.appendChild(el("path", { d: up + " " + dn + " Z", fill: "var(--s1-soft)", stroke: "none" }));
}
svg.appendChild(el("path", {
d: o.v.map((v, i) => (i ? "L" : "M") + X(i) + " " + Y(v)).join(" "),
fill: "none", stroke: "var(--s1)", "stroke-width": 2,
"stroke-linejoin": "round", "stroke-linecap": "round" }));
o.v.forEach((v, i) => svg.appendChild(el("circle", {
cx: X(i), cy: Y(v), r: 5, fill: "var(--s1)", stroke: "var(--surface)", "stroke-width": 2 })));
const cross = el("line", { class: "cross", y1: M.t, y2: M.t + ih, opacity: 0 });
svg.appendChild(cross);
const hit = el("rect", { x: M.l, y: M.t, width: iw, height: ih, fill: "transparent" });
svg.appendChild(hit);
b.appendChild(svg);
const tip = mkTip(b);
hit.addEventListener("pointermove", ev => {
const rc = svg.getBoundingClientRect();
const px = ((ev.clientX - rc.left) / rc.width) * W;
let i = 0, best = Infinity;
for (let k = 0; k < n; k++) { const d = Math.abs(X(k) - px); if (d < best) { best = d; i = k; } }
cross.setAttribute("x1", X(i)); cross.setAttribute("x2", X(i)); cross.setAttribute("opacity", 1);
showTip(tip, b, (X(i) / W) * rc.width, (Y(o.v[i]) / H) * rc.height,
`<div class="th">${o.tipHead(i)}</div>` + o.tipBody(i));
});
hit.addEventListener("pointerleave", () => { tip.style.opacity = "0"; cross.setAttribute("opacity", 0); });
}
/* ------------------------------ build ------------------------------ */
if (D.cats.length) {
bars("cb-decode", {
aria: "Median decode throughput per category.",
x: D.cats, yTitle: "DECODE T/S (MEDIAN)",
yMax: niceTop(maxOf([D.decode])), height: 350,
ref: D.combined, refLabel: "combined " + fmt(D.combined, 1),
series: [{ name: "decode t/s", color: "var(--s1)", v: D.decode }],
tipVal: v => fmt(v, 1) + " t/s",
extra: i => row(null, "±IQR", fmt(D.decodeIqr[i], 1)) +
row(null, "CV", fmt(D.cv[i], 1) + "%") +
row(null, "passes", D.runs[i])
});
if (D.batched) {
/* Grouped bars, not a floating range bar: p50 and p99 can differ by two
orders of magnitude (a 17 ms rhythm against a 1.3 s stall), and a bar
floating between them collapses the p50 end onto the axis. */
bars("cb-itl", {
aria: "Stream-update gap p50 and p99 by category.",
x: D.cats, yTitle: "UPDATE GAP (MS)",
yMax: niceTop(maxOf([D.updP99, D.updP50])), height: 320,
series: [{ name: "p50", color: "var(--s1)", v: D.updP50 },
{ name: "p99", color: "var(--s2)", v: D.updP99 }],
tipVal: v => fmt(v, 1) + " ms",
extra: i => row(null, "tok/update", fmt(D.tokPerUpd[i], 2)) +
row(null, "passes", D.runs[i])
});
} else {
rangeBars("cb-itl", {
aria: "Inter-token latency range per category, 1% low to 99% high.",
x: D.cats, yTitle: "INSTANTANEOUS T/S",
yMax: niceTop(maxOf([D.itlHigh])),
low: D.itlLow, med: D.itlMed, high: D.itlHigh,
tipVal: v => fmt(v, 1) + " t/s",
extra: i => row(null, "spread", has(D.itlHigh[i]) && has(D.itlLow[i])
? fmt(D.itlHigh[i] - D.itlLow[i], 1) + " t/s" : "—")
});
}
}
if (D.conc.levels.length > 1) {
line("cb-conc", {
aria: "Aggregate throughput as concurrency rises.",
x: D.conc.levels.map(String), xTitle: "CONCURRENCY LEVEL",
yTitle: "AGGREGATE T/S", yMin: 0, yMax: niceTop(maxOf([D.conc.agg])),
v: D.conc.agg,
tipHead: i => "concurrency " + D.conc.levels[i] + " · " + D.conc.ok[i] + "/" + D.conc.req[i] + " ok",
tipBody: i => row(null, "aggregate", fmt(D.conc.agg[i], 1) + " t/s") +
row(null, "per-req", fmt(D.conc.per[i], 1) + " t/s") +
row(null, "TTFT p50", fmt(D.conc.t50[i], 1) + " ms")
});
bars("cb-ttft", {
aria: "TTFT p50 and p99 by concurrency level.",
x: D.conc.levels.map(String), yTitle: "TTFT (MS)",
yMax: niceTop(maxOf([D.conc.t99, D.conc.t50])), height: 300,
series: [{ name: "p50", color: "var(--s1)", v: D.conc.t50 },
{ name: "p99", color: "var(--s2)", v: D.conc.t99 }],
tipVal: v => fmt(v, 1) + " ms",
extra: i => row(null, "requests", D.conc.ok[i] + "/" + D.conc.req[i])
});
}
if (D.pre.depths.length > 1) {
const lo = Math.min(...D.pre.low.filter(has).concat(D.pre.med.filter(has)));
const hi = Math.max(...D.pre.high.filter(has).concat(D.pre.med.filter(has)));
const pad = (hi - lo) * 0.25 || hi * 0.1;
line("cb-prefill", {
aria: "Prefill throughput by input depth.",
x: D.pre.depths.map(d => d >= 1000 ? (d / 1000) + "k" : String(d)),
xTitle: "TARGET INPUT DEPTH (TOKENS)", yTitle: "PP T/S (MEDIAN)",
yMin: Math.max(0, lo - pad), yMax: hi + pad,
v: D.pre.med, band: { low: D.pre.low, high: D.pre.high },
tipHead: i => D.pre.depths[i].toLocaleString() + " target · "
+ fmt(D.pre.tok[i], 0) + " actual tok",
tipBody: i => row(null, "99% high", fmt(D.pre.high[i], 1)) +
row(null, "median", fmt(D.pre.med[i], 1)) +
row(null, "1% low", fmt(D.pre.low[i], 1)) +
row(null, "TTFT p50", fmt(D.pre.t50[i], 0) + " ms")
});
}
</script>
</body>
</html>