Skip to content

feat(metrics): read the three-second tg_3s rate for engine speed - #277

Merged
outofcoffee merged 5 commits into
mainfrom
feat/prefer-tg-3s-speed
Nov 2, 2026
Merged

outofcoffee merged 5 commits into
mainfrom
feat/prefer-tg-3s-speed

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

The Speed row now answers "how fast is it generating now" instead of showing the whole-task average.

Summary

  • ParseGenerationSpeed reads llama.cpp's three-second tg_3s rate when the timing line carries a usable one, falling back to the whole-task tg average otherwise — so a rate that has just changed reads now rather than after the task average catches up.
  • Older engines that print only tg (and any engine printing tg-shaped timing lines) keep reporting exactly as before.
  • An unusable tg_3s — the 0.00/-nan llama.cpp prints before a slot's first token — falls through to tg rather than quenching the line.
  • OpenSpec change prefer-tg-3s-generation-speed proposes the delta to engine-metrics (the "An average is not the current rate" scenario's rejected average becomes the whole-task tg); docs, internals and the OpenAPI stat description follow the parser.

Implementation details

Two narrow patterns tried in precedence order, rather than one alternation: each label's pattern stays separately testable and the existing boundary pins (\btg\s*= cannot match tg_3s =, \b stops print_tg_3s, and a longer tg_30s breaks the literal) are untouched. The validity filter is shared, so "usable" means the same plausible-positive rate it always did.

The whole-task tg average lags a rate that has just changed by minutes;
llama.cpp now also prints tg_3s, a three-second rolling figure that
answers how fast the engine is generating now. Read tg_3s where the
timing line carries a usable one and fall back to tg otherwise, so
older engines and other rate sources keep reporting unchanged.
@outofcoffee outofcoffee added the enhancement New feature or request label Nov 2, 2026
@outofcoffee
outofcoffee marked this pull request as ready for review November 2, 2026 18:42
@outofcoffee
outofcoffee merged commit a9c12c1 into main Nov 2, 2026
5 checks passed
@outofcoffee
outofcoffee deleted the feat/prefer-tg-3s-speed branch November 2, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant