UPSTREAM PR #18265: server: add real-time prompt preprocessing progress via synthetic SSE chunks#654
Closed
loci-dev wants to merge 1 commit into
Conversation
26a6f0f to
cf53bc9
Compare
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.
Mirrored from ggml-org/llama.cpp#18265
Make sure to read the contributing guidelines before submitting a PR
Adds --prompt-progress-ms flag to stream synthetic progress chunks during prompt preprocessing for smooth UI progress bars.
We have a working GGML scheduler callback (cb_eval) that fires during graph execution, giving me precise timing for SSE throttling at X ms (customizable) intervals. Now I need accurate token-level progress tracking for the processed field.
Two approaches are possible:
Approach 1: Time-based estimation (self-adaptive)Not acceptable for production quality.Track last_progress_ms and last_processed to calculate a dynamic rate. Each chunk updates the rate based on total elapsed time divided by total processed tokens so far. This self-corrects over time and works without any core changes.
Problem: This relies on the assumption that processing speed is constant. If the GPU changes speed mid-prompt (thermal throttling, other processes, batch size variations), the estimation lags behind reality.
Approach 2: Token-level callback in llama.cpp core
Add a proper callback mechanism in llama_context::decode() that reports actual token progress during the decoding loop. This would give real-time accuracy regardless of speed variations.
Currently exploring this approach: implementation in progress.
Setup (A 100% CPU model added on a testing-server for easier testing) :
Backend testing command
Close #17079