the.ai

Structure / Inference

verified

Dynamic Programming Inference

Finding the best label sequence looks like it needs checking every sequence, and there are exponentially many. It does not, because the sequences share their beginnings: once you know the best way to reach a given state at a given position, every sequence passing through it reuses that answer. Filling a table of those answers is the whole idea, and it is what made structured prediction tractable decades before anything was learned.

Viz primitive · attention-heatmaptokens = 10
query ↓key →

10 queries against 5 keys; a brighter cell means more of that query's attention went to that key. Nothing is masked: every target position can read every source position.

Each row a position in the sequence, each column a state the label could take; brightness is the best score reaching that cell. Drag the state count up to watch the table widen — cost per row grows with the square of the states, and that is what replaced the exponential.

5

Reviewed by opendroid · 2026-08-18

  • arXiv:1603.01360 — Neural Architectures for Named Entity Recognition
  • arXiv:1409.0473 — Neural Machine Translation by Jointly Learning to Align and Translate