Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
79ac59f3
Unverified
Commit
79ac59f3
authored
Sep 11, 2025
by
Andrew Xia
Committed by
GitHub
Sep 11, 2025
Browse files
Update Spec Decode metrics to include drafted and accepted token throughput (#24127)
Signed-off-by:
Andrew Xia
<
axia@meta.com
>
parent
b971f915
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
vllm/v1/spec_decode/metrics.py
vllm/v1/spec_decode/metrics.py
+16
-3
No files found.
vllm/v1/spec_decode/metrics.py
View file @
79ac59f3
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import
time
from
dataclasses
import
dataclass
,
field
from
typing
import
Optional
...
...
@@ -58,6 +59,7 @@ class SpecDecodingLogging:
self
.
num_draft_tokens
:
list
[
int
]
=
[]
self
.
num_accepted_tokens
:
list
[
int
]
=
[]
self
.
accepted_tokens_per_pos_lists
:
list
[
list
[
int
]]
=
[]
self
.
last_log_time
=
time
.
monotonic
()
def
observe
(
self
,
spec_decoding_stats
:
SpecDecodingStats
):
self
.
num_drafts
.
append
(
spec_decoding_stats
.
num_drafts
)
...
...
@@ -73,6 +75,13 @@ class SpecDecodingLogging:
num_drafts
=
np
.
sum
(
self
.
num_drafts
)
num_draft_tokens
=
np
.
sum
(
self
.
num_draft_tokens
)
num_accepted_tokens
=
np
.
sum
(
self
.
num_accepted_tokens
)
draft_throughput
=
0
accepted_throughput
=
0
elapsed_time
=
time
.
monotonic
()
-
self
.
last_log_time
if
elapsed_time
>
0
:
draft_throughput
=
num_draft_tokens
/
elapsed_time
accepted_throughput
=
num_accepted_tokens
/
elapsed_time
draft_acceptance_rate
=
(
num_accepted_tokens
/
num_draft_tokens
*
100
if
num_draft_tokens
>
0
else
float
(
"nan"
))
...
...
@@ -86,16 +95,20 @@ class SpecDecodingLogging:
log_fn
(
"SpecDecoding metrics: "
"Draft acceptance rate: %.1f%%, "
"Mean acceptance length: %.2f, "
"Accepted throughput: %.2f tokens/s, "
"Drafted throughput: %.2f tokens/s, "
"Accepted: %d tokens, "
"Drafted: %d tokens, "
"Per-position acceptance rate: %s
"
,
d
raft
_
acceptance
_
rate
,
"Per-position acceptance rate: %s,
"
"Avg D
raft
acceptance
rate
: %.1f%%"
,
mean_acceptance_length
,
accepted_throughput
,
draft_throughput
,
num_accepted_tokens
,
num_draft_tokens
,
rates_str
,
draft_acceptance_rate
,
)
self
.
reset
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment