server: fix prefill speed regression on session resumption - #25417
Closed
SakshamKapoor2911 wants to merge 1 commit into
Closed
server: fix prefill speed regression on session resumption#25417SakshamKapoor2911 wants to merge 1 commit into
SakshamKapoor2911 wants to merge 1 commit into
Conversation
SakshamKapoor2911
force-pushed
the
fix-prefill-speed-regression
branch
from
July 15, 2026 03:17
42e3ef8 to
a1c5cd8
Compare
SakshamKapoor2911
force-pushed
the
fix-prefill-speed-regression
branch
from
July 17, 2026 14:48
a1c5cd8 to
ceb99ac
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.
Overview
This PR resolves the prefill speed regression on session resumption (Issue #25213).
Previously, the prefill batch loop in
server-context.cppunconditionally split the batch at any user message start boundary. When resuming a session, this caused the prefill sequence to be fragmented into many tiny batches, severely bottlenecking GPU prefill throughput.This PR optimizes prefill batching and adds dynamic tool start detection to prevent unnecessary batch splitting:
checkpoint_min_step).detect_tool_response_start_markerto ensure tool outputs are not misclassified as user roles.checkpoint_min_stepfrom8192back to256tokens.Additional information
./build/bin/test-chat-auto-parser(98 tests, 537 assertions passed).bash tools/server/tests/tests.sh(290 tests passed).Requirements
server-context.cpp, update delimiter sorting inchat.cpp, implement the tool response start detector inchat-diff-analyzer.cpp, and populate the expected test cases intest-chat-auto-parser.cpp. All changes have been compiled, run, and verified locally by the human contributor.