mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2868] [RFC]: Unified Artifact I/O for Model Weights, KV Cache, and RL Checkpoints #747
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#747
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cursor[bot] on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2868
Originally assigned to: @stmatengss on GitHub.
Motivation
Mooncake Store already supports in-cluster tensor storage and high-bandwidth weight distribution (Transfer Engine, P2P Store, checkpoint-engine). However, loading artifacts from external sources is fragmented today:
mainload_tensor_from_safetensor/save_tensor_to_safetensor(local paths only, C++ binding)S3SnapshotObjectStore)Use cases that need a unified path:
A prototype exists on branch
feature/kv-cache-file-persistence(store_file_io.py+ design docs). This RFC proposes merging and extending that work into a stable, documented API.Goals
save_path/load_pathparameter:/data/ckpt/,file:///data/ckpt/s3://bucket/prefix/oss://bucket/prefix/(viaossfs/ fsspec)hf://org/repo/path/(viahuggingface_hub)safetensors(default/recommended),torch(.pt/.pth,weights_only=Trueby default).tp_rank/tp_sizefor multi-file layouts (manifest.json+rank_00000.safetensors, ...).load_tensor_from_safetensor/save_tensor_to_safetensor(local C++ path).Non-Goals (initial phase)
from_pretrained()inside vLLM/SGLang — Mooncake provides storage/transfer, not model class instantiation.WeightManagerwith automaticmodel.load_state_dict()— callers remain responsible for applying loaded tensors.storage_optionspassthrough.Current State
main— local safetensors onlyImplemented in
mooncake-integration/store/store_py.cpp; tested inmooncake-wheel/tests/test_safetensor_functions.py.Prototype (
feature/kv-cache-file-persistence)mooncake-wheel/mooncake/store_file_io.pymonkey-patchesMooncakeDistributedStoreat import:save_tensor_to_file/load_tensor_from_file— fsspec-backed,torch+safetensorssave_kv_cache_to_file/load_kv_cache_from_file— aliasessave_tensor_from_safetensor/load_tensor_from_safetensor— delegate to fsspec layerTested: local paths,
file://URIs,.ptand.safetensors. Not tested:s3://,oss://,hf://.Design docs (prototype branch, commit
ca9100d8):docs/source/design/usage_unified_artifact_io.mddocs/source/design/usage_model_weights.mddocs/source/design/usage_kvcache.mdProposed Design
1. Unified API (Python)
2. Path resolver
file://fsspeclocals3://fsspec+s3fsS3Helper;storage_optionsfor credentialsoss://fsspec+ossfshf://huggingface_hubstorage_options:token,revision,repo_typeformat="auto": if path ends with.safetensors→ safetensors; else default safetensors for directories, torch for.pt/.pth.3. TP shard layout (directory paths)
load_artifactwithtp_rankreads the matching shard andput_tensorinto Store (optionally withTensorParallelism/ existing unified tensor IO).4. End-to-end workflow
5. Compatibility layer
Keep existing methods; delegate to unified API:
load_tensor_from_safetensorload_artifactorload_tensor_from_file(format="safetensors")save_tensor_to_safetensorsave_artifactorsave_tensor_to_fileload_kv_cache_from_fileload_artifact(kind="kv_cache")WeightManager.load_checkpointload_artifact(kind="model_weights")C++
load_tensor_from_safetensorremains for local-only, zero-extra-dep use; Python fsspec layer preferred for remote paths.6. Dependencies
Import-time patch (
patch_store_file_io_support) stays best-effort: missing optional deps → clearValueErrorwith install hint.Implementation Plan
store_file_io.py; document local +file://+s3://; CI unit tests with moto/miniohf://adapter;save_artifact/load_artifactfacade; TP manifest layoutoss://adapter; integration tests; user docs underdocs/source/python-api-reference/Testing Strategy
weights_only,map_locations3://; mock HF hub forhf://tp_size=4, load per-rank, byte-compare against goldentest_safetensor_functions.pyunchanged onmainbehaviorOpen Questions
hf://usehf_hub_download(read-only) only in P0, deferringuploadto P1?S3Helper(C++/AWS SDK) for Store master paths vs pure Pythons3fsfor artifact I/O — acceptable duplication?ObjectDataType::WEIGHT+with_hard_pinwhenkind="model_weights"?oss://required for Alibaba production, or is S3-compatible endpoint sufficient initially?References
feature/kv-cache-file-persistenceonstmatengss/mooncakemooncake-integration/store/store_py.cpp(load_tensor_from_safetensor)Request for Feedback
save_artifact/load_artifactAPI the right surface, or should we only extendload_tensor_from_file?@github-actions[bot] commented on GitHub (Jul 12, 2026):
Thanks for opening this issue, @cursor[bot]!
206951365A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@github-actions[bot] commented on GitHub (Oct 11, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
@github-actions[bot] commented on GitHub (Oct 19, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.