nemo_automodel.components.speculative.dspark.core
nemo_automodel.components.speculative.dspark.core
DSpark online training wrapper.
The DSpark draft is self-contained: it samples anchors, builds the block attention mask, runs the semi-autoregressive backbone + Markov head, and emits everything the objective needs. This module is therefore a thin wrapper that calls the draft with the target supervision and computes the three-term loss.
Module Contents
Classes
Data
API
Per-step training outputs for the DSpark draft.
Beyond the loss and its three terms, this carries the acceptance diagnostics as
unreduced (num, den) sums so the recipe can reduce both across the log
window and the DP group and form the exact global ratio once: acceptance rate
(the [block_size] per-position accept_rate@k sums, whose totals also
give the aggregate accept_rate), tau (expected accepted block length),
and the confidence-head calibration error/bias against the measured acceptance
rate. A denominator is zero when the diagnostic was not computed (e.g. no
confidence head, or no teacher signal), which the recipe uses to skip logging.
Bases: Module
DSpark online training wrapper computing the three-term objective.
Run the draft on the target supervision and compute the DSpark loss.
position_ids / seq_lens / doc_remaining (all None off the
packing path) are forwarded to the draft, which keeps each anchor block
inside one document (block-causal context, per-document positions, and
document-truncated supervision).