Repository navigation
[Serve][LLM][3/3] Token based autoscaling: scale the bound server from router token metrics - #67941
Open
celinaky wants to merge 14 commits into
Conversation
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 7, 2026 09:43
0f72a20 to
39ef527
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
2 times, most recently
from
November 8, 2026 18:59
8acca59 to
579aa83
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
2 times, most recently
from
November 8, 2026 20:58
bfcdeaf to
f7e066d
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
4 times, most recently
from
November 9, 2026 18:33
03510d1 to
422aeff
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 9, 2026 19:18
422aeff to
5f7a98b
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
2 times, most recently
from
November 9, 2026 19:44
1bec553 to
fa16d11
Compare
This was referenced Nov 9, 2026
celinaky
marked this pull request as ready for review
November 11, 2026 19:16
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the LLMTokenAutoscalingPolicy to scale LLM deployments based on outstanding uncached prefill tokens, along with its unit tests. The feedback highlights a potential TypeError if ctx.total_queued_requests is None at runtime, suggesting a defensive fallback to 0 and a corresponding test case to verify this behavior.
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 13, 2026 06:37
87308f7 to
b015e52
Compare
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 13, 2026 08:57
b015e52 to
07cf4fa
Compare
jeffreywang88
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 13, 2026 19:39
07cf4fa to
2f19d06
Compare
Signed-off-by: Celina Yang <[email protected]>
celinaky
force-pushed
the
celina/prefill-token-autoscaling-3-policy
branch
from
November 20, 2026 16:43
fa21bce to
a5fb96d
Compare
…policy Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
…policy Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
…policy Signed-off-by: Celina Yang <[email protected]>
…policy Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
…policy Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
Signed-off-by: Celina Yang <[email protected]>
…policy Signed-off-by: Celina Yang <[email protected]>
This branch has not been deployed
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.
Token-based autoscaling stack
Changes in this PR
LLMRouter. Serve pollsrecord_autoscaling_stats(), which reads the tracker's current snapshot and includes the bound server name in the metric key.contexts[router_id].aggregated_metricsfrom the router’sAutoscalingMetricsContext. It resolves the bound server and verifiesisinstance(contexts[target_id], AutoscalingContext)before using the server’s scaling settings. Router replicas see overlapping views of the same workload, so Serve computes a time-weighted mean token load for each router replica over its reporting window, and the policy uses the largest of those means. It divides by the configured token target and rounds up to obtain the desired server count. The bound server's scaling limits and delays apply.This updates the existing policy PR to consume #67938's replica reporting path in response to review.
Example
For a cluster configured for KV-aware direct streaming, set
autoscaling_policyon the application andautoscaling_configon the LLM server.Verification
The mixed-context regression exercises the application-policy wrapper with a readable router and a scalable server, including rejection of a router scaling decision. Across the two PRs, the focused custom-metrics, policy, config, and deployment-state tests yielded 518 passed and 12 skipped.
pytest -q python/ray/serve/tests/unit/test_llm_token_autoscaling_policy.py— 4 passed, including a router report reaching the controller and producing a decision for its bound server.pytest -q python/ray/serve/tests/unit/test_autoscaling_policy.py— 47 passed. Repository pre-commit checks passed.vllm.entrypoints.common.Developed with AI assistance.