vllm.models.inkling2.nvidia.dspark
¶
Inkling2 DSpark draft (mtp.safetensors): an anchor plus mask block run
through a small dense transformer over DFlare-mixed target-feature K/V, then a
recurrent (rnn_hidden) Markov head. Numerics follow the reference
implementation's draft (flashinfer RMSNorms, bf16 logits).
Classes:
-
Inkling2DSparkDecoder– -
Inkling2DSparkModel–DSpark draft for Inkling2; plugged in by
Inkling2DSparkSpeculator. -
Inkling2DraftLayer– -
Inkling2DraftSelfAttention–Bidirectional block attention over context K/V (from target features)
-
Inkling2MarkovHead–Recurrent (
rnn_hidden) correction of the draft's base logits.
Functions:
-
all_reduce_add_rmsnorm–In place:
residual += all_reduce(x); x = norm(residual).
Inkling2DSparkDecoder
¶
Bases: Module
Methods:
-
embed_block–Normalized target embedding of each block's anchor, then masks.
Source code in vllm/models/inkling2/nvidia/dspark.py
embed_block(input_ids)
¶
Normalized target embedding of each block's anchor, then masks.
Source code in vllm/models/inkling2/nvidia/dspark.py
Inkling2DSparkModel
¶
Bases: Module
DSpark draft for Inkling2; plugged in by Inkling2DSparkSpeculator.
Methods:
-
attach_target–Finish sharing the target's normalized embeddings and LM head (its
-
compute_base_logits–TP-local bf16 base logits (bf16 GEMM, as the reference).
-
compute_f_rnn–Recurrent-head context from the last committed token's features.
-
markov_argmax–markov_logits(...).argmax(-1), NaN as -inf. -
markov_logits–Full-vocab softcapped logits.
-
markov_step–Advance the recurrent head; return the state and TP-local bias.
-
refresh_derived_weights–Re-derive, in place, the weights computed from the target's LM head
Source code in vllm/models/inkling2/nvidia/dspark.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
attach_target(target_model)
¶
Finish sharing the target's normalized embeddings and LM head (its
embed_tokens and lm_head are aliased by load_dspark_model)
and derive the weights that depend on them.
Source code in vllm/models/inkling2/nvidia/dspark.py
compute_base_logits(hidden_states)
¶
TP-local bf16 base logits (bf16 GEMM, as the reference).
compute_f_rnn(features)
¶
Recurrent-head context from the last committed token's features.
markov_argmax(base_logits, bias)
¶
markov_logits(...).argmax(-1), NaN as -inf.
markov_logits(base_logits, bias)
¶
Full-vocab softcapped logits.
Source code in vllm/models/inkling2/nvidia/dspark.py
markov_step(state, prev_tokens, context)
¶
Advance the recurrent head; return the state and TP-local bias.
Source code in vllm/models/inkling2/nvidia/dspark.py
refresh_derived_weights()
¶
Re-derive, in place, the weights computed from the target's LM head and the draft's own weights; called again after the target's weights are replaced (reload, RL weight transfer).
Source code in vllm/models/inkling2/nvidia/dspark.py
Inkling2DraftLayer
¶
Bases: Module
Methods:
-
forward–Returns this rank's partial MLP output and the residual.
Source code in vllm/models/inkling2/nvidia/dspark.py
forward(positions, x, residual, cos_sin_cache)
¶
Returns this rank's partial MLP output and the residual.
Source code in vllm/models/inkling2/nvidia/dspark.py
Inkling2DraftSelfAttention
¶
Bases: Module
Bidirectional block attention over context K/V (from target features)
and the block itself; local layers see sliding_window_size positions
before the block start.
Source code in vllm/models/inkling2/nvidia/dspark.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
Inkling2MarkovHead
¶
Bases: Module
Recurrent (rnn_hidden) correction of the draft's base logits.
Its rank-r latent goes through hidden_out and the shared LM head,
folded once into a (vocab, r) projection. The [hidden, f_rnn]
columns of rnn_proj (and its bias) are applied to all draft steps at
once in fp32; each step adds the [state, previous] columns and rounds.
Methods:
-
context–fp32
rnn_projbias plus its[hidden, f_rnn]term for the -
fold–Fold
hidden_outinto the (TP-local) LM head rows in fp64. Later -
step–One recurrence step; returns the new state and the TP-local bias.
Source code in vllm/models/inkling2/nvidia/dspark.py
context(hidden, f_rnn)
¶
fp32 rnn_proj bias plus its [hidden, f_rnn] term for the
(req, step)-ordered hidden; returns (step, req, 3 * r).
Source code in vllm/models/inkling2/nvidia/dspark.py
fold(lm_head_weight)
¶
Fold hidden_out into the (TP-local) LM head rows in fp64. Later
calls refill the same tensors, which CUDA graphs keep pointing at.
Source code in vllm/models/inkling2/nvidia/dspark.py
step(state, prev_tokens, context)
¶
One recurrence step; returns the new state and the TP-local bias.
Source code in vllm/models/inkling2/nvidia/dspark.py
all_reduce_add_rmsnorm(x, residual, norm)
¶
In place: residual += all_reduce(x); x = norm(residual).
Batches that the TP group's FlashInfer MNNVL all-reduce takes run its fused all-reduce + residual add + RMSNorm on the same workspace (the same rank-order fp32 sum, rounded once to bf16); the norm then reads the bf16 residual. Others all-reduce, then add and normalize.