nemo_gym.models.token_capture.staging.routes
nemo_gym.models.token_capture.staging.routes
Portable validation, encoding, and decoding for staged routed-expert envelopes.
The envelope wire format and its codec live here because extras_digest is
computed over the encoded payload: whoever defines what staged route bytes
mean also defines what makes them authentic. The span-classification decision
table (classify_route_span) is the pure-metadata rule for how one
staged fragment contributes to a linearized row; frameworks apply it instead
of mirroring it.
Module Contents
Classes
Functions
Data
ROUTED_EXPERTS_ENVELOPE_VERSION
API
One decoded [tokens][layers][topk] routed-expert fragment.
Classify how one staged fragment contributes to a linearized row.
full: the fragment covers the span’s whole carry+generation token
range. tail: the fragment covers at least the generated suffix, whose
last generation_len rows are used. sentinel: no usable fragment —
the consumer fills the span with MISSING_ROUTE_SENTINEL.
Decode the supported v1 base64 envelope or validate legacy nested lists.
Encode a [tokens][layers][topk] nested list as the v1 base64 envelope.
This is the reference inverse of decode_routed_experts for the
nrlre1 wire format; array-backed producers may emit the same envelope
from contiguous little-endian buffers without round-tripping through
nested lists.
Inspect the token dimension without materializing the route tensor.