Skip to content

vllm.benchmarks.plot

Generate plots for benchmark results.

Functions:

construct_timeline_data(requests_data, itl_thresholds, labels)

Construct timeline data from request results.

Parameters:

  • requests_data

    (list[dict[str, Any]]) –

    List of per-request result dictionaries

  • itl_thresholds

    (list[float]) –

    ITL thresholds in seconds

  • labels

    (list[str]) –

    Labels for ITL categories

Returns:

generate_dataset_stats_plot(results, output_path)

Generate a matplotlib figure with dataset statistics.

Creates a figure with 4 subplots: - Top-left: Prompt tokens distribution (histogram) - Top-right: Output tokens distribution (histogram) - Bottom-left: Prompt+output tokens distribution (histogram) - Bottom-right: Stacked bar chart (request_id vs tokens)

Parameters:

  • results

    (list[dict[str, Any]]) –

    List of per-request result dictionaries containing: - prompt_len: Number of prompt tokens - output_tokens: Number of output tokens

  • output_path

    (Path) –

    Path where the figure will be saved

generate_timeline_plot(results, output_path, colors=None, itl_thresholds=None, labels=None)

Generate an HTML timeline plot from benchmark results.

Parameters:

  • results

    (list[dict[str, Any]]) –

    List of per-request result dictionaries containing: - start_time: Request start time (seconds) - ttft: Time to first token (seconds) - itl: List of inter-token latencies (seconds) - latency: Total request latency (seconds) - prompt_len: Number of prompt tokens - output_tokens: Number of output tokens

  • output_path

    (Path) –

    Path where the HTML file will be saved

  • colors

    (list[str] | None, default: None ) –

    List of colors for ITL categories (default: green, orange, red, black)

  • itl_thresholds

    (list[float] | None, default: None ) –

    ITL thresholds in seconds (default: [1.0, 4.0, 6.0])

  • labels

    (list[str] | None, default: None ) –

    Labels for ITL categories (default based on thresholds)