nemo_automodel.components.speculative.dflash.registry
nemo_automodel.components.speculative.dflash.registry
Dispatch registry mapping target architecture -> DFlash draft model.
Mirrors the EAGLE registry (components/speculative/eagle/registry.py). The
Qwen3 DFlash draft is a non-causal Qwen3-style stack and is config-driven, so
adding a Qwen3-shaped architecture is a one-line append; a target whose backbone
differs (Kimi K3’s MLA) registers its own draft class.
Module Contents
Classes
Functions
Data
API
How to build a DFlash draft model for a particular target architecture.
The attention backends this draft can run. The
trainer’s mask format is driven by the same knob and must agree (a
flex BlockMask only works with the flex attention function, a
dense additive mask only with sdpa / eager).
Builds the draft config from the target’s text
config; called with the keyword arguments num_draft_layers,
num_target_layers, block_size, dflash_config, and
attention_backend.
Extra from_pretrained keyword arguments for the
frozen target, derived from the recipe’s recipe_args.
The DFlash 2 draft class for this target: the same backbone
plus the in-block convolutions and the candidate selector. None
when the family has no DFlash 2 draft, which makes the DFlash 2
recipe reject the target rather than silently training the plain
DFlash architecture under a DFlash 2 config.
The draft model class.
Whether the frozen target can be sharded by
the DFlash context-parallel path, which installs a key/value-gather
hook on the target’s SDPA call. False for a target that shards the
sequence itself (it declares _owns_cp_attention and never routes
through that hook). This is declared here rather than read off the
loaded target because the recipe’s other CP gates — which force the
target onto HuggingFace SDPA — run before the target exists, and
would otherwise report a misleading error first.
Default: a target needs no architecture-specific from_pretrained kwargs.
Return the first registered DFlash draft spec matching any architecture in the list.