"""Serving-economics panel for the Polygen x Qwen2-VL Space. A self-contained HTML fragment (inline CSS, no JS, no external assets) rendered into a Gradio gr.HTML block. The requests-per-GPU capacity bars play once whenever the fragment is (re)rendered; `app.py` re-renders it on each "Run comparison" click by passing a changing `data-run` nonce, so the animation replays on the user's action rather than looping on its own. The figures are measured: NVIDIA H200, Qwen2-VL-7B, vLLM continuous batching. Source: `tools/runpod_results/results_serving_throughput_7B.json` (throughput, T=2, cached visual tokens); storage from the SDK tier registry. This panel makes a throughput and storage claim only -- no per-request latency / wall-clock claim. """ # ruff: noqa: E501 (self-contained HTML fragment; inline CSS lines do not wrap) # `data-run="__NONCE__"` is replaced per render (not str.format, because the # inline CSS is full of literal braces). A different nonce makes the gr.HTML # value differ, so Gradio replaces the DOM and the play-once animation restarts. _PANEL = """
Polygen compresses Qwen2-VL's visual tokens before the language model reads them. At the T=2 operating point (accuracy +7.4pp above baseline, a statistical tie with the best tier), the shorter visual sequence is a smaller KV cache and less attention compute, so one GPU serves more concurrent requests.
Per GPU, polygen sustains about 3.7x (nearly 4x) the requests per second, so the same load runs on roughly a quarter of the GPUs. For precomputed / cached visual tokens (retrieval, repeated queries) -- the pattern the RAG demo shows.
Tiers, chosen per workload. T=3 is the accuracy peak (+8.4pp on ScienceQA); T=2, shown here, is the compression peak (+7.4pp, a statistical tie) where the throughput gain is largest; lower tiers trade accuracy for more compression.
The gain is throughput and storage: a shorter visual sequence is a smaller KV cache and less attention compute, so a GPU serves more concurrent requests and the cached representation is smaller. Measured for precomputed / cached visual tokens (retrieval, repeated queries) under vLLM continuous batching on an NVIDIA H200 with Qwen2-VL-7B.