Add Mooncake Store file-level weight connector for SGLang#30728
Open
xianzhiT wants to merge 1 commit into
Open
Add Mooncake Store file-level weight connector for SGLang#30728xianzhiT wants to merge 1 commit into
xianzhiT wants to merge 1 commit into
Conversation
Implement a file-level weight caching connector that loads model weights
directly from a remote MooncakeStore over RDMA via `--model mooncake://<ckpt>
--load-format remote`, without staging weight files to local disk.
- connector/mooncake_store_file.py: MooncakeStoreFileConnector. Reads
safetensors headers from Mooncake chunks, identifies tensor boundaries from
`data_offsets`, coalesces each tensor batch into a single get_into_ranges()
call against a reused registered buffer (on the target CUDA device), and
yields (name, tensor) to DefaultLoader. Only metadata/tokenizer/config files
are materialized locally.
- connector/__init__.py: register the `mooncake://` scheme.
- model_loader/loader.py: pass model_loader_extra_config through to the
remote connector.
- configs/model_config.py: resolve remote model config/tokenizer files and
propagate the Mooncake store config (also via MOONCAKE_WEIGHT_STORE_CONFIG
env) to the loader.
- server_args.py: derive a filesystem-safe served_model_name for remote
(`mooncake://`) model paths.
- managers/{scheduler,tokenizer_manager,tp_worker}.py: thread remote tokenizer
metadata paths through the manager processes.
- test: connector unit tests.
xianzhiT
requested review from
Ying1123,
b8zhong,
hnyls2002,
merrymercy and
xiezhq-hermann
as code owners
July 10, 2026 03:05
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
13 tasks
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 connector lets SGLang load model weights directly from a remote MooncakeStore over RDMA, treating the store as a generic model cache:
--model-path mooncake://<checkpoint> --load-format remote, without staging weight files to local disk.The design deliberately keeps storage decoupled from the inference engine. Weights are stored as plain files, and the engine loads files exactly as it would from disk — only the source changes (disk → MooncakeStore). This trades some raw load throughput for generality (any file-based loader can adopt it) and operability (import / list / delete are managed independently of the serving process). It is complementary to the tightly-coupled, higher-performance approach in #21661.
Related design discussion / RFC on the Mooncake side: kvcache-ai/Mooncake#2282 (Unified KVCache and Model Weight Management). The Mooncake-side control plane (import / list / inspect / verify / delete) lives in a separate Mooncake PR: kvcache-ai/Mooncake#2829.
Modifications
connector/mooncake_store_file.py:MooncakeStoreFileConnector. Reads safetensors headers from Mooncake chunks, identifies tensor boundaries fromdata_offsets, coalesces each tensor batch into a singleget_into_ranges()against a reused registered buffer on the target CUDA device (GPUDirect RDMA), and yields(name, tensor)toDefaultLoader. Only metadata/tokenizer/config files are materialized locally.connector/__init__.py: register themooncake://scheme.model_loader/loader.py: passmodel_loader_extra_configthrough to the remote connector.configs/model_config.py: resolve remote model config/tokenizer files and propagate the Mooncake store config (also viaMOONCAKE_WEIGHT_STORE_CONFIGenv) to the loader.server_args.py: derive a filesystem-safeserved_model_namefor remote (mooncake://) model paths.managers/{scheduler,tokenizer_manager,tp_worker}.py: thread remote tokenizer metadata paths through the manager processes.test/registered/model_loading/test_mooncake_store_file_connector.py: connector unit tests.Usage
1. Import weights into MooncakeStore (Mooncake side; control plane lives in the separate Mooncake PR kvcache-ai/Mooncake#2829):
2. Launch SGLang loading from the store (this PR). Point
--model-pathatthe
mooncake://<checkpoint-id>scheme and use `--load-forThe store connection is read from the Mooncake config file (or the
MOONCAKE_WEIGHT_STORE_CONFIGenv var). No extra `--model-is needed — the connector defaults to the GPUDirect RDMA fast path.Accuracy Tests
End-to-end, cross-machine (one storage node + one 8×H20 node): loaded Qwen3-235B-A22B from MooncakeStore and verified inference output is correct. The connector only changes the weight source, not compute, so model outputs are
unaffected.
Speed Tests and Profiling
Cross-machine setup (one storage node + one 8×H20 node), weights loaded from MooncakeStore over RDMA. Zero extra config needed — the connector defaults to the GPUDirect RDMA fast path, reading weights straight into device memory.
Only Qwen3-235B-A22B was measured on our setup; more models to follow.
Known limitation: generic file-level storage makes TP-aware loading harder than a format-coupled approach, so raw load throughput currently trails the tensor-level, format-coupled path in #21661 (which reports 16s for the same model). Closing that gap (e.g. optional TP-aware layout hints on top of the generic file layout) is the main follow-up.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #29066099590
Latest PR Test (Extra): ❌ Run #29066099499