TECHNOLOGY

Moirai packed inputs: sample identity and variate identity control different boundaries

In this article
THE QUICK TAKE

Packing examples together does not authorize shared attention, while several variates within one example can intentionally interact.

Keep identity metadata beside numerical patches

Packing reduces wasted sequence space by placing multiple examples into a shared tensor representation. Original Moirai’s module contract includes sample identity, time identity, variate identity and observation masks alongside numerical patches. These fields are computational inputs. Replacing them with convenient position numbers can change model behavior even when the tensor dimensions and checkpoint load remain valid. A port must preserve what each identifier groups, rather than simply its integer dtype.

Inspect the attention isolation rule

The packed attention helper constructs attention permissions from matching sample identities. Examples sharing a packed tensor are therefore not automatically one forecasting context. Incorrectly merging sample IDs can expose another example’s observations; unnecessarily splitting one multivariate example can remove intended interaction. Validate independence using deliberately different examples rather than relying on the absence of an execution error.

Separate variate grouping from sample grouping

Within a sample, variate identity describes which numerical variable a patch belongs to. It supports model-specific attention bias and scaling without necessarily forbidding interaction between variables. The packed scaler groups statistics using both sample and variate identity. Swapping those roles can mix unrelated units or normalize each patch independently when the model expects one variable’s history to share a scale.

Preserve observation and prediction masks

Observed-value masks describe actual available measurements, while prediction masks identify the forecast region. The module excludes prediction positions from context scaling and replaces corresponding representations as required by its architecture. These masks answer different questions from sample isolation. The Chronos scaling guide provides a useful comparison. A forecast placeholder must not become an observed zero merely because its storage contains a numerical value.

Test packing by changing an unrelated example

Hold one example fixed and change a separately identified packed example; inspect whether the first output remains consistent with the reference implementation. Then test a deliberate within-sample variate relationship and variables expressed in different units. The entity-group guide supplies related identity reasoning. Accept the port when isolation, intended interaction and scaling all match, preserving a distinction between packing for execution and defining the statistical context a forecast is allowed to use.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles