Skip to content

feat(cache): store FlashStates checkpoints in Mooncake - #1809

Merged
AlpinDale merged 1 commit into
feat/flashstates-prefill-parallelfrom
feat/flashstates-mooncake
Nov 13, 2026
Merged

AlpinDale merged 1 commit into
feat/flashstates-prefill-parallelfrom
feat/flashstates-mooncake

Conversation

@AlpinDale

@AlpinDale AlpinDale commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds native Mooncake Store support for FlashStates checkpoints, allowing a supported hybrid model to restore a completed request's checkpoint after it leaves the GPU prefix cache.

Each stored checkpoint includes the full attention prefix, recurrent state and any unfinished indexer compression group. Lookup requires the checkpoint's payloads and completion manifests from every worker rank.

This uses the stock Mooncake Store API. The donor's custom host-cache policy integration through unit_policy_url remains unsupported.

Usage

With Mooncake installed and a Store configuration saved as mooncake.json, enable frontier write-through alongside the existing FlashStates options. This example uses TCP and GLM on 2 GPUs:

MC_FORCE_TCP=1 MOONCAKE_CONFIG_PATH="$PWD/mooncake.json" \
sonar serve nvidia/GLM-5.3-Flash-NVFP4 \
  --tensor-parallel-size 2 \
  --language-model-only \
  --enforce-eager \
  --max-model-len 32768 \
  --enable-prefix-caching \
  --mamba-cache-mode align \
  --mamba-frontier-checkpoint \
  --mamba-prefill-export \
  --prefix-cache-eviction gds \
  --prefill-cost-coefficients 1.862e-5 3.33e-6 \
  --prefix-cache-leaf-last \
  --kv-transfer-config '{
    "kv_connector": "MooncakeStoreConnector",
    "kv_role": "kv_both",
    "kv_load_failure_policy": "recompute",
    "kv_connector_extra_config": {
      "frontier_write_through": true,
      "cache_prefix": "immutable-model-and-build-id"
    }
  }'

What do the options do?

  • frontier_write_through: true: Writes completed-request checkpoints to the Store, including checkpoints between cache-block boundaries.
  • kv_role: "kv_both": Allows the engine to save and restore checkpoints.
  • kv_load_failure_policy: "recompute": Recomputes a request if a checkpoint becomes unavailable or a transfer fails.
  • cache_prefix: Separates deployments sharing a Store. Use an immutable identifier and change it when the weights or build change.

Keep load_async and lookup_async enabled, which are the defaults. Leave save_decode_cache disabled. Separate engines on the same host need distinct lookup_rpc_port values in kv_connector_extra_config.

Capacity and limitations

Size host memory for the stored attention prefixes as well as recurrent state. Checkpoints require matching parallel geometry and cache layouts between writers and readers.

Embedded host segments belong to their worker processes. Stopping those workers can remove checkpoints from the shared Store.

To reset GPU prefix caches while retaining host checkpoints, let pending saves drain and use LLM.reset_prefix_cache(reset_connector=False) or POST /reset_prefix_cache?reset_external=false.

Signed-off-by: AlpinDale <alpindale@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:32:12.880013Z adb6920 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adb6920316

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +610 to +611
if not self.frontier_write_through or request.resumable or request.status == RequestStatus.FINISHED_ABORTED:
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid pinning frontier saves on load-only consumers

With frontier_write_through=true and kv_role="kv_consumer", this method queues a save and pins all checkpoint blocks for every eligible finished request, but MooncakeStoreWorker.can_put is false for consumers and wait_for_save() returns without submitting those jobs. Consequently, no completion metadata releases these references, progressively exhausting the GPU block pool and leaving pending push work permanently outstanding. Either reject this configuration during connector initialization or skip frontier-save registration when the worker cannot PUT.

Useful? React with 👍 / 👎.

@AlpinDale
AlpinDale added this pull request to stack #1810 November 13, 2026 16:50
@AlpinDale
AlpinDale merged commit 33a0078 into main Nov 13, 2026
2 checks passed
@AlpinDale
AlpinDale deleted the feat/flashstates-mooncake branch November 22, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant