nemo_automodel.components.speculative.streaming.eagle3
nemo_automodel.components.speculative.streaming.eagle3
EAGLE-3 schema for the streaming data plane.
Mirrors the EAGLE-3 row of the speculative-decoding train/inference disaggregation RFC’s “Feature schema per algorithm” table:
“Exactly one supervision encoding” is the rule. The colocated target
backend ships full logits; the remote target backend ships target_probs + position_mask so the wire never carries a
full-vocab tensor.
DFlash and DSpark schemas land alongside their producer / loader.
This is a greenfield API: bump EAGLE3_SCHEMA_VERSION when the feature
layout changes; consumers reject mismatched refs rather than migrating older
samples.
Module Contents
Functions
Data
EAGLE3_DRAFT_VOCAB_SUPERVISION
API
Build the per-feature :class:FeatureSpec map for a colocated encoder batch.
Returns: dict[str, FeatureSpec]
A dict[str, FeatureSpec] keyed by feature name with the
Pack an EAGLE-3 colocated-path encoder’s outputs into the producer’s tensor dict.
Parameters:
Tensor of shape [batch, sequence, hidden * num_aux_layers].
num_aux_layers is the count of distinct layers the target’s
forward hooks captured (3 for the EAGLE-3 default recipe,
concat’d along the last axis).
Tensor of shape [batch, sequence], torch.long.
Tensor of shape [batch, sequence], torch.long.
Tensor of shape [batch, sequence], torch.long.
Tensor of shape [batch, sequence, vocab]. Per the
colocated path this is the target’s full LM-head output.
Optional [batch, sequence] per-document positions
when sequence packing is enabled.
Optional [batch, max_docs] packed document lengths.
Optional [batch, sequence] cross-document TTT gate.
Returns: dict[str, torch.Tensor]
A dict[str, torch.Tensor] keyed by
Require all packing metadata together or none at all.
Verify ref matches the EAGLE-3 schema before the consumer materializes.
Parameters:
The tensor-free reference carried by the queue’s lease.
Raises:
ValueError: ifref.algorithmis not :data:FeatureAlgorithm.EAGLE3, if any core feature is missing from the ref, or if the supervision encoding is neitherlogitsalone nor thetarget_probs+position_maskpair.