nemo_automodel.components.speculative.dspark.draft_kimi_k3
nemo_automodel.components.speculative.dspark.draft_kimi_k3
Dense Kimi K3 MLA backbone for DSpark speculative-decoding training.
Module Contents
Classes
Data
API
Bases: Module
Dense non-causal K3 MLA over target context and a parallel noise block.
K3 MLA keeps one K/V per query head (num_key_value_heads == num_attention_heads),
like GLM-5.2’s MLA, so there is no GQA group repeat: kv_b_proj already emits one
qk_nope_head_dim + v_head_dim slice per query head.
Attend from the noise block to the frozen target context plus itself.
Parameters:
Tensor of shape [batch, query_length, hidden]; the
noise block that supplies the queries.
Tensor of shape [batch, context_length, hidden];
the frozen target context, concatenated before hidden_states to
form the keys and values.
Optional additive mask of shape
[batch, 1, query_length, context_length + query_length].
Returns: torch.Tensor
Tensor of shape [batch, query_length, hidden].
Bases: Module
Pre-norm K3 MLA and dense SiTU feed-forward block.
Run one draft layer over the noise block against the target context.
Parameters:
Tensor of shape [batch, context_length, hidden];
the frozen target context supplying the extra keys and values.
Tensor of shape [batch, query_length, hidden]; the
noise block, also the residual stream.
Optional additive mask of shape
[batch, 1, query_length, context_length + query_length].
Returns: torch.Tensor
Tensor of shape [batch, query_length, hidden].
Bases: DeepseekV4DSparkModel
DSpark draft with a dense K3 MLA backbone and no KDA or MoE layers.
Project the target context once, then run the draft layers over the noise block.
Parameters:
Tensor of shape [batch, sequence]; unused (NoPE MLA).
Optional additive mask of shape
[batch, 1, query_length, context_length + query_length].
Tensor of shape [batch, query_length, hidden]; the
noise block that becomes the queries.
Tensor of shape
[batch, context_length, len(target_layer_ids) * hidden]; the
concatenated target hidden states, projected by fc and normed
to [batch, context_length, hidden].
Returns: torch.Tensor
Tensor of shape [batch, query_length, hidden].