[PR #83] [CLOSED] serve: llama-server-style timings on responses (prefill/decode rates for llama-swap & friends) #2444

Closed
opened 2026-11-04 02:00:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/83
Author: @mikicvi
Created: 9/28/2026
Status: ❌ Closed

Base: main ← Head: llama-timings


📝 Commits (2)

  • 0dd2285 serve: llama-server-style timings on responses, for llama-swap and friends
  • 9e277dd Merge branch 'main' into llama-timings

📊 Changes

1 file changed (+24 additions, -2 deletions)

View changed files

📝 serve/server.py (+24 -2)

📄 Description

The engine already reports per-request prompt/decode timings, conversation-cache reuse and draft counts on its DONE line, but those numbers stayed inside server.py. This emits them everywhere the usage object already goes, in llama-server's dialect — a top-level timings object on the final streamed chunk, the non-streaming response, and the Anthropic message_delta:

"timings": {"prompt_n": 10597, "prompt_ms": 22683.0, "prompt_per_second": 467.3,
            "predicted_n": 64, "predicted_ms": 3248.0, "predicted_per_second": 19.7,
            "cache_n": 0, "draft_n": 59, "draft_n_accepted": 32}

(cache_n/draft_* only when the engine reported them.)

Why: proxies and monitors that chart per-request prefill/decode speed read exactly this shape — llama-swap's activity log (the llama-server, vLLM and TabbyAPI dialects it accepts), and anything else that already understands llama.cpp responses. Without it, Strata requests show token counts but unknown rates. Nothing else changes: fields are additive, and clients that don't know timings ignore it.

Verified end to end through llama-swap v257: streaming and non-streaming /v1/chat/completions, and /v1/messages, all produce activity rows with prefill/decode rates, cached-token counts on reused prompts, and draft acceptance — e.g. a 10.6k-token request charts PP 467 t/s, decode 19.7 t/s, drafts 32 of 59 accepted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/83 **Author:** [@mikicvi](https://github.com/mikicvi) **Created:** 9/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `llama-timings` --- ### 📝 Commits (2) - [`0dd2285`](https://github.com/Niko1221/Strata/commit/0dd2285f813dceafcb9e631108171a7b4ea1208f) serve: llama-server-style timings on responses, for llama-swap and friends - [`9e277dd`](https://github.com/Niko1221/Strata/commit/9e277dd04129342f52095ec395100297181aa83b) Merge branch 'main' into llama-timings ### 📊 Changes **1 file changed** (+24 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+24 -2) </details> ### 📄 Description The engine already reports per-request prompt/decode timings, conversation-cache reuse and draft counts on its `DONE` line, but those numbers stayed inside `server.py`. This emits them everywhere the `usage` object already goes, in llama-server's dialect — a top-level `timings` object on the final streamed chunk, the non-streaming response, and the Anthropic `message_delta`: ```json "timings": {"prompt_n": 10597, "prompt_ms": 22683.0, "prompt_per_second": 467.3, "predicted_n": 64, "predicted_ms": 3248.0, "predicted_per_second": 19.7, "cache_n": 0, "draft_n": 59, "draft_n_accepted": 32} ``` (`cache_n`/`draft_*` only when the engine reported them.) Why: proxies and monitors that chart per-request prefill/decode speed read exactly this shape — llama-swap's activity log (the llama-server, vLLM and TabbyAPI dialects it accepts), and anything else that already understands llama.cpp responses. Without it, Strata requests show token counts but `unknown` rates. Nothing else changes: fields are additive, and clients that don't know `timings` ignore it. Verified end to end through llama-swap v257: streaming and non-streaming `/v1/chat/completions`, and `/v1/messages`, all produce activity rows with prefill/decode rates, cached-token counts on reused prompts, and draft acceptance — e.g. a 10.6k-token request charts PP 467 t/s, decode 19.7 t/s, drafts 32 of 59 accepted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:00:11 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2444
No description provided.