Deano Calver commited on
Commit
7db8426
·
1 Parent(s): 176eeb9

Disable invalid live compare until benchmark parity

Browse files
Files changed (3) hide show
  1. demo_controller.py +8 -0
  2. engines/live_request.py +6 -0
  3. space_app.py +153 -28
demo_controller.py CHANGED
@@ -313,6 +313,14 @@ def _build_unavailable_result(request: DemoRequest, logs: list[str]) -> dict[str
313
  f"Live run blocked: selected context {int(request.context_length)} exceeds the current live limit "
314
  f"of {max_live_context} tokens. Lower Context length or raise DOTCACHE_SPACE_MAX_LIVE_CONTEXT."
315
  )
 
 
 
 
 
 
 
 
316
  elif any("is not wired in this v1 Space yet" in entry for entry in recent_logs):
317
  summary = "This model is listed for the demo, but its live execution lane is not wired yet."
318
  blocked_reason = "model_family_not_wired"
 
313
  f"Live run blocked: selected context {int(request.context_length)} exceeds the current live limit "
314
  f"of {max_live_context} tokens. Lower Context length or raise DOTCACHE_SPACE_MAX_LIVE_CONTEXT."
315
  )
316
+ elif any("Live benchmark parity is not wired in this Space yet" in entry for entry in recent_logs):
317
+ summary = "Live compare is disabled until the Space uses the same benchmark selector artifacts and profile settings as the paper runs."
318
+ blocked_reason = "benchmark_parity"
319
+ candidate_text = (
320
+ "Live run blocked: this Space is not yet executing the benchmark-faithful Qwen lane. "
321
+ "Preset-backed compare is still the valid paper/benchmark view until the learned selector artifacts "
322
+ "and benchmark profile wiring are packaged for live execution."
323
+ )
324
  elif any("is not wired in this v1 Space yet" in entry for entry in recent_logs):
325
  summary = "This model is listed for the demo, but its live execution lane is not wired yet."
326
  blocked_reason = "model_family_not_wired"
engines/live_request.py CHANGED
@@ -69,6 +69,12 @@ def resolve_live_runtime_settings(
69
  "Live execution for this gated Llama model requires HF_TOKEN in the Space settings. "
70
  "Preset-backed compare still works without it."
71
  )
 
 
 
 
 
 
72
 
73
  context_length = int(request.get("context_length") or 0)
74
  if context_length <= 0:
 
69
  "Live execution for this gated Llama model requires HF_TOKEN in the Space settings. "
70
  "Preset-backed compare still works without it."
71
  )
72
+ if model.family == "qwen35":
73
+ raise ValueError(
74
+ "Live benchmark parity is not wired in this Space yet. The current live lane does not load the "
75
+ "benchmark selector artifact or benchmark-exact profile settings, so live compare is disabled until "
76
+ "that path is packaged correctly. Preset-backed compare remains the valid paper/benchmark view."
77
+ )
78
 
79
  context_length = int(request.get("context_length") or 0)
80
  if context_length <= 0:
space_app.py CHANGED
@@ -293,14 +293,19 @@ def _is_live_result(result: dict[str, Any]) -> bool:
293
  }
294
 
295
 
 
 
 
 
296
  def _hero_headline(result: dict[str, Any]) -> str:
297
  comparison = result["comparison"]
298
  if _is_live_result(result):
299
  speed_value, _ = _speed_display(comparison["speedup"])
300
- memory_value, _ = _memory_display(comparison["memory_reduction"])
301
  _, agreement_label, _ = _agreement_state(comparison["agreement"])
 
 
302
  return (
303
- f"Live run estimate: DotCache is {speed_value}, reports {memory_value} resident KV, "
304
  f"and shows {agreement_label.lower()} vs the reference run."
305
  )
306
  paper_headline = str(comparison.get("paper_headline") or "").strip()
@@ -363,12 +368,19 @@ def _render_loading_state(label: str) -> str:
363
 
364
 
365
  def _render_hero(result: dict[str, Any], response: Any) -> str:
 
 
366
  comparison = result["comparison"]
 
 
367
  if _is_blocked_result(result):
368
  reason = comparison.get("blocked_reason")
369
  if reason == "hw_limit":
370
  subtitle = "This request hit the current hardware/runtime limit before the reference or systems row could execute."
371
  status_value = "Hardware limit hit"
 
 
 
372
  elif reason == "model_family_not_wired":
373
  subtitle = "This model is available in the demo list, but its live execution lane has not been wired yet."
374
  status_value = "Live lane not wired"
@@ -405,12 +417,28 @@ def _render_hero(result: dict[str, Any], response: Any) -> str:
405
  "</div>"
406
  )
407
  speed_value, _ = _speed_display(comparison["speedup"])
408
- memory_value, _ = _memory_display(comparison["memory_reduction"])
409
  agreement_badge = _agreement_badge_text(comparison["agreement"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  hero_stats = "".join(
411
  [
412
  _hero_stat("⚡", speed_value, "Speed vs reference"),
413
- _hero_stat("💾", memory_value, "KV footprint"),
414
  _hero_stat("🎯", agreement_badge, f"{100.0 * comparison['agreement']:.0f}% agreement vs reference"),
415
  ]
416
  )
@@ -422,7 +450,7 @@ def _render_hero(result: dict[str, Any], response: Any) -> str:
422
  f"<h1>{html.escape(_hero_headline(result))}</h1>"
423
  f"{_hero_about_link()}"
424
  "</div>"
425
- f"<p class='hero-subtitle'>{html.escape(str(comparison.get('paper_subtitle') or ('Live prompt comparison using the current runtime estimates.' if _is_live_result(result) else 'Reference vs systems long-context inference, summarized from the current run.')))}</p>"
426
  "</div>"
427
  f"<div class='hero-stats'>{hero_stats}</div>"
428
  f"{_render_badge_html(response)}"
@@ -435,6 +463,7 @@ def _render_kpis(result: dict[str, Any]) -> str:
435
  candidate = result["candidate"]
436
  comparison = result["comparison"]
437
  is_live = _is_live_result(result)
 
438
  if _is_blocked_result(result):
439
  cards = [
440
  _kpi_card("⚡ SPEEDUP", "Not run", "No comparison was executed", tone="neutral"),
@@ -452,17 +481,33 @@ def _render_kpis(result: dict[str, Any]) -> str:
452
  agreement_primary, agreement_secondary, agreement_tone = _agreement_metric_text(comparison["agreement"])
453
  latency_tone = "good" if candidate["latency_ms_per_token"] <= baseline["latency_ms_per_token"] else "bad"
454
  memory_size_tone = "good" if candidate["kv_bytes"] <= baseline["kv_bytes"] else "bad"
455
- memory_title = "💾 EST. KV RESIDENCY" if is_live else "💾 MEMORY REDUCTION"
456
- memory_primary = (
457
- _format_ratio(comparison["memory_reduction"])
458
- if not is_live
459
- else _format_bytes(candidate["kv_bytes"])
460
- )
461
- memory_secondary = (
462
- memory_text.replace("better", "smaller than dense").replace("worse", "larger than dense")
463
- if not is_live
464
- else f"runtime-reported vs reference {_format_bytes(baseline['kv_bytes'])}"
465
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  cards = [
467
  _kpi_card(
468
  "⚡ SPEEDUP",
@@ -474,7 +519,7 @@ def _render_kpis(result: dict[str, Any]) -> str:
474
  memory_title,
475
  memory_primary,
476
  memory_secondary,
477
- tone="neutral" if is_live else memory_tone,
478
  ),
479
  _kpi_card(
480
  "🎯 AGREEMENT",
@@ -489,10 +534,10 @@ def _render_kpis(result: dict[str, Any]) -> str:
489
  tone=latency_tone,
490
  ),
491
  _kpi_card(
492
- "📦 RAW KV SIZE",
493
- _format_bytes(candidate["kv_bytes"]),
494
- f"dense {_format_bytes(baseline['kv_bytes'])}",
495
- tone=memory_size_tone,
496
  ),
497
  _kpi_card(
498
  "🧪 TOKENS / SEC",
@@ -559,6 +604,23 @@ def _render_inline_trends(result: dict[str, Any]) -> str:
559
  )
560
  baseline = result["baseline"]
561
  candidate = result["candidate"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  charts = [
563
  _mini_trend_chart(
564
  "Speed",
@@ -598,6 +660,11 @@ def _render_story_sentence(result: dict[str, Any]) -> str:
598
  f"This request did not run because the selected context ({comparison.get('blocked_context_length', 0)}) "
599
  f"exceeds the current live hardware limit of {comparison.get('max_live_context', 0)} tokens."
600
  )
 
 
 
 
 
601
  if comparison.get("blocked_reason") == "model_family_not_wired":
602
  return "This model can appear in the demo list, but its custom live runner has not been wired into the v1 Space yet."
603
  if comparison.get("blocked_reason") == "auth_required":
@@ -607,6 +674,19 @@ def _render_story_sentence(result: dict[str, Any]) -> str:
607
  if comparison.get("blocked_reason") == "cache_download_limit":
608
  return "This request did not run because the Space could not fetch the selected model into its local runtime cache."
609
  return "This request did not run because the current runtime blocked execution before inference started."
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  speed_value, _ = _speed_display(comparison["speedup"])
611
  memory_value, _ = _memory_display(comparison["memory_reduction"])
612
  _, agreement_label, _ = _agreement_state(comparison["agreement"])
@@ -615,11 +695,6 @@ def _render_story_sentence(result: dict[str, Any]) -> str:
615
  f"DotCache preserves output quality while running {speed_value} "
616
  f"and using {memory_value} KV memory."
617
  )
618
- if _is_live_result(result):
619
- return (
620
- f"Live run estimate: DotCache is {speed_value}, reports {memory_value} resident KV, "
621
- f"and shows {agreement_label.lower()} compared to the reference run."
622
- )
623
  if comparison["agreement"] >= 0.85:
624
  return (
625
  f"DotCache is {speed_value} and uses "
@@ -641,6 +716,8 @@ def _render_delta_strip(result: dict[str, Any]) -> str:
641
  f"Live run blocked at {comparison.get('blocked_context_length', 0)} tokens "
642
  f"(current cap {comparison.get('max_live_context', 0)})"
643
  )
 
 
644
  elif comparison.get("blocked_reason") == "model_family_not_wired":
645
  blocked_text = "Live run blocked because this model family is not wired into the v1 runner yet"
646
  elif comparison.get("blocked_reason") == "auth_required":
@@ -821,6 +898,15 @@ def _chart_bar(label: str, dense_value: float, candidate_value: float, suffix: s
821
  )
822
 
823
 
 
 
 
 
 
 
 
 
 
824
  def _render_charts_tab(result: dict[str, Any]) -> str:
825
  baseline = result["baseline"]
826
  candidate = result["candidate"]
@@ -836,6 +922,33 @@ def _render_charts_tab(result: dict[str, Any]) -> str:
836
  "</div>"
837
  "</div>"
838
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  return (
840
  "<div class='charts-grid'>"
841
  + _chart_bar("Tokens / sec", baseline["tok_per_sec"], candidate["tok_per_sec"], "", baseline_label, candidate_label)
@@ -848,7 +961,7 @@ def _render_charts_tab(result: dict[str, Any]) -> str:
848
  candidate_label,
849
  )
850
  + _chart_bar(
851
- "KV memory",
852
  baseline["kv_bytes"] / (1024.0 * 1024.0),
853
  candidate["kv_bytes"] / (1024.0 * 1024.0),
854
  " MiB",
@@ -1548,8 +1661,18 @@ def _render_arena_vote_status(state: dict[str, Any] | None, history: list[dict[s
1548
  def _arena_reveal_sentence(result: dict[str, Any]) -> str:
1549
  comparison = result["comparison"]
1550
  speed_value, _ = _speed_display(comparison["speedup"])
1551
- memory_value, _ = _memory_display(comparison["memory_reduction"])
1552
  agreement = float(comparison["agreement"])
 
 
 
 
 
 
 
 
 
 
 
1553
  if agreement >= 0.95:
1554
  return f"DotCache matched the dense response closely while running {speed_value} and using {memory_value} KV memory."
1555
  if agreement >= 0.85:
@@ -1563,6 +1686,8 @@ def _arena_compact_summary(result: dict[str, Any]) -> str:
1563
  comparison = result["comparison"]
1564
  _, agreement_label, _ = _agreement_state(float(comparison["agreement"]))
1565
  speed_value, _ = _speed_display(comparison["speedup"])
 
 
1566
  memory_value, _ = _memory_display(comparison["memory_reduction"])
1567
  return f"{agreement_label} • {speed_value} • {memory_value} KV"
1568
 
 
293
  }
294
 
295
 
296
+ def _is_paper_fixture(result: dict[str, Any]) -> bool:
297
+ return bool(result.get("comparison", {}).get("paper_fixture"))
298
+
299
+
300
  def _hero_headline(result: dict[str, Any]) -> str:
301
  comparison = result["comparison"]
302
  if _is_live_result(result):
303
  speed_value, _ = _speed_display(comparison["speedup"])
 
304
  _, agreement_label, _ = _agreement_state(comparison["agreement"])
305
+ candidate_kv = _format_bytes(result["candidate"]["kv_bytes"])
306
+ baseline_kv = _format_bytes(result["baseline"]["kv_bytes"])
307
  return (
308
+ f"Live Space run: DotCache is {speed_value}, with {candidate_kv} resident KV vs {baseline_kv} dense, "
309
  f"and shows {agreement_label.lower()} vs the reference run."
310
  )
311
  paper_headline = str(comparison.get("paper_headline") or "").strip()
 
368
 
369
 
370
  def _render_hero(result: dict[str, Any], response: Any) -> str:
371
+ baseline = result["baseline"]
372
+ candidate = result["candidate"]
373
  comparison = result["comparison"]
374
+ is_live = _is_live_result(result)
375
+ is_paper = _is_paper_fixture(result)
376
  if _is_blocked_result(result):
377
  reason = comparison.get("blocked_reason")
378
  if reason == "hw_limit":
379
  subtitle = "This request hit the current hardware/runtime limit before the reference or systems row could execute."
380
  status_value = "Hardware limit hit"
381
+ elif reason == "benchmark_parity":
382
+ subtitle = "Live compare is disabled until this Space is wired to the same selector artifacts and benchmark profile settings used for the paper runs."
383
+ status_value = "Benchmark parity required"
384
  elif reason == "model_family_not_wired":
385
  subtitle = "This model is available in the demo list, but its live execution lane has not been wired yet."
386
  status_value = "Live lane not wired"
 
417
  "</div>"
418
  )
419
  speed_value, _ = _speed_display(comparison["speedup"])
 
420
  agreement_badge = _agreement_badge_text(comparison["agreement"])
421
+ if is_live:
422
+ memory_value = _format_bytes(candidate["kv_bytes"])
423
+ memory_label = "Runtime resident KV"
424
+ elif is_paper:
425
+ memory_value = str(comparison.get("paper_metric_badge") or "Not reported")
426
+ memory_label = "Paper metric"
427
+ else:
428
+ memory_value, _ = _memory_display(comparison["memory_reduction"])
429
+ memory_label = "KV footprint"
430
+ subtitle = str(comparison.get("paper_subtitle") or "").strip()
431
+ if is_live:
432
+ subtitle = (
433
+ "Live prompt comparison using the current Space runtime. Resident KV bytes here are runtime telemetry "
434
+ "and are not directly comparable to the paper preset tables."
435
+ )
436
+ elif not subtitle:
437
+ subtitle = "Reference vs systems long-context inference, summarized from the current run."
438
  hero_stats = "".join(
439
  [
440
  _hero_stat("⚡", speed_value, "Speed vs reference"),
441
+ _hero_stat("💾", memory_value, memory_label),
442
  _hero_stat("🎯", agreement_badge, f"{100.0 * comparison['agreement']:.0f}% agreement vs reference"),
443
  ]
444
  )
 
450
  f"<h1>{html.escape(_hero_headline(result))}</h1>"
451
  f"{_hero_about_link()}"
452
  "</div>"
453
+ f"<p class='hero-subtitle'>{html.escape(subtitle)}</p>"
454
  "</div>"
455
  f"<div class='hero-stats'>{hero_stats}</div>"
456
  f"{_render_badge_html(response)}"
 
463
  candidate = result["candidate"]
464
  comparison = result["comparison"]
465
  is_live = _is_live_result(result)
466
+ is_paper = _is_paper_fixture(result)
467
  if _is_blocked_result(result):
468
  cards = [
469
  _kpi_card("⚡ SPEEDUP", "Not run", "No comparison was executed", tone="neutral"),
 
481
  agreement_primary, agreement_secondary, agreement_tone = _agreement_metric_text(comparison["agreement"])
482
  latency_tone = "good" if candidate["latency_ms_per_token"] <= baseline["latency_ms_per_token"] else "bad"
483
  memory_size_tone = "good" if candidate["kv_bytes"] <= baseline["kv_bytes"] else "bad"
484
+ if is_live:
485
+ memory_title = "💾 EST. KV RESIDENCY"
486
+ memory_primary = _format_bytes(candidate["kv_bytes"])
487
+ memory_secondary = f"runtime-reported vs reference {_format_bytes(baseline['kv_bytes'])}"
488
+ memory_tone_for_card = "neutral"
489
+ raw_kv_title = "📦 RAW KV SIZE"
490
+ raw_kv_primary = _format_bytes(candidate["kv_bytes"])
491
+ raw_kv_secondary = f"dense {_format_bytes(baseline['kv_bytes'])}"
492
+ raw_kv_tone = memory_size_tone
493
+ elif is_paper:
494
+ memory_title = "💾 KV MEMORY"
495
+ memory_primary = "Not reported"
496
+ memory_secondary = "This paper row does not publish a KV-memory reduction number."
497
+ memory_tone_for_card = "neutral"
498
+ raw_kv_title = "📄 PAPER METRIC"
499
+ raw_kv_primary = str(comparison.get("paper_metric_badge") or "Paper-backed row")
500
+ raw_kv_secondary = "Preset speed and quality come from the paper; KV bytes are not reported there."
501
+ raw_kv_tone = "neutral"
502
+ else:
503
+ memory_title = "💾 MEMORY REDUCTION"
504
+ memory_primary = _format_ratio(comparison["memory_reduction"])
505
+ memory_secondary = memory_text.replace("better", "smaller than dense").replace("worse", "larger than dense")
506
+ memory_tone_for_card = memory_tone
507
+ raw_kv_title = "📦 RAW KV SIZE"
508
+ raw_kv_primary = _format_bytes(candidate["kv_bytes"])
509
+ raw_kv_secondary = f"dense {_format_bytes(baseline['kv_bytes'])}"
510
+ raw_kv_tone = memory_size_tone
511
  cards = [
512
  _kpi_card(
513
  "⚡ SPEEDUP",
 
519
  memory_title,
520
  memory_primary,
521
  memory_secondary,
522
+ tone=memory_tone_for_card,
523
  ),
524
  _kpi_card(
525
  "🎯 AGREEMENT",
 
534
  tone=latency_tone,
535
  ),
536
  _kpi_card(
537
+ raw_kv_title,
538
+ raw_kv_primary,
539
+ raw_kv_secondary,
540
+ tone=raw_kv_tone,
541
  ),
542
  _kpi_card(
543
  "🧪 TOKENS / SEC",
 
604
  )
605
  baseline = result["baseline"]
606
  candidate = result["candidate"]
607
+ if _is_paper_fixture(result):
608
+ return (
609
+ "<div class='trend-grid'>"
610
+ + _mini_trend_chart(
611
+ "Speed",
612
+ baseline["tok_per_sec"],
613
+ candidate["tok_per_sec"],
614
+ formatter=lambda value: f"{_format_float(value, 1)} tok/s",
615
+ better_when_higher=True,
616
+ )
617
+ + "<div class='trend-card'>"
618
+ "<div class='trend-title'>KV Memory</div>"
619
+ "<div class='trend-delta neutral'>Not reported in this paper row</div>"
620
+ "<p>Preset mode uses the paper's speed and quality row only, so placeholder KV bytes are hidden here.</p>"
621
+ "</div>"
622
+ "</div>"
623
+ )
624
  charts = [
625
  _mini_trend_chart(
626
  "Speed",
 
660
  f"This request did not run because the selected context ({comparison.get('blocked_context_length', 0)}) "
661
  f"exceeds the current live hardware limit of {comparison.get('max_live_context', 0)} tokens."
662
  )
663
+ if comparison.get("blocked_reason") == "benchmark_parity":
664
+ return (
665
+ "This request did not run because the current Space live lane is not yet using the same selector "
666
+ "artifacts and benchmark profile settings as the paper-backed presets."
667
+ )
668
  if comparison.get("blocked_reason") == "model_family_not_wired":
669
  return "This model can appear in the demo list, but its custom live runner has not been wired into the v1 Space yet."
670
  if comparison.get("blocked_reason") == "auth_required":
 
674
  if comparison.get("blocked_reason") == "cache_download_limit":
675
  return "This request did not run because the Space could not fetch the selected model into its local runtime cache."
676
  return "This request did not run because the current runtime blocked execution before inference started."
677
+ if _is_live_result(result):
678
+ speed_value, _ = _speed_display(comparison["speedup"])
679
+ _, agreement_label, _ = _agreement_state(comparison["agreement"])
680
+ candidate_kv = _format_bytes(result["candidate"]["kv_bytes"])
681
+ baseline_kv = _format_bytes(result["baseline"]["kv_bytes"])
682
+ return (
683
+ f"Live Space run: DotCache is {speed_value}, with {candidate_kv} resident KV vs {baseline_kv} dense, "
684
+ f"and shows {agreement_label.lower()} compared to the reference run."
685
+ )
686
+ if _is_paper_fixture(result):
687
+ speed_value, _ = _speed_display(comparison["speedup"])
688
+ _, agreement_label, _ = _agreement_state(comparison["agreement"])
689
+ return f"This paper row reports {speed_value} with {agreement_label.lower()}; KV-memory reduction is not reported for this preset."
690
  speed_value, _ = _speed_display(comparison["speedup"])
691
  memory_value, _ = _memory_display(comparison["memory_reduction"])
692
  _, agreement_label, _ = _agreement_state(comparison["agreement"])
 
695
  f"DotCache preserves output quality while running {speed_value} "
696
  f"and using {memory_value} KV memory."
697
  )
 
 
 
 
 
698
  if comparison["agreement"] >= 0.85:
699
  return (
700
  f"DotCache is {speed_value} and uses "
 
716
  f"Live run blocked at {comparison.get('blocked_context_length', 0)} tokens "
717
  f"(current cap {comparison.get('max_live_context', 0)})"
718
  )
719
+ elif comparison.get("blocked_reason") == "benchmark_parity":
720
+ blocked_text = "Live run disabled until benchmark-parity selector artifacts and profiles are wired"
721
  elif comparison.get("blocked_reason") == "model_family_not_wired":
722
  blocked_text = "Live run blocked because this model family is not wired into the v1 runner yet"
723
  elif comparison.get("blocked_reason") == "auth_required":
 
898
  )
899
 
900
 
901
+ def _chart_note_block(label: str, body: str) -> str:
902
+ return (
903
+ "<div class='chart-block'>"
904
+ f"<div class='chart-label'>{html.escape(label)}</div>"
905
+ f"<div class='chart-empty'>{html.escape(body)}</div>"
906
+ "</div>"
907
+ )
908
+
909
+
910
  def _render_charts_tab(result: dict[str, Any]) -> str:
911
  baseline = result["baseline"]
912
  candidate = result["candidate"]
 
922
  "</div>"
923
  "</div>"
924
  )
925
+ if _is_paper_fixture(result):
926
+ return (
927
+ "<div class='charts-grid'>"
928
+ + _chart_bar("Tokens / sec", baseline["tok_per_sec"], candidate["tok_per_sec"], "", baseline_label, candidate_label)
929
+ + _chart_bar(
930
+ "Latency / token",
931
+ baseline["latency_ms_per_token"],
932
+ candidate["latency_ms_per_token"],
933
+ " ms",
934
+ baseline_label,
935
+ candidate_label,
936
+ )
937
+ + _chart_note_block(
938
+ "KV memory",
939
+ "Not reported in this paper row. The preset uses paper-backed speed and quality only.",
940
+ )
941
+ + _chart_bar(
942
+ "Agreement",
943
+ 1.0,
944
+ comparison["agreement"],
945
+ "",
946
+ baseline_label,
947
+ candidate_label,
948
+ )
949
+ + "</div>"
950
+ )
951
+ memory_chart_label = "Resident KV" if _is_live_result(result) else "KV memory"
952
  return (
953
  "<div class='charts-grid'>"
954
  + _chart_bar("Tokens / sec", baseline["tok_per_sec"], candidate["tok_per_sec"], "", baseline_label, candidate_label)
 
961
  candidate_label,
962
  )
963
  + _chart_bar(
964
+ memory_chart_label,
965
  baseline["kv_bytes"] / (1024.0 * 1024.0),
966
  candidate["kv_bytes"] / (1024.0 * 1024.0),
967
  " MiB",
 
1661
  def _arena_reveal_sentence(result: dict[str, Any]) -> str:
1662
  comparison = result["comparison"]
1663
  speed_value, _ = _speed_display(comparison["speedup"])
 
1664
  agreement = float(comparison["agreement"])
1665
+ if _is_live_result(result):
1666
+ candidate_kv = _format_bytes(result["candidate"]["kv_bytes"])
1667
+ baseline_kv = _format_bytes(result["baseline"]["kv_bytes"])
1668
+ if agreement >= 0.95:
1669
+ return f"DotCache matched the dense response closely while running {speed_value}, with {candidate_kv} resident KV vs {baseline_kv} dense."
1670
+ if agreement >= 0.85:
1671
+ return f"This live round traded some speed for lower resident KV, with only minor wording differences after reveal."
1672
+ if agreement >= 0.70:
1673
+ return f"This live round cut resident KV, but moderate output drift appeared in the revealed answer."
1674
+ return f"This live round shows a tradeoff: lower resident KV on this Space runtime, but answer quality diverged noticeably."
1675
+ memory_value, _ = _memory_display(comparison["memory_reduction"])
1676
  if agreement >= 0.95:
1677
  return f"DotCache matched the dense response closely while running {speed_value} and using {memory_value} KV memory."
1678
  if agreement >= 0.85:
 
1686
  comparison = result["comparison"]
1687
  _, agreement_label, _ = _agreement_state(float(comparison["agreement"]))
1688
  speed_value, _ = _speed_display(comparison["speedup"])
1689
+ if _is_live_result(result):
1690
+ return f"{agreement_label} • {speed_value} • {_format_bytes(result['candidate']['kv_bytes'])} resident KV"
1691
  memory_value, _ = _memory_display(comparison["memory_reduction"])
1692
  return f"{agreement_label} • {speed_value} • {memory_value} KV"
1693