[KongchangAI]
· 2 min read· 1,029 words

HSM and HSGD: New Training Methods for Speculative Decoding Without Simulated Inference

HSM and HSGD: New Training Methods for Speculative Decoding Without Simulated Inference

NVIDIA proposes HSM and HSGD, two zero-inference-cost training methods that improve autoregressive draft model quality.

The article addresses the training-inference mismatch in autoregressive draft models for speculative decoding. EAGLE-style drafters reuse target model hidden states, but training inputs come from the backbone or single-step MTP while inference faces recursively generated MTP states, causing acceptance rate drops at tail positions. EAGLE-3's TTT mitigates this by explicitly simulating inference but incurs high memory overhead. NVIDIA proposes two training-only methods: HSM samples between backbone and MTP hidden states to construct mixed inputs without special attention masks, achieving acceptance rates comparable to TTT on four-step Qwen3-8B with 48% lower peak training memory; HSGD randomly blocks gradient backpropagation through hidden state and embedding paths as regularization to improve early-position acceptance. In tests, HSM-based MTP enhancement improves average acceptance length by up to 52.2%, and neither method adds inference cost, allowing selection or combination based on draft length.

Training-Inference Mismatch: The Core Pain Point of Autoregressive Drafting

Multi-token prediction modules and EAGLE-style drafters are efficient because they directly reuse the target model's hidden states as input, avoiding prediction from scratch. However, this reuse introduces a subtle bias: during training, the draft model sees clean, consistent hidden state sequences—either entirely from the backbone network or from single-step MTP outputs; during inference, the draft model must predict based on the prefix computed by the target model, concatenated with its own recursively generated MTP states. This means the input distribution at inference is fundamentally different from training, and the draft model's acceptance rate at tail positions drops noticeably.

EAGLE-3's TTT method attempts to reproduce the inference-time state distribution during training, and it does work—but it requires simultaneously maintaining multi-step MTP states and designing special attention masks, significantly increasing training memory overhead. For scenarios requiring frequent iterative training of draft models, this cost cannot be ignored.

The speedup of speculative decoding depends on "acceptance length"—the number of consecutive draft tokens the target model confirms in a single verification. The draft model predicts multiple candidate tokens at each step, and the target model verifies in parallel whether these tokens are consistent with its own distribution; the more tokens accepted, the more effectively a single forward pass replaces multiple autoregressive decoding steps, yielding greater throughput improvement. Therefore, the core metric for draft quality is not single-token accuracy but the joint acceptance probability across consecutive positions. The drop in acceptance rate at tail positions for autoregressive drafters directly lowers the average acceptance length, which is why the training-inference mismatch problem is taken so seriously in engineering.

HSM: Sampling Mixed States from Different MTP Steps

The idea behind Hidden State Mixing (HSM) is straightforward: since the draft model sees hidden states from different MTP steps during inference, let it see this mixture during training as well. Specifically, for the same prediction target, HSM samples between backbone network hidden states and MTP hidden states to construct input sequences that mix different sources. This way, the draft model encounters state combinations from different MTP steps during training without explicitly simulating the entire inference process.

Compared to TTT, HSM does not need to maintain full multi-step recursive states or special attention masks, making the training implementation simpler. According to the paper's data, in a four-step Qwen3-8B comparison, HSM achieves acceptance rates comparable to TTT while reducing peak reserved training memory by 48%. This means larger draft models or larger batches can be trained under the same hardware conditions.

MTP (Multi-Token Prediction) states refer to the hidden representations produced by the multi-token prediction head during recursive generation. In EAGLE-style drafters, each draft token prediction depends on the previous step's MTP output, so these states accumulate progressively and are coupled during inference. If training uses only single-step MTP outputs, the draft model cannot see the distribution shift caused by this recursive accumulation. HSM constructs inputs by sampling between backbone hidden states and MTP states from different steps, allowing the training distribution to cover various state source combinations that may occur during inference, thereby narrowing the training-inference gap without explicitly unrolling the recursive process.

HSGD: A Regularization Approach with Random Gradient Blocking

Hidden State Gradient Detach (HSGD) takes a different path. It does not change the source of input states but randomly blocks backpropagated gradients through hidden state and embedding paths while keeping forward computation unchanged. This acts as a form of regularization: the draft model still sees complete input information, but gradients from some paths are no longer backpropagated, forcing the model to learn more robust representations.

HSGD adds no inference cost; implementation simply inserts random gradient blocking operations into the training graph. In the joint pretraining plus supervised fine-tuning pipeline, HSGD achieves the highest acceptance rate at early draft positions, while HSM performs better at later draft positions. This trend directly maps to serving scenario choices: short draft lengths (dominated by early positions) favor HSGD, while long draft lengths (where later positions carry more weight) favor HSM.

Gradient detach is a common operation in deep learning frameworks that cuts off a computation path during backpropagation so parameters on that path receive no gradients while forward values remain unchanged. HSGD randomizes this: each training iteration blocks backpropagated gradients through hidden state or embedding paths with a certain probability. This is similar to Dropout's perturbation of activations but acts on the gradient pathway, forcing the draft model not to over-rely on the exact values from a single input source but to learn prediction functions more robust to changes in state sources. Since operations are only inserted into the training graph, the model architecture and inference cost remain completely unchanged at deployment.

Measured Results: Acceptance Length Improvement and Memory Savings

The paper validated HSM-based MTP boosting on four Nemotron models and DeepSeekAd-V4-Pro. With the backbone network frozen, HSM-based MTP enhancement improved average acceptance length by up to 52.2% compared to jointly trained MTP. This figure is significant for speculative decoding throughput—acceptance length directly determines how many tokens can be confirmed per verification.

For EAGLE-3 drafters, HSM competes on par with TTT in acceptance rate but has a clear training memory advantage. The research team has open-sourced the HSM implementation in Megatron-LM and NVIDIA Model Optimizer for easy community reproduction and integration.

Practical Insights: Choose Methods by Draft Length

The value of these two methods lies in the fact that they are training-time techniques with zero additional deployment overhead. For practical systems, the choice depends on the draft length distribution of the serving scenario: if the application favors short drafts for rapid verification, HSGD's early-position advantage is a better match; if pursuing long drafts that verify multiple tokens at once, HSM's later-position performance is superior. The two can also be combined, applied at different training stages or on different layers.

From a broader perspective, HSM and HSGD reveal a core principle in speculative decoding training: rather than perfectly simulating inference during training (as TTT does), make the draft model more robust to state distribution changes at inference through data augmentation and regularization. This approach is lower cost and easier to scale to larger models and longer draft lengths.

#speculative decoding#HSM#HSGD#EAGLE#draft model#training-inference mismatch#NVIDIA#MTP#acceptance length
Share:

Related articles