Structured Prediction

Structured prediction outputs objects with internal constraints, not just independent labels. Examples include sequences, trees, graphs, segmentations, alignments, molecule strings, tool-call traces, and coordinate sets.

The model predicts:

where is the valid output space and scores candidate structures.

For probabilistic models:

when the structure is generated autoregressively.

Output Constraint

Structured prediction has a validity set:

The decoder should either search only inside the valid set or report invalid outputs explicitly.

Output typeConstraint example
sequencegrammar, vocabulary, length, stop token
segmentation maskpixel/voxel labels and topology
graphnode/edge type rules, connectivity, valence
coordinatesrigid geometry, distance, chirality, collision
tool traceschema, permissions, side-effect order
alignmentmonotonicity or one-to-one matching

Decoding and Loss

Training often optimizes local losses, while evaluation checks whole-object validity.

Training signalEvaluation question
token cross entropydoes the whole sequence parse and solve the task?
per-pixel lossis the object boundary/topology correct?
edge classificationis the graph chemically/structurally valid?
coordinate lossare geometry and invariance/equivariance respected?
imitation of tracesdoes the action sequence complete the workflow?

Validity Handling

StrategyUse whenRisk
constrained decodingrules are clear and cheapmay reduce diversity
repair stepinvalid outputs are near-validrepair can hide model failure
reject invalidvalidity is mandatorylowers yield
penalty in objectivevalidity can be softly measuredmay not enforce hard constraints
separate verifiervalidity check is complexverifier coverage must be audited

Key Ideas

  • The output must satisfy syntax, topology, geometry, or task-specific constraints.
  • Decoding is part of the model behavior; greedy, beam, constrained, and sampling-based decoding can produce different outcomes.
  • Token-level accuracy may not match object-level validity.
  • Structured outputs often need task-specific metrics, validity checks, and error analysis.

Practical Checks

  • What makes an output valid?
  • Is the output sequence, set, graph, mask, alignment, coordinate object, or action trace?
  • Does the metric evaluate local pieces or the whole object?
  • Are invalid outputs filtered, repaired, penalized, or counted as failures?
  • Does decoding leak information from references or evaluation tools?
  • Is the validity function specified before looking at predictions?
  • Is invalid output rate reported separately from quality on valid outputs?
  • Does the loss align with object-level success?