Skip to content

TTFT aware Latency Scorer - #188

Open
Mohammad-nassar10 wants to merge 29 commits into
llm-d:mainfrom
Mohammad-nassar10:queue-ttft-scorer
Open

TTFT aware Latency Scorer#188
Mohammad-nassar10 wants to merge 29 commits into
llm-d:mainfrom
Mohammad-nassar10:queue-ttft-scorer

Conversation

@Mohammad-nassar10

@Mohammad-nassar10 Mohammad-nassar10 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a new ttft-aware-scorer that routes each request to the model with the lowest predicted TTFT under current load.

It reads the per-model snapshot published by the ttft-percentile-extractor — the service floor P10Low, the operating points P25/P50, and their in-flight anchors inflightAtP25/inflightAtP50 — and predicts the effective TTFT for a request arriving now as a line through the high operating point (inflightAtP50, P50) and a low anchor blended between the in-cloud point (inflightAtP25, P25) and the load-free floor (0, P10Low):

w             = clamp((inflightAtP50 - inflightAtP25) / anchorGapScale, 0, 1)
lowInflight   = w * inflightAtP25
lowTTFT       = w * P25 + (1 - w) * P10Low
effectiveTTFT = lowTTFT + (inflight - lowInflight) * (P50 - lowTTFT) / (inflightAtP50 - lowInflight)

Models are then scored (maxTTFT - effectiveTTFT) / (maxTTFT - minTTFT). Under-observed (uncalibrated) models are seeded optimistically at the best observed TTFT; with optional explorationRate, each under-observed model is independently given that probability of being forced to the top score so it receives a calibration probe — preventing a cold pool from being starved by an already-calibrated one.

Parameters: explorationRate (default 0, disabled) and anchorGapScale (default 2).

Depends on PR #204.

Which issue(s) this PR fixes:

Fixes #54.

Release note (write NONE if no user-facing change):

NONE

Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@Mohammad-nassar10
Mohammad-nassar10 marked this pull request as draft June 22, 2026 11:43
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jun 22, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Large PR detected

Your PR is large. Please consider breaking it into multiple PRs.

The do-not-merge/hold label has been added and can be removed by the reviewers based on their judgement.

Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@nirrozenbaum nirrozenbaum removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 22, 2026
Comment thread examples/plot_capacity.py Outdated
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Comment thread examples/medianttft-values.yaml Outdated
Comment thread pkg/framework/plugins/modelselector/scorer/queuettft/README.md Outdated

@ronenkat ronenkat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is missing algorithm style documentation to help understand the intent of the code.

Comment thread pkg/framework/plugins/datalayer/ttftpercentile/plugin.go Outdated
Comment thread pkg/framework/plugins/datalayer/ttftpercentile/plugin.go Outdated
Comment thread pkg/framework/plugins/datalayer/ttftpercentile/plugin.go Outdated
Comment thread pkg/framework/plugins/datalayer/ttftpercentile/plugin.go Outdated
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@github-actions github-actions Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 29, 2026
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 1, 2026
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Comment thread pkg/handlers/response.go
Comment thread cmd/runner/runner.go
Comment thread config/charts/payload-processor/templates/config.yaml Outdated
Signed-off-by: Mohammad-nassar10 <79787844+Mohammad-nassar10@users.noreply.github.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@Mohammad-nassar10 Mohammad-nassar10 changed the title Queue TTFT Latency Scorer Load aware TTFT Latency Scorer Jul 2, 2026
@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jul 2, 2026
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@Mohammad-nassar10 Mohammad-nassar10 changed the title Load aware TTFT Latency Scorer TTFT aware Latency Scorer Jul 2, 2026
@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jul 2, 2026
Signed-off-by: Mohammad-nassar10 <79787844+Mohammad-nassar10@users.noreply.github.com>
Comment thread pkg/framework/plugins/modelselector/scorer/ttftaware/plugin.go
Comment thread pkg/framework/plugins/modelselector/scorer/ttftaware/plugin.go Outdated
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jul 25, 2026
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
Signed-off-by: Mohammad <mohammad.nassar@ibm.com>
@github-actions

Copy link
Copy Markdown

This PR is marked as stale after 21d of inactivity. After an additional 14d of inactivity (7d to become rotten, then 7d more), it will be closed. To prevent this PR from being closed, add a comment or remove the lifecycle/stale label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Latency-Based Model Routing

4 participants