﻿# Toto 2 attention fast paths: has_missing_values is an input assertion

Use Toto 2 has_missing_values consistently with target masks and grouping rather than disabling missing-data handling solely to obtain a faster attention path.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-toto2-missing-value-fast-path-mask-contract/
Language: en

## Identify what the performance switch assumes

The [Toto 2 quick start](https://raw.githubusercontent.com/DataDog/toto/main/toto2/README.md) describes a no-missing-values setting that enables faster attention behavior when context has no gaps. This setting is an assertion about prepared input, not a request to make missing observations disappear. A serving adapter should determine completeness from its actual input contract before choosing the path. Benchmarking a complete synthetic array does not establish validity for a workload containing missing measurements.

## Follow the target mask into execution

The [model implementation](https://raw.githubusercontent.com/DataDog/toto/main/toto2/toto2/model.py) accepts target values, target masks and series identities. Numerical placeholders and observed values can share the same stored number while having different masks. Preserve that distinction through padding and batching. A preprocessing stage that replaces an unavailable reading with a convenient zero must not silently relabel it observed simply to satisfy a preferred execution path.

## Inspect the missing-aware attention construction

The implementation builds additional attention constraints in its missing-aware path and uses different arguments when the fast-path assumption applies. Its [configuration](https://raw.githubusercontent.com/DataDog/toto/main/toto2/toto2/configuration.py) defines the model structure, while per-call information governs this execution choice. Preserve the relationship between series grouping, validity indicators and the selected path. A generic speed flag cannot replace the model's actual permission rules for contexts where gaps or grouping boundaries matter.

## Keep adapter validation outside timing shortcuts

An adapter can validate completeness once at the appropriate boundary, then avoid redundant work if that invariant remains true. It should still test how padding or a changed upstream data source affects the invariant. The [Moirai packed-input guide](/journal/fg2-moirai-packed-sample-variate-identity-scaling/) provides related mask controls. Do not interpret a successful model call as proof that the caller's no-gap assertion was correct; numerical execution can finish under an inappropriate assumption.

## Compare complete and incomplete fixtures

Use a genuinely complete history, a gap with a numerical placeholder and a padded short history. Verify path selection and compare the valid configurations against the reference implementation. The [TimesFM missing-data guide](/journal/fg2-timesfm25-nan-interpolation-context-padding-contract/) provides a contrasting preparation policy. Report throughput for the input class actually measured. A useful optimization preserves the observation contract, separating speed on complete histories from correctness and quality on histories requiring missing-data handling.
