Skip to content

[#19900][feat] DSpark: load speculators-format drafter checkpoints - #19903

Merged
juney-nvidia merged 1 commit into
NVIDIA:feat/kimi-k3-low-latencyfrom
vsabavat:k3-up/p15-k3main-speculators
Oct 6, 2026
Merged

juney-nvidia merged 1 commit into
NVIDIA:feat/kimi-k3-low-latencyfrom
vsabavat:k3-up/p15-k3main-speculators

Conversation

@vsabavat

@vsabavat vsabavat commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fixes #19900.

RedHatAI/Kimi-K3-speculator.dspark ships in the vLLM speculators config format. TRT-LLM could not read it, so DSpark with this drafter needed a hand-converted copy of the checkpoint. With this PR, speculative_model: RedHatAI/Kimi-K3-speculator.dspark loads the checkpoint as downloaded.

The config is detected by speculators_model_type == "dspark" with a nested transformer_layer_config. It is translated the same way the hand conversion did:

  • The qwen3 backbone is flattened from transformer_layer_config.
  • target_layer_ids = aux_hidden_state_layer_ids - 1. vLLM-style aux ids name the layer whose input is captured.
  • The sliding window is dropped, because the drafter attention backends reject non-causal windows. This is exact while the context fits in the trained window (2048 tokens for the Kimi K3 drafter).
  • mask_token_id and the markov / confidence-head fields are carried over.

Every reader of the drafter's config.json uses this translation. Other drafter configs are unchanged, so no-spec and existing DFlash / DSpark checkpoints are unaffected.

This PR is based on feat/kimi-k3-low-latency (4c9e23db1c) and fast-forwards it.

Test Coverage

  • New CPU-only test test_dspark_speculators_checkpoint.py: the translation matches the converted config, and non-speculators configs are left as they are.
  • Kimi K3 end to end on 16x GB200 with the raw HF drafter folder and no conversion:
    • AL6 TPOT at BS1/2/4/8: 1.011 / 1.698 / 1.924 / 2.571 ms vs 1.010 / 1.697 / 1.927 / 2.544 ms for the converted-checkpoint run (+0.11 / +0.05 / -0.17 / +1.05 %; BS8 is within the 2.537-2.565 ms spread of identical code).
    • Fixed-prompt outputs: 8 / 8 identical to the converted-checkpoint run.
    • GSM8K at natural acceptance: 96.21, the same as the baseline, with 1319 / 1319 responses identical and the same natural AL (4.282).

PR Checklist

  • PR description clearly explains what and why.
  • Test cases are provided for new code paths.
  • End-to-end gates above pass.

A DSpark drafter saved in the vLLM speculators format, such as
RedHatAI/Kimi-K3-speculator.dspark as downloaded, now loads as
speculative_model without a converted copy. Its config.json has no top-level
model_type, so it could not be read before.

The config is detected by speculators_model_type == "dspark" with a nested
transformer_layer_config, and translated the way the hand conversion
(make_redhat_dspark_adapter.py) did:
- the qwen3 backbone is flattened from transformer_layer_config;
- target_layer_ids = aux_hidden_state_layer_ids - 1, since vLLM-style aux ids
  name the layer whose input is captured;
- the sliding window is dropped. The drafter attention backends reject
  non-causal windows, and this is exact while the context fits in the trained
  window (2048 tokens for the Kimi K3 drafter);
- mask_token_id and the markov / confidence-head fields are carried over;
  block_size is not.

Every reader of the drafter's config.json uses the same translation: the model
config (load_pretrained_config), the DFlash / DSpark spec-config resolution,
and the context-buffer budget. Other drafter configs are unchanged.

Signed-off-by: Vasanth Sabavat <[email protected]>
@juney-nvidia
juney-nvidia merged commit e253695 into NVIDIA:feat/kimi-k3-low-latency Oct 6, 2026
vsabavat added a commit to vsabavat/TensorRT-LLM that referenced this pull request Oct 7, 2026
Remakes 5fbf086203, the same merge onto 4c9e23d, on top of e253695
(P15, NVIDIA#19903). The tree is 5fbf086203's plus P15's three files, which P12
does not touch.

Conflicts resolved for U2's per-token KDA states: shutdown keeps
kda_state_tok = None; the test file keeps U2's import, builds the
suspend/resume runtime test's manager without per-token states, and skips
the absent kda_state_tok buffer when it overwrites a slot.

# Conflicts:
#	tensorrt_llm/_torch/pyexecutor/kv_cache/mamba_cache_manager.py
#	tests/unittest/_torch/executor/kv_cache/test_mamba_cache_manager.py
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.

2 participants