Commit c40c77b
authored
fix(inference): align unofficial-run overlay x-axis + roofline with official chart / 对齐非官方运行叠加层的 x 轴与 roofline (#596)
* fix(inference): apply selected percentile to unofficial-run overlay x-axis
The `?unofficialrun=` overlay path (`processOverlayChartData`) never applied
the selected latency percentile to the x-axis field, so on agentic charts it
plotted overlay points against the raw `median_intvty` / `median_e2el` column
while the official run's points sat on the percentile-adjusted column
(`p90_intvty` etc.) selected via the percentile picker. Because
`p90_intvty = 1/p90_itl < median_intvty = 1/median_itl`, an overlay of the
*same* run rendered shifted to the right of its own official points on the
"P90 Interactivity" chart (identical throughput + config labels, mismatched x).
Mirror `useChartData`'s percentile handling in `processOverlayChartData`: the
natural x is now `withPercentile(chartDef.x, isAgentic ? selectedPercentile :
'median')`, plus the final agentic rewrite that carries the percentile onto the
input-metric override. Non-agentic (fixed-seq) stays forced to `median`
(those rows carry no p90_/p99_ columns). Thread `selectedPercentile` through the
`ChartDisplay` caller and its memo deps.
The parallel helper `buildReplayTimeline.resolveXAxisField` has the same shape
of divergence but is inert: replay only runs for fixed-seq (history is keyed by
isl/osl, disabled for agentic), so its natural x is always `median`. Left
unchanged; documented so it isn't mistaken for a live bug.
中文:修复非官方运行叠加层(`?unofficialrun=`)在 agentic 图表上 x 轴未应用所选延迟
百分位(percentile)的问题。此前叠加层路径 `processOverlayChartData` 始终使用原始的
`median_intvty` / `median_e2el` 列,而官方运行的数据点使用百分位选择器选定的
`p90_intvty` 等列。由于 `p90_intvty = 1/p90_itl < median_intvty = 1/median_itl`,
同一次运行的叠加层会相对其自身官方数据点向右偏移(吞吐量与配置标签相同、x 值不一致),
即用户报告的 GLM5.2 B300 "P90 Interactivity" 图表错位。现让 `processOverlayChartData`
与 `useChartData` 的百分位逻辑保持一致:自然 x 轴取 `withPercentile(chartDef.x,
isAgentic ? selectedPercentile : 'median')`,并在 agentic 下对输入指标(input metric)
覆盖项再套用百分位;非 agentic(固定序列)仍强制 `median`(这些行没有 p90_/p99_ 列)。
同时将 `selectedPercentile` 传入 `ChartDisplay` 调用点及其 memo 依赖。并行的
`buildReplayTimeline.resolveXAxisField` 存在同类差异但无实际影响:replay 仅对固定序列
运行(历史数据按 isl/osl 键控,agentic 时禁用),其自然 x 轴恒为 `median`,故保持不变并加注说明。
* fix(inference): restrict unofficial-run overlay roofline to e2e-Pareto winners
On the agentic interactivity chart the official roofline is restricted to configs
that ALSO win on end-to-end latency (anti-benchmark-hacking): useChartData stamps
`isOnE2eFrontier` and ScatterGraph's `rooflines` narrows to those winners before
paretoing on the interactivity axis. The overlay path did neither — `overlayRooflines`
computed a fresh frontier directly on the (interactivity, y) plane — so an
`?unofficialrun=` overlay of the same run drew a line that rode ABOVE the official
green line wherever an interactivity-optimal config was not e2e-optimal.
- Extract the e2e-frontier seed into a shared helper `e2eFrontierWinners`
(components/inference/utils/e2eFrontier.ts). `useChartData.e2eParetoIds` now
derives its persisted-id set from it, so official and overlay seed identically.
- `processOverlayChartData` stamps `isOnE2eFrontier` on agentic interactivity
overlay points, seeded per unofficial run (matching overlayRooflines' per-run
grouping) so runs don't cross-dominate. The e2e chart and fixed-seq leave the
flag unset (no restriction), as on the official path.
- `overlayRooflines` now honors the flag with the same narrow-to-winners logic
as the official `rooflines`.
Depends on the selectedPercentile plumbing from the previous commit (the e2e-latency
seed field is percentile-prefixed, e.g. p90_e2el).
中文:修复非官方运行叠加层(`?unofficialrun=`)的 roofline 未套用 E2E 帕累托(Pareto)
前沿约束的问题。在 agentic 的 interactivity 图表上,官方 roofline 会限制为同时在端到端
延迟(end-to-end latency)上取胜的配置(反 benchmark 作弊):`useChartData` 为数据点打上
`isOnE2eFrontier` 标记,`ScatterGraph` 的 `rooflines` 在按 interactivity 轴求前沿前先收窄到
这些优胜点。叠加层路径两者皆无——`overlayRooflines` 直接在 (interactivity, y) 平面上重新
计算前沿,导致同一次运行的叠加层在“interactivity 最优但非 E2E 最优”的区段画出的线高于官方
绿线。改动:将 E2E 前沿种子逻辑抽取为共享函数 `e2eFrontierWinners`
(components/inference/utils/e2eFrontier.ts),`useChartData.e2eParetoIds` 由其派生持久化
id 集合,使官方与叠加层种子一致;`processOverlayChartData` 为 agentic interactivity 叠加层
数据点打上 `isOnE2eFrontier`,并按每个非官方运行分别求种子(与 `overlayRooflines` 的按运行
分组一致),避免不同运行相互支配;E2E 图表与固定序列不设该标记(不做约束),与官方路径一致;
`overlayRooflines` 现按与官方 `rooflines` 相同的收窄逻辑处理该标记。依赖上一提交引入的
selectedPercentile 传递(E2E 延迟种子字段带百分位前缀,如 p90_e2el)。
* fix(inference): extend overlay e2e-frontier restriction to the ttft x-mode
The official path stamps `isOnE2eFrontier` for EVERY non-e2e x-axis mode
(`selectedXAxisMode !== 'e2e'`), which includes the 'ttft' mode — the e2e
chartType rendered with a *_ttft x override. The overlay stamping added in the
previous commit only covered the interactivity chartType, so the TTFT chart's
overlay roofline still drew a fresh TTFT-plane frontier instead of the
e2e-restricted one. Stamp whenever the agentic chart's resolved x-axis is not
the natural e2e latency (interactivity chartType, or e2e chartType with the
TTFT override), matching the official condition mode-for-mode.
Verified end-to-end in a real browser (Cypress against the running app, real
run-29682242847 values served as both official and overlay data): official and
overlay interactivity rooflines both draw 4 vertices (C=48, C=8, C=2, C=1),
excluding the e2e-dominated TP8 C=4.
中文:将叠加层的 E2E 前沿约束扩展到 ttft x 轴模式。官方路径对所有非 e2e 的 x 轴模式
(`selectedXAxisMode !== 'e2e'`)都会打上 `isOnE2eFrontier` 标记,其中包括 'ttft'
模式(以 *_ttft 覆盖 x 轴渲染的 e2e chartType)。上一提交新增的叠加层打标仅覆盖了
interactivity chartType,导致 TTFT 图表的叠加层 roofline 仍在 TTFT 平面上重新计算前沿,
而非使用 E2E 约束后的前沿。现在只要 agentic 图表解析出的 x 轴不是自然 e2e 延迟
(interactivity chartType,或带 TTFT 覆盖的 e2e chartType)即打标,与官方条件逐模式对齐。
已在真实浏览器中端到端验证(Cypress 驱动运行中的应用,将 run 29682242847 的真实数据同时
作为官方与叠加层数据):官方与叠加层的 interactivity roofline 均绘制 4 个顶点
(C=48、C=8、C=2、C=1),排除了在 E2E 上被支配的 TP8 C=4。
* fix(inference): overlay points respect the Optimal Only toggle
Overlay (unofficial run) X markers rendered every point unconditionally, while
official points are hidden by `isPointVisible` when Optimal Only is on — and
Optimal Only is ON BY DEFAULT (`i_optimal !== '0'`). In the default agentic
interactivity view this made an e2e-dominated overlay config read as a pareto
point: the official TP8 C=4 dot was hidden, but the overlay C=4 X stayed
visible sitting on the dashed roofline (the monotone spline between C=8 and
C=2 passes within ~0.5% of it at the same x). On the e2e chart the same X sits
far below the curve, so the artifact only showed on non-e2e axes.
Mirror the official visibility rule on the overlay path:
- `overlayOptimalPoints`: identity set of every point on any overlay run's
drawn roofline (already e2e-restricted for agentic non-e2e modes). Frontier
arrays hold the same refs as `processedOverlayData` items, so identity
membership is exact and can't collide across runs.
- `isOverlayPointVisible` = `!hideNonOptimal || overlayOptimalPoints.has(d)`,
exposed through `interactionRef`; applied in the overlay layer render and in
the decoration effect so a toggle flip restyles existing DOM without a chart
rebuild (same Effect-4 path official dots use).
- Scale domains (`visiblePoints`) and the legend points table exclude hidden
overlay points, matching the official branch's filters.
New e2e spec drives the real pipeline with the run-29682242847 values: in the
default Optimal Only view exactly 4 of 5 overlay X's are visible (C=4 hidden,
matching its hidden official twin), toggling off shows all 5, re-enabling
hides C=4 again. Existing overlay specs (ttft-x-axis-toggle, watermark,
inference-chart) still pass.
中文:修复非官方运行叠加层数据点不响应 "Optimal Only"(仅显示最优)开关的问题。
叠加层的 X 标记此前无条件渲染所有数据点,而官方数据点在开关开启时会通过
`isPointVisible` 隐藏非帕累托(Pareto)点——且该开关默认开启(`i_optimal !== '0'`)。
在默认的 agentic interactivity 视图中,这使得在 E2E 上被支配的叠加层配置看起来像
帕累托点:官方 TP8 C=4 圆点被隐藏,但叠加层的 C=4 X 标记仍然可见,且恰好落在虚线
roofline 上(C=8 与 C=2 之间的单调样条曲线在同一 x 处与其相差不到 0.5%)。在 E2E
图表上该 X 明显低于曲线,因此该现象只出现在非 E2E 轴上。现将官方可见性规则镜像到
叠加层路径:新增 `overlayOptimalPoints`(任一叠加层运行已绘制 roofline 上数据点的
恒等集合,agentic 非 E2E 模式下已受 E2E 约束);`isOverlayPointVisible` 通过
`interactionRef` 暴露,在叠加层渲染与装饰 effect 中应用(与官方数据点相同的
Effect-4 路径,开关切换无需重建图表);坐标轴域(`visiblePoints`)与图例数据点
表格同样排除被隐藏的叠加层点。新增 e2e 测试以 run 29682242847 的真实数值驱动完整
渲染管线:默认视图下 5 个叠加层 X 中恰好 4 个可见(C=4 隐藏,与其官方对应点一致),
关闭开关显示全部 5 个,重新开启后 C=4 再次隐藏。既有叠加层测试全部通过。
* refactor(inference): share x-axis resolution and e2e-frontier contract across official/overlay paths
Simplification pass over the overlay-parity fixes; also fixes the Bugbot
finding that direction-less metrics cleared the overlay roofline.
- `e2eFrontierWinners` now returns `Set | null` — null means the y-metric
declares no e2e roofline direction, i.e. no restriction applies. Previously
it returned an empty set for that case and `processOverlayChartData` stamped
`isOnE2eFrontier = false` on every point, seeding an EMPTY overlay frontier
for the measured-power metrics (official leaves the flag unset and draws
unrestricted). `e2eParetoIds` loses its duplicated chartDef/direction guard.
Frontier framing now projects `{x, y, orig}` instead of spread-copying every
~70-property point and back-mapping through a Map — the pareto fns only read
x/y and return input refs.
- New shared `resolveXAxisField` (utils/resolveXAxisField.ts): the x-axis
branch ladder (natural percentile-adjust → input-metric overrides → e2e ttft
override → agentic percentile rewrite) previously lived twice, in
`useChartData.stableChartDefinitions` and `processOverlayChartData`, held in
sync by "must mirror" comments — the drift pattern behind three of this
branch's four bugs. Both now call the resolver; labels/headings stay in
useChartData keyed off the resolver's branch discriminant.
- The e2e-frontier stamping gate is now caller-computed: ChartDisplay passes
`restrictToE2eFrontier = isAgentic && selectedXAxisMode !== 'e2e'` — the
exact official gate — instead of processOverlayChartData re-deriving it from
chartType + field suffix (the reconstruction that missed the ttft mode).
- New `e2eRestrictedSeed` in e2eFrontier.ts is the single interpreter of the
`isOnE2eFrontier` tri-state; both `rooflines` and `overlayRooflines` call it
instead of carrying verbatim copies of the narrowing dance.
- `isOverlayPointVisible` hoisted above `pointsTable`/`visiblePoints` so all
Optimal Only consumers call the one predicate; overlay layer render folds
its two per-point predicate calls into one `.each`.
Verified: 453 inference unit tests (new regression test for the direction-less
metric case), 27 overlay-related Cypress e2e tests, full unit suite at the
pre-existing baseline, typecheck/lint/fmt clean.
中文:对叠加层一致性修复做简化重构,并修复 Bugbot 发现的问题(无 roofline 方向的
指标会清空叠加层前沿)。`e2eFrontierWinners` 现返回 `Set | null`——null 表示所选
y 指标未声明 e2e roofline 方向,即不适用任何约束;此前该情形返回空集合,导致
`processOverlayChartData` 给所有点打上 `isOnE2eFrontier = false`,使实测功耗类指标
的叠加层前沿为空(官方路径不设标记、绘制不受限的 roofline)。前沿计算改用
`{x, y, orig}` 精简投影,不再整体展开复制约 70 个属性的点对象。新增共享的
`resolveXAxisField`:x 轴字段解析逻辑此前在 `useChartData` 与
`processOverlayChartData` 中各有一份、仅靠"必须镜像"注释保持同步(本分支四个 bug
中有三个源于此类漂移),现两条路径调用同一解析器。E2E 前沿打标条件改由调用方
(ChartDisplay)按官方口径计算并传入(`isAgentic && selectedXAxisMode !== 'e2e'`)。
新增 `e2eRestrictedSeed` 作为 `isOnE2eFrontier` 三态标记的唯一解释器,官方与叠加层
roofline memo 均调用它。`isOverlayPointVisible` 上移,所有 Optimal Only 消费方调用
同一谓词。验证:453 个单元测试(新增无方向指标回归测试)、27 个叠加层 e2e 测试、
完整单元套件与既有基线一致,typecheck/lint/fmt 全部通过。1 parent 13230c5 commit c40c77b
8 files changed
Lines changed: 732 additions & 141 deletions
File tree
- packages/app
- cypress/e2e
- src/components/inference
- hooks
- ui
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
Lines changed: 30 additions & 90 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 26 | + | |
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | | - | |
| 30 | + | |
| 31 | + | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
| |||
86 | 83 | | |
87 | 84 | | |
88 | 85 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
117 | 91 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 92 | + | |
| 93 | + | |
122 | 94 | | |
123 | 95 | | |
124 | 96 | | |
| |||
399 | 371 | | |
400 | 372 | | |
401 | 373 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
411 | 378 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | 379 | | |
425 | 380 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
431 | 389 | | |
432 | 390 | | |
433 | 391 | | |
434 | 392 | | |
435 | 393 | | |
436 | 394 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
| 395 | + | |
| 396 | + | |
444 | 397 | | |
445 | 398 | | |
446 | 399 | | |
447 | 400 | | |
448 | 401 | | |
449 | 402 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 403 | + | |
456 | 404 | | |
457 | | - | |
458 | 405 | | |
459 | | - | |
460 | | - | |
| 406 | + | |
461 | 407 | | |
462 | 408 | | |
463 | 409 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
470 | 414 | | |
471 | 415 | | |
472 | 416 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | 417 | | |
478 | 418 | | |
479 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
389 | 396 | | |
390 | 397 | | |
391 | 398 | | |
| |||
425 | 432 | | |
426 | 433 | | |
427 | 434 | | |
| 435 | + | |
| 436 | + | |
428 | 437 | | |
429 | 438 | | |
430 | 439 | | |
| |||
0 commit comments