research: predict prompt-plus-output demand for downstream pool admission
#2,551 opened on Jul 15, 2026
Repository metrics
- Stars
- (4,293 stars)
- PR merge metrics
- (PR metrics pending)
Description
Motivation
Investigate whether a pre-dispatch estimate of prompt-plus-output demand improves downstream pool admission, spillover, or sizing. The estimate is a hint for the serving/LB layer after per-query semantic routing, not a capacity solver inside model selection.
Audited upstream baseline (2026-07-15)
- Router Replay and response processing can record actual prompt/completion usage after completion.
pkg/sessiontelemetryprovides bounded historical session aggregates.- FleetSim workloads/CDFs model token demand offline.
- Current
maindoes not expose a calibrated pre-dispatch total-token predictor with uncertainty and downstream acknowledgement. - Architecture decision #2513 keeps capacity-aware endpoint selection below semantic routing.
Research scope
- Define the target and timing precisely: input/prompt tokens, expected output distribution, and total demand before dispatch.
- Establish simple baselines: prompt length, requested
max_tokenscap, route/domain bucket, and session moving average. - Train/evaluate only on versioned, leakage-safe replay projections; retain uncertainty and calibration by model/domain/workload.
- Let semantic routing choose the preferred logical model. If an ordered logical-model fallback contract is later implemented through #2294, version and evaluate it separately.
- Emit the demand estimate, interval, model/config version, and freshness as a downstream LB/admission hint.
- Record downstream acknowledgement, actual usage, truncation/cancellation, and residual for calibration.
- Feed aggregate residuals into offline FleetSim sizing and threshold evaluation.
Boundaries
- Do not choose a pool or solve capacity constraints in
pkg/extprocor semantic model selection. - The estimate cannot override authorization, residency, safety, or context-window limits.
- Requested output caps are upper bounds, not labels for actual output.
- Missing/stale/uncertain predictions fall back to a documented conservative baseline.
- The derived training projection does not require raw prompts/responses by default; existing Router Replay retention remains separately configured.
Acceptance criteria
- Target, censoring, cancellation, and missing-usage semantics are documented.
- Leakage-safe splits and simple baselines are reported with calibration/uncertainty.
- Prediction latency and hot-path allocation are bounded.
- Downstream consumers capability-negotiate the hint and acknowledge use/no-use.
- Replay separates estimate, downstream decision, and actual demand.
- FleetSim evaluation shows whether the estimate materially changes SLO/capacity outcomes.
- E2E tests cover streaming, cancellation, absent usage, partial deployment, and fallback.
Likely change surfaces
src/semantic-router/pkg/sessiontelemetry/, src/semantic-router/pkg/routerreplay/, src/semantic-router/pkg/extproc/, observability/export, src/fleet-sim/fleet_sim/workload/, src/fleet-sim/fleet_sim/routing/, LB integration docs, and tests.
Related: #2294, #2332, #2359, #2513, #2550, #2552.
Validation entrypoint
make agent-report ENV=cpu CHANGED_FILES="<space-separated changed files>"
Follow the reported gates and affected E2E profiles.