Skip to content

vllm.v1.spec_decode.metrics

Classes:

Functions:

SpecDecodingLogging

Aggregate and log spec decoding metrics.

LoggingStatLogger aggregates per-iteration metrics over a set time interval using observe() and then logs them using log() before resetting to zero.

SpecDecodingProm

Record spec decoding metrics in Prometheus.

The acceptance rate can be calculated using a PromQL query:

rate(vllm:spec_decode_num_accepted_tokens_total[\(interval]) / rate(vllm:spec_decode_num_draft_tokens_total[\)interval])

The mean acceptance length (conventionally including bonus tokens) can be calculated using:

1 + ( rate(vllm:spec_decode_num_accepted_tokens_total[\(interval]) / rate(vllm:spec_decode_num_drafts_total[\)interval]))

A per-position acceptance rate vector can be computed using

vllm:spec_decode_num_accepted_tokens_per_pos_total[\(interval] / vllm:spec_decode_num_drafts_total[\)interval]

SpecDecodingStats dataclass

Per-step iteration decoding stats from scheduler.

Each scheduler step, statistics on spec decoding performance are aggregated across requests by the scheduler and returned to the frontend in EngineCoreOutputs->SchedulerStats.

create_metric_per_engine_and_pos(metric, per_engine_labelvalues, num_positions)

Create a labeled metric child for each engine index and position.