Repository navigation
[Feat] deepseek-v4.1: Add experimental resident-weight recovery and warm standby - #44241
Open
number-eleven11 wants to merge 5 commits into
Open
number-eleven11 wants to merge 5 commits into
number-eleven11 wants to merge 5 commits into
Conversation
added 4 commits
October 14, 2026 15:15
3 of 5 tasks
number-eleven11
marked this pull request as ready for review
October 14, 2026 08:50
number-eleven11
requested review from
BBuf,
Edwardf0t1,
Fridge003,
HaiShaw,
Ying1123,
alexnails,
b8zhong,
ch-wan,
hnyls2002,
ispobock,
liusy58,
merrymercy and
mmangkad
as code owners
October 14, 2026 08:50
3 of 5 tasks
This was referenced Oct 26, 2026
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.
Motivation
This PR extends the existing Weight Cache Daemon feature introduced in
#27139 and described in
Fast Engine Recovery: Sub-Second Engine Restart for SGLang via Weight Cache Daemon
to DeepSeek V4.1, with Engram in either GPU or host memory.
The article addresses the repeated checkpoint I/O and weight processing paid on
every engine restart, which prolong service outages during worker failures and
rolling updates. It retains processed weights in a persistent daemon and lets
replacement engines reuse them through CUDA IPC. This PR builds on that feature
and addresses the gaps that prevent the same recovery path from working for V4.1.
Why this extension is needed:
post-load layouts, quantization metadata and cached tensor references that a
replacement engine must restore consistently. Related failures are documented
in #39794. This PR restores
the processed state, rebinds mHC and TopK references, and checks backend/layout
compatibility instead of merely relaxing the IPC admission check or repeating
transforms on shared weights.
share its host backing. This PR preserves daemon-owned host tables and imports
them in replacement workers; optional HOST_NUMA VMM reuses allocation handles
to avoid repeated
cudaHostRegisteron unchanged tables.InstantTensor and positioned-read PRs below accelerate loading from storage.
This PR complements them by reusing already processed GPU weights and host
Engram after a worker restart, while the daemon survives. Their cold-load
optimizations can still benefit initial daemon startup, but are not included
in this patch.
The result is a V4.1-specific implementation of the article's resident-weight
recovery path, plus an experimental prewarmed standby for its active-standby
scenario. Complete weight reload and service recovery results are reported below;
full long-context acceptance and other remaining gates are still pending.
Related work
preadv; this PR addresses resident recovery and mapping reuse instead.Speed Tests and Profiling
Engram in GPU memory
Disk reload compared with resident CUDA IPC recovery:
Values are medians: two final matched disk runs and three recovery runs.
Compilation/autotuning caches were warm. The weight reload covers the entire
main model, including Engram and post-load state; service recovery also includes
communication, KV and runtime initialization.
Engram in shared host memory
Host recovery values are medians of three runs; the shared-table disk baseline
has one sample. Shared tables and per-rank shards are separate experiments:
85.45 s is not a matched baseline for 3.36 s. Exact process-launch to healthy
service time was not measured for the host VMM comparison; its readiness timer
starts after the launch helper returns.
Both placements require an already loaded, surviving daemon for optimized
recovery; initial daemon startup is excluded.
An already prewarmed standby provided its first response token 0.205–0.422 s after active-launcher SIGKILL in the memfd experiment. This is standby takeover, not a new worker reload. VMM plus standby has not yet had a combined full-model fault-injection run.
Setup: four NVIDIA L20D GPUs, TP4/EP1/attention-DP1, native FP8 dense/FP4 expert,
flashinfer_mxfp4/dsv4, vision disabled, context 4096, maximum four requests, CUDA Graph and overlap disabled. The VMM experiment used private KV capacity 8192 per worker.Modifications
memfdand optionalcuda_vmmbackends. VMM clients map GPU views of the same physical host allocation without copying it or repeating host registration.Upgrade note: restart the weight daemon after upgrading recovery source, then start clients from the same source/configuration. Clients reject a cache produced by different recovery code; the old daemon's processed state is not silently accepted.
Accuracy Tests
72 CPU tests pass (8 host VMM, 6 host FD, 17 model-state/compatibility, 32 protocol, 9 standby). The new regression test verifies that changes to recovery lifecycle and quantization source invalidate the compatibility fingerprint. Earlier revisions passed upstream lint; the latest revision is submitted to CI. GPU timings are from the frozen experiments and were not rerun after the final compatibility-check hardening.
For the host VMM comparison, all 30 prompt comparisons matched text and input/output token IDs; 24/30 also matched logprobs exactly. The 1401-token prompt differed even in a memfd same-service repeat, so strict long-context numerical acceptance remains unresolved. Short prompts and the 385-token case were exact. Host gather and shared-table CUDA Graph component checks passed; full-model CUDA Graph/shared-layout validation is pending.
Limitations
The feature remains explicitly opt-in and experimental. The experiment used sglang-kernel 0.4.7 with the source's expected 0.4.9 version check bypassed; aligned-dependency validation is pending. Full-capacity throughput, draft/speculative execution and other topologies remain unvalidated. The daemon must survive, and same-GPU standby workers do not isolate GPU faults. In-flight requests/KV state are not recovered. Initial daemon host allocation costs remain; this does not implement #42920's parallel checkpoint reads.
Checklist
run-cilabel.CI States
Latest PR Test (Base): ❌ Run #38537918009
Latest PR Test (Extra): ❌ Run #38537918119
Latest PR Test (AMD ROCm 10): ❌ Run #38537917934