Skip to content

server: Adding spec-decode counters to /metrics endpoint - #26389

Merged
ngxson merged 2 commits into
ggml-org:masterfrom
BLSharda:bhaviksharda/spec_dec_metrics
Aug 5, 2026
Merged

server: Adding spec-decode counters to /metrics endpoint#26389
ngxson merged 2 commits into
ggml-org:masterfrom
BLSharda:bhaviksharda/spec_dec_metrics

Conversation

@BLSharda

Copy link
Copy Markdown
Contributor

Overview

Adds speculative decoding counters to the /metrics (Prometheus) endpoint, matching the vLLM counter schema:

  • llamacpp:spec_decode_num_draft_tokens
  • llamacpp:spec_decode_num_accepted_tokens
  • llamacpp:spec_decode_num_drafts
  • llamacpp:spec_decode_num_accepted_tokens_per_pos{position="N"} — per-draft-position labeled counter; absent before
    the first completed speculative request

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, human code polished and reviewed by AI.

@github-actions github-actions Bot added documentation Improvements or additions to documentation server labels Jul 31, 2026
@BLSharda

Copy link
Copy Markdown
Contributor Author

@gaugarg-nv , can you help review?

@gaugarg-nv gaugarg-nv 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.

Does this change work fine with tools like AIPerf those use \metrics endpoint?

Comment thread tools/server/README.md Outdated
Comment on lines 1077 to 1081
| `llamacpp:spec_decode_num_draft_tokens` | Counter | Total draft tokens generated (0 when spec-decode is off). |
| `llamacpp:spec_decode_num_accepted_tokens` | Counter | Total draft tokens accepted by the target model (0 when spec-decode is off). |
| `llamacpp:spec_decode_num_drafts` | Counter | Total speculative decoding verification steps (0 when spec-decode is off). |
| `llamacpp:spec_decode_num_accepted_tokens_per_pos` | Counter | Accepted tokens per draft position (labeled `position="N"`; absent when spec-decode is off or before the first completed speculative request). |

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.

@BLSharda
BLSharda marked this pull request as ready for review August 5, 2026 04:49
@BLSharda
BLSharda requested a review from a team as a code owner August 5, 2026 04:49
@BLSharda

BLSharda commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@ggerganov, I have filed an issue #26516 for this request, can you please take a look?

@ggerganov ggerganov self-assigned this Aug 5, 2026

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ruixiang63 @ngxson PTAL too

@ruixiang63

Copy link
Copy Markdown
Member

Should we add mean_accept_length into Prometheus metrics as well?

@ngxson ngxson changed the title Adding spec-decode counters to /metrics endpoint server: Adding spec-decode counters to /metrics endpoint Aug 5, 2026
@ngxson
ngxson merged commit a035a88 into ggml-org:master Aug 5, 2026
23 of 26 checks passed
@BLSharda

BLSharda commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Should we add mean_accept_length into Prometheus metrics as well?

It can be derived from existing counters as 1 + num_accepted_tokens_total / num_drafts_total so there isn’t much value in tracking it separately. AIPerf already uses the same formula to compute it internally.

satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 11, 2026
)

* * server: add spec-decode counters to /metrics endpoint

* server: fixed review comments and now aligned param names exactly with vLLM.
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
)

* * server: add spec-decode counters to /metrics endpoint

* server: fixed review comments and now aligned param names exactly with vLLM.
huaxel pushed a commit to huaxel/CachyLLama that referenced this pull request Aug 12, 2026
)

* * server: add spec-decode counters to /metrics endpoint

* server: fixed review comments and now aligned param names exactly with vLLM.
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 server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants