vllm.models.nemotron_shortcut.nvidia.model
¶
Inference-only Nemotron Shortcut language model for HuggingFace weights.
Classes:
-
NemotronShortcutAttention– -
NemotronShortcutAttentionLayer– -
NemotronShortcutMoEAttentionLayer–Attention then MoE on a plain residual.
-
NemotronShortcutPlainResidualConnection–Ordinary pre-norm residual behind the wide-residual port interface.
-
NemotronShortcutPlainResidualRead–Wide-residual read for a block that carries one hidden state.
-
NemotronShortcutSparseAttention– -
NemotronShortcutWideResidualConnection–Per-branch read and write ports into the residual streams.
-
NemotronShortcutWideResidualRead–Mixes the residual streams down to one backbone-width activation.
-
ShortcutMoELayer–Mixer and MoE branches sharing one block.
Functions:
-
check_sdsa_indexer_loaded–Refuse to serve SDSA layers whose indexer the checkpoint did not provide.
-
check_supported–Refuse deployments the GDP mixers cannot serve, with every reason.
-
load_nemotron_shortcut_weights–Load weights, skipping the SDSA indexer when the model runs dense, and
-
skip_indexer_weights–Skip the SDSA indexer's weights, for a model that runs full attention.
NemotronShortcutAttention
¶
Bases: Module
Methods:
-
project–The input projection, which precedes the attention op.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
project(hidden_states)
¶
The input projection, which precedes the attention op.
NemotronShortcutAttentionLayer
¶
Bases: Module
Methods:
-
attention–SDSA if the model has SDSA's buffers, which it allocates when its
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
attention(config, cache_config, quant_config, prefix, sdsa_buffers)
staticmethod
¶
SDSA if the model has SDSA's buffers, which it allocates when its config has index_topk; full attention if not.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutMoEAttentionLayer
¶
Bases: Module
Attention then MoE on a plain residual.
The MTP block under moe_shortcut_disable_mtp: the routed and shared
experts both read the post-attention state.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutPlainResidualConnection
¶
Bases: Module
Ordinary pre-norm residual behind the wide-residual port interface.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutPlainResidualRead
¶
Bases: Module
Wide-residual read for a block that carries one hidden state.
The MTP head runs a shortcut-MoE block outside the residual streams, so the checkpoint has no read logits and the read is the identity.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutSparseAttention
¶
Bases: Module
Methods:
-
project–The input projections, which precede the indexer and attention ops.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
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 | |
project(hidden_states)
¶
The input projections, which precede the indexer and attention ops.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutWideResidualConnection
¶
Bases: Module
Per-branch read and write ports into the residual streams.
Methods:
-
write–Y_k = gamma_k X_k + 2 sigmoid(w_k) Ufor every streamk.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
write(streams, update)
¶
Y_k = gamma_k X_k + 2 sigmoid(w_k) U for every stream k.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
NemotronShortcutWideResidualRead
¶
Bases: Module
Mixes the residual streams down to one backbone-width activation.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
ShortcutMoELayer
¶
Bases: Module
Mixer and MoE branches sharing one block.
The routed branch reads the block input before the mixer writes back, so
routing never observes the mixer output; the shared branch reads after.
Subclasses own the mixer and split it at its attention or GDP op:
mixer_projections runs the input projections and mix the rest.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 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 | |
check_sdsa_indexer_loaded(model, loaded)
¶
Refuse to serve SDSA layers whose indexer the checkpoint did not provide.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
check_supported(vllm_config)
¶
Refuse deployments the GDP mixers cannot serve, with every reason.
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
load_nemotron_shortcut_weights(model, weights, mapper, check_indexer=True)
¶
Load weights, skipping the SDSA indexer when the model runs dense, and check that SDSA layers got their indexer (unless the caller checks the whole load itself).
Source code in vllm/models/nemotron_shortcut/nvidia/model.py
skip_indexer_weights(weights)
¶
Skip the SDSA indexer's weights, for a model that runs full attention.
If the checkpoint has them, warn that the config has no index_topk.