Remove misleading totalTokensPerSecond metric#11
Merged
Conversation
Output TPS (outputTokens / output window duration) is the meaningful throughput metric. Total TPS included input tokens in the numerator, producing misleading numbers — removed from stats calculation, types, UI rendering, and all tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Remove
totalTokensPerSecondfrom stats calculation, type definitions, UI, and tests. Keep onlyoutputTokensPerSecond.Why
totalTokensPerSecond=totalTokens / requestDurationwheretotalTokensincludes input tokens. Input tokens aren't "generated" during the request — they're prompt/prefill. This inflates the number and makes it semantically meaningless.For example: 10k input + 200 output over 5s → Total TPS = 2040 tok/s, but actual generation speed is ~40 tok/s.
outputTokensPerSecond=outputTokens / (completedAt - firstStreamTokenAt)is the correct and useful throughput metric.Changes
stats.ts: RemovetotalTokensPerSecondcalculation andrequestDurationForRateMsmessages.ts: Remove field fromAssistantResponseStatstypecontent-normalize.ts: Remove deserialization of the fieldmessage-renderer.ts: Remove "Total TPS" row from stats paneltotalTokensPerSecondassertions