Skip to content

[Feature] Support GLM-5.3 DFlash2 speculative decoding - #5246

Draft
RunningLeon wants to merge 2 commits into
InternLM:mainfrom
RunningLeon:feat/dflash2
Draft

RunningLeon wants to merge 2 commits into
InternLM:mainfrom
RunningLeon:feat/dflash2

Conversation

@RunningLeon

Copy link
Copy Markdown
Collaborator

Motivation

Add experimental DFlash2 speculative decoding for GLM-5.3 and GLM-5.3-Flash while preserving the existing DFlash interface and v1 behavior.

Modification

  • Select DFlash2 by checkpoint architecture, with block-local convolution, conditional candidate selection, and proposal probabilities used by sampled verification.
  • Export GLM target features and keep the external draft's configuration and state separate from the target.
  • Support Flash TP and DP/EP serving with prefill-only local prefix and Mooncake Store reuse, including joint target/draft KV ownership and retained local state checkpoints.
  • Reject mixed Store publications using per-object publication IDs and cross-TP completion checks before committing a restored prefix.
  • Add model-pair configuration guards, regression tests, English/Chinese usage examples, and the upstream DFlash2 MIT license notice.

Validation

  • Pre-commit hooks passed. After formatting, executable Python ASTs are unchanged; 88 focused tests passed on this commit.
  • The same executable candidate passed 1,051 Store/paging/connector regressions and five native TCP cases, including actual partial eviction/refill.
  • Real GLM-5.3-Flash + DFlash2, TP2/DP2/EP4, B4, CUDA Graph: normal remote/local reuse, GPU payload checks, publication-mismatch rejection with cold fallback, API streaming/cancellation, and long-prefill/decode overlap passed.
  • Independent fixed-batch-1 validation passed 17 requests and 10 token-ID/top-k-token-ID comparisons, including four-image and long-text reuse. An injected interior publication-tag mismatch was rejected across TP even when both local GETs succeeded.
  • Earlier full GSM8K runs are historical quality evidence, not a fresh full-quality or performance result for this commit. No throughput claim is made here.

Draft follow-ups

  • Rebase/integrate with current main and revalidate. This PR preserves the tested 00dbc4199caa base; current main has six newer commits, with merge conflicts including the newer Store recovery interfaces.
  • Fix the deferred level-2 sleep rejection path: it can leave the frontend marked sleeping and subsequent requests returning 503. Do not issue level-2 sleep requests to DFlash2 services yet.

BC-breaking

Compact Store objects use a new publication-tag namespace. Existing untagged compact entries are not reused, so upgrading starts cold. Non-compact keys are unchanged. Rejecting mixed publications does not repair remote objects; retries may continue to fall back until eviction/expiry or namespace isolation.

Use cases

Use --speculative-algorithm dflash with a matching DFlash2 checkpoint. See the updated speculative-decoding documentation for separate GLM-5.3 and Flash examples and supported combinations. The non-Flash pair does not support DP/EP or prefix/Store reuse.

Checklist

  • Pre-commit/lint checks passed.
  • Added targeted unit tests and real-model validation for the implemented paths; remaining draft limitations are listed above.
  • No new downstream dependency version requirement.
  • Updated documentation and examples.

This branch has not been deployed

No deployments
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