Skip to content

feat(scheduler): persist learned graph costs across serving restarts - #301

Draft
shadownetX wants to merge 1 commit into
NVIDIA:mainfrom
shadownetX:feature/scheduler-cost-cache
Draft

shadownetX wants to merge 1 commit into
NVIDIA:mainfrom
shadownetX:feature/scheduler-cost-cache

Conversation

@shadownetX

Copy link
Copy Markdown
Contributor

Motivation

Following the investigation in #288, I noticed that some of the longest interruptions during concurrent streaming occurred while the scheduler was discovering graph execution costs.

These costs are learned during serving but discarded on every restart, even when the model, hardware, and execution configuration remain unchanged.

Persisting compatible estimates should improve startup streaming stability and make scheduling more predictable across serving restarts.

Changes

  • Persist learned graph durations across clean shutdowns.
  • Restore compatible estimates as known but stale.
  • Preserve existing timing refresh and acceptance-learning mechanisms.
  • Automatically reject incompatible caches.
  • Fall back to normal discovery when no valid cache is available.

The cache is scoped to the model core, GPU, runtime executable, driver, and execution configuration. No request state or token histories are persisted.

No additional configuration, environment variable, or model export is required.

Results

Tests were performed on a single NVIDIA DGX Spark (GB10), using Qwen3.8 Flash Next FP4 with DFlash2 MXFP8.

The workload consists of three overlapping streaming requests with 8K, 32K, and 64K input contexts, repeated three times per cache condition, without prefix-cache reuse.

Runtime Initial maximum gap (empty → restored) Reduction
v0.1.0 4,355 → 559 ms 87.2%
Main 4,530 → 1,372 ms 69.7%
Main with #285 checkpoint changes reverted 4,528 → 465 ms 89.7%

Number of streaming gaps exceeding 500 ms:

Runtime First repetition (empty → restored) All three repetitions (empty → restored)
v0.1.0 39 → 4 44 → 10
Main 25 → 52 79 → 62
Main with #285 checkpoint changes reverted 23 → 0 24 → 65

Across all three configurations, scheduler counters recorded approximately 3.35 seconds of discovery execution during the largest initial interruption with an empty cache. No discovery execution was recorded during the corresponding maximum gaps after restoration.

The native implementation successfully persisted and restored 28 graph duration estimates.

Interaction with #285

The v0.1.0 prototype demonstrates a substantial and consistent reduction in long streaming interruptions.

On main, graph cost persistence works, but the streaming stability improvements observed on v0.1.0 are not fully reproduced.

To investigate this difference, I experimentally reverted the checkpoint scheduling changes introduced by #285 in helios/src/scheduler/checkpoints.rs, while keeping the rest of main unchanged.

This restored startup behavior comparable to v0.1.0, with a maximum initial interruption of 465 ms and no streaming gaps exceeding 500 ms during the first restored-cache workload.

However, interruptions returned during subsequent repetitions. These observations suggest an interaction with checkpoint scheduling, but further investigation is needed to establish its precise cause.

This PR preserves #285 and does not include the experimental revert.

Regardless of these differences, the motivation remains unchanged: avoid repeating graph cost discovery after every restart and improve startup scheduling stability.

Validation

  • ARM64 release build passed.
  • Targeted scheduler and persistence tests passed.
  • Helios lifecycle checks passed.
  • Existing signed model core loaded without re-export.
  • All measured requests passed workload validation.

Limitations

Hardware validation is limited to single-device GB10 serving under Linux. Multi-GPU and Windows persistence are not implemented.

The broader native test suite was not fully green during validation on main, although the targeted tests passed.

This contribution addresses repeated startup cost discovery rather than general scheduling latency or decode throughput. Further investigation of the remaining streaming interruptions is outside the scope of this PR.

Concurrent streaming can stall while the scheduler discovers graph execution
costs after a restart. Previously measured costs are discarded even when the
model, hardware and execution configuration are unchanged.

Persist physical graph duration estimates after clean drain and restore
compatible estimates as known but stale before admission. Retain live timing
feedback and refresh rules without carrying request-local acceptance state
across sessions. Scope the bounded atomic cache to the authenticated core,
GPU, runtime executable, driver and graph catalog. Missing or incompatible
records leave the scheduler unmeasured. No model export or user configuration
changes are required.

The expected benefit is more predictable startup scheduling with fewer
discovery-related streaming stalls. On v0.1.0, restoring the cache reduced the
initial maximum streaming gap from 4,365 ms to 559 ms. On main, restoring
28 estimates reduced it from 4,530 ms to 1,372 ms; ordinary scheduling
interruptions remain, so the v0.1.0 improvement is not reproduced in full.

Both measurements used a single GB10 DGX Spark, Qwen3.8 Flash Next FP4 with
DFlash2 MXFP8, and overlapping 8K, 32K and 64K streaming requests without
prefix reuse. The ARM64 release build, targeted scheduler and persistence
tests, Helios lifecycle checks and workload validation passed. An existing
signed core loaded without re-export. The broader native suite was not
fully green. Multi-device and Windows persistence are not implemented.

Co-authored-by: ChatGPT <support@openai.com>
Design-Signed-Off-By: ChatGPT (GPT-6); design-review=ed22
Signed-off-by: vonP <thomas@picollin.fr>
@original-el8 original-el8 added area:caching Prefix/KV reuse, cache retention, and model or payload cache behavior. area:scheduling Request scheduling, fairness, batching, and speculative-width selection. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration. labels Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:caching Prefix/KV reuse, cache retention, and model or payload cache behavior. area:scheduling Request scheduling, fairness, batching, and speculative-width selection. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants