Skip to content

Add interactivity plot metric (tok/s/user vs tok/s/GPU)#838

Open
anmarques wants to merge 2 commits into
mainfrom
feat/plot-interactivity
Open

Add interactivity plot metric (tok/s/user vs tok/s/GPU)#838
anmarques wants to merge 2 commits into
mainfrom
feat/plot-interactivity

Conversation

@anmarques

Copy link
Copy Markdown
Collaborator

Purpose

Plot goodput-style curves using 1000/ITL for interactivity and system throughput per GPU, with --num-gpus since GPU count is not in result files.

Tests

compare_interactivity_gemma431b_humaneval

Checklist

I have filled in:

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan/results, such as providing test command and pasting the results.
  • (Optional) The necessary documentation update.
  • I (a human) have written or reviewed the code in this pr to the best of my ability.

Alexandre Marques and others added 2 commits July 21, 2026 17:47
Plot goodput-style curves using 1000/ITL for interactivity and system
throughput per GPU, with --num-gpus since GPU count is not in result files.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The evaluation utilities now support loading and transforming the interactivity metric, including GPU-normalized throughput and legacy CSV fallbacks. Plot commands accept --num-gpus, apply metric-specific axes, and support interactivity comparisons. The tutorial documents the updated workflow and data formats.

Interactivity performance plotting

Layer / File(s) Summary
Metric data loading and transformation
scripts/evaluate/perf_utils.py
Adds interactivity metric metadata, sweep parsing, CSV/JSON loading, legacy fallbacks, output_tps_mean, and GPU-normalized transformations.
Plot command integration
scripts/evaluate/plot.py
Adds GPU-count validation, interactivity transformation for compare and speedup plots, configurable labels, titles, CLI options, and usage examples.
Evaluation workflow documentation
docs/user_guide/tutorials/evaluating_performance.md
Documents interactivity plotting, metric calculations, GPU-count input, and newer and legacy CSV formats.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding the interactivity plot metric and its tok/s/user vs tok/s/GPU axes.
Description check ✅ Passed The description is directly related to the change and explains the new interactivity metric, num-gpus option, and documentation updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plot-interactivity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown

The quality checks have failed. Please run make style and make quality under
the root directory to address the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/speculators/blob/main/CONTRIBUTING.md

@mergify mergify Bot added documentation Improvements or additions to documentation quality-failed labels Jul 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/evaluate/perf_utils.py (1)

209-346: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding unit tests for the new interactivity pipeline.

This introduces several pure functions with meaningful branching (aggregate-vs-fallback TPS, CSV-vs-JSON-vs-artifact fallback chain, filtering non-positive ITL, num_gpus validation). No test file was included in this review batch for this logic; given the multiple fallback paths and the ValueError raised in _load_interactivity_csv, targeted unit tests (e.g. missing output_tps_mean column, missing artifacts dir, zero/negative itl_ms) would be low effort and meaningfully de-risk this new code path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/evaluate/perf_utils.py` around lines 209 - 346, Add targeted unit
tests for the interactivity pipeline, covering aggregate TPS with mean fallback,
CSV loading and artifact/JSON fallback when output_tps_mean is absent, missing
artifacts and invalid CSV raising ValueError, filtering non-positive ITL values,
and transform_interactivity rejecting non-positive num_gpus. Anchor the tests to
_system_tps_from_bench, _load_interactivity_csv, and transform_interactivity
while preserving existing valid-path behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/evaluate/perf_utils.py`:
- Around line 209-223: Update _system_tps_from_bench to read GuideLLM 0.7.1’s
actual successful output token-total field instead of
output_token_count.successful.total_sum. Preserve the existing duration-based
aggregate calculation and fallback to output_tokens_per_second.successful.mean
when the token total is unavailable.

---

Nitpick comments:
In `@scripts/evaluate/perf_utils.py`:
- Around line 209-346: Add targeted unit tests for the interactivity pipeline,
covering aggregate TPS with mean fallback, CSV loading and artifact/JSON
fallback when output_tps_mean is absent, missing artifacts and invalid CSV
raising ValueError, filtering non-positive ITL values, and
transform_interactivity rejecting non-positive num_gpus. Anchor the tests to
_system_tps_from_bench, _load_interactivity_csv, and transform_interactivity
while preserving existing valid-path behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 383ab1e1-6f64-4767-8e47-183d35f196e1

📥 Commits

Reviewing files that changed from the base of the PR and between 7b10846 and 0af154b.

📒 Files selected for processing (3)
  • docs/user_guide/tutorials/evaluating_performance.md
  • scripts/evaluate/perf_utils.py
  • scripts/evaluate/plot.py

Comment on lines +209 to +223
def _system_tps_from_bench(bench: dict) -> float | None:
"""Aggregate output tokens/s for a benchmark (not per-request median)."""
metrics = bench.get("metrics", {})
try:
out = metrics["output_token_count"]["successful"]
duration = float(bench["duration"])
total = float(out["total_sum"])
if duration > 0:
return total / duration
except (KeyError, TypeError, ValueError, ZeroDivisionError):
pass
try:
return float(metrics["output_tokens_per_second"]["successful"]["mean"])
except (KeyError, TypeError, ValueError):
return None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does guidellm 0.7.1 GenerativeBenchmark JSON output include an "output_token_count" metric with a "total_sum" field under "successful"?

💡 Result:

No, the GuideLLM 0.7.1 GenerativeBenchmark JSON output does not include an output_token_count metric with a total_sum field under a successful key [1][2][3]. While GuideLLM records extensive metrics and statistics—including output_token_count as a measurement of generated tokens [4][3]—the JSON report structure organizes its data primarily by benchmark execution, metadata, and request-level statistics [1][5][6]. Specifically, the JSON schema typically includes per-benchmark metrics for successful requests, but it does not use a nested total_sum field within a successful section as described [1][3]. Statistics such as total token counts are generally derived from the collected data during analysis or provided in summary form, rather than being explicitly structured with a total_sum field in the output JSON [5][6][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== perf_utils.py excerpt ==\n'
sed -n '200,235p' scripts/evaluate/perf_utils.py

printf '\n== references to output_token_count / output_tokens_per_second ==\n'
rg -n 'output_token_count|output_tokens_per_second|total_sum|successful' scripts/evaluate -S

printf '\n== file list around guidellm/schema mentions ==\n'
rg -n 'guidellm|generative/report|report.py|schema' -S .

Repository: vllm-project/speculators

Length of output: 16665


Use the actual GuideLLM token-total field here The output_token_count.successful.total_sum lookup doesn’t match GuideLLM 0.7.1’s JSON schema, so this branch will always fall back to output_tokens_per_second.successful.mean and the aggregate system-throughput path never runs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/evaluate/perf_utils.py` around lines 209 - 223, Update
_system_tps_from_bench to read GuideLLM 0.7.1’s actual successful output
token-total field instead of output_token_count.successful.total_sum. Preserve
the existing duration-based aggregate calculation and fallback to
output_tokens_per_second.successful.mean when the token total is unavailable.

@mgoin

mgoin commented Jul 21, 2026

Copy link
Copy Markdown
Member

I think the "per GPU" normalization isn't needed in this case since we aren't comparing different parallelism or GPU nodes. Just to simplify the process

@speculatorsbot speculatorsbot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-scoped PR. The interactivity metric implementation follows existing patterns in perf_utils.py and plot.py consistently, and the CSV/JSON/artifact fallback chain handles backward compatibility correctly.

The main open item is @mgoin's design question about whether per-GPU normalization (and the --num-gpus flag it requires) is needed. Resolving that may simplify the implementation.

DCO sign-off: Both commits (ab78007, 0af154b) are missing the required Signed-off-by line. You can fix this with git rebase --signoff main before the next push.

Recommend approving once @mgoin's question is addressed and DCO is fixed.

🤖 Generated with Claude Code using the /pr-review skill

@mergify

mergify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require approval from approved reviewers list 👀 reviews

🔴 Require approval from approved reviewers list

Waiting for any of

  • approved-reviews-by = dsikka
  • approved-reviews-by = fynnsu
  • approved-reviews-by = orestis-z
  • approved-reviews-by = rahul-tuli
  • approved-reviews-by = shanjiaz
This rule is failing.

All pull requests must have at least one approving review from a member of the approved reviewers list before merging.

  • any of:
    • approved-reviews-by = dsikka
    • approved-reviews-by = fynnsu
    • approved-reviews-by = orestis-z
    • approved-reviews-by = rahul-tuli
    • approved-reviews-by = shanjiaz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation quality-failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants