AI Glossary / Statistics and probability / Advanced
Sequence model
Definition
A sequence model represents relationships in ordered data, where the position or history of observations matters to the task. It may predict a next event, assign labels to sequence elements, classify an entire sequence or generate an output sequence. Sequential dependence is the central idea; no single architecture defines the category.
What it means
The same items can convey different information when arranged differently. An event history is therefore more than a collection of event counts. A model that discards order may lose distinctions relevant to prediction or interpretation.
Order need not mean equally spaced clock time. Words have positions in a sentence, while transactions have event order and potentially irregular time gaps. Decide what each element represents and whether elapsed time is itself informative.
How it works
Specify the sequence elements, available context and target. A model may use a fixed window of earlier observations, maintain an updated representation of history, or combine information across positions through attention.
For a probabilistic sequence model, the chain rule expresses a sequence's joint probability as its first-element probability multiplied by successive conditional probabilities. A first-order Markov model simplifies each conditional distribution to depend only on the immediately preceding state. That restriction is an assumption of that model, not a property of all sequences.
Training estimates model parameters from appropriate examples. Evaluation must match the intended information access: a model forecasting tomorrow cannot use tomorrow's observations as inputs. Distinguish a completed-sequence analysis from a prediction made while events are still arriving.
Three practical examples
1. Service monitoring: predict the next workload category from recent categories, then check whether longer histories or elapsed-time features improve forecasts.
2. Language processing: label words using their ordered context, such as identifying which words form a person's name in a sentence.
3. Customer support: classify an interaction using the sequence of messages, preserving who said what and when instead of relying only on total word counts.
Think of it this way
Think of following a recipe. Knowing which ingredients appear is useful, but the order in which steps occur can change the result. A sequence model uses information about arrangement and context; it does not guarantee that every relevant dependency has been captured.
Worked example
Consider an invented model of a service's workload across three successive intervals. Each interval is either H, meaning high workload, or N, meaning normal workload. The model has no hidden states and uses a first-order Markov assumption.
Stipulate that the first interval is H with probability 0.3 and N with probability 0.7. After H, the next interval is H with probability 0.8 and N with probability 0.2. After N, the next interval is H with probability 0.2 and N with probability 0.8. Each pair of possible next-state probabilities sums to one. Assume these transition probabilities remain the same across the intervals considered.
The probability of the complete sequence H, H, N is:
P(H,H,N) = 0.3 times 0.8 times 0.2 = 0.048.
The probability of H, N, H is:
P(H,N,H) = 0.3 times 0.2 times 0.2 = 0.012.
Both sequences contain two high intervals and one normal interval. Nevertheless, the first is four times as probable under this model: 0.048 divided by 0.012 equals 4. The difference comes from their transitions, not their counts.
Now suppose the current interval is known to be H. The probability that the next interval is H is 0.8. To calculate the probability of H two intervals ahead, account for both possible intermediate states.
The route H to H to H contributes 0.8 times 0.8 = 0.64. The route H to N to H contributes 0.2 times 0.2 = 0.04. Adding these mutually exclusive routes gives 0.68.
The value 0.64 alone is the probability that both next intervals are H, conditional on the current H. It is not the full probability that the second future interval is H, because that event also allows an intervening N.
The initial probability 0.3 does not enter these conditional forecasts once the current H is given. It does enter the earlier calculation of an entire sequence beginning before its first state is observed.
These are stipulated probabilities, not fitted service measurements. The example neither validates the first-order assumption nor establishes that the same transitions will hold during a promotion or outage. A real application would compare predictions with observed outcomes and examine whether information beyond the latest state improves performance.
Illustrative case study
Fictional Cedar Operations summarizes each three-interval history only by its number of high-workload intervals. It consequently treats H,H,N and H,N,H as interchangeable inputs.
A reviewer preserves their order and demonstrates the different sequence probabilities in the worked model. Cedar then compares an order-aware forecasting approach with its count-based baseline on suitable later observations. It also checks whether time gaps and calendar information matter. This invented case illustrates an evaluation question; it does not claim that a more complex model necessarily performs better.
Common misconceptions and mistakes
"Every sequence model is a recurrent neural network." Markov models, window-based predictors and other architectures can also model sequences.
"The latest state always contains enough history." That is a restriction in the example, not a universal fact.
"A likely sequence must occur." A probability describes uncertainty, not a promise.
"Using future context is always acceptable." It depends on whether that context is available when the intended prediction is made.
Business use
Define the operational prediction clearly: the next event, an entire trajectory and a classification of a completed history are different outputs. Record sequence boundaries, event order, missing events and information availability.
For AI-generated analyses, check that probabilities refer to the right event. In the worked example, 0.64 describes two successive high intervals, while 0.68 describes a high interval two steps ahead. Confusing them can alter a capacity decision. Assess performance against a simple baseline and investigate changes in operating conditions before relying on historical patterns.
People also ask
Must inputs be text?
No; sequences can contain measurements, actions, events or other ordered elements.
Must intervals be equally spaced?
No, but timing may require explicit representation.
Does a sequence model establish causation?
No; predictive dependence alone does not identify causal effects.
Check your understanding
Why do H,H,N and H,N,H receive different probabilities?
Answer: Their transition patterns differ.
Why is the two-step probability 0.68 rather than 0.64?
Answer: The intermediate N route contributes another 0.04.
What does first-order mean here?
Answer: The next-state distribution depends only on the current state.
Related terms
- Recurrent neural network
- Attention
- Conditional probability
- Sequence-to-sequence task
- Data leakage
- Sequential dependence
- Markov model
- autoregression
Learn next
Starting from N, calculate the probability of H two intervals ahead using both intermediate states. Explain why adding routes differs from selecting only the most likely route.
More in Statistics and probability
- Sensitivity study - A sensitivity study investigates how changes in a process's or model's inputs affect selected outputs.
- Separation test - A separation test is an early-phase statistical decision procedure intended to help decide whether further research is worth pursuing.
- Sequence effect - A sequence effect occurs when experiencing one condition influences a person's response to another condition presented later.
- Sequential analysis - Sequential analysis is statistical analysis in which accumulating observations can determine whether to continue collecting data or stop according to a...
- Sequential probability ratio test - The sequential probability ratio test, or SPRT, compares the accumulating likelihood of observations under two specified hypotheses.
- Sequential studies - Sequential studies divide an investigation into distinct phases and allow findings from one phase to influence the design or purpose of later phases.
Sources
Google Machine Learning Glossary, sequence model: https://developers.google.com/machine-learning/glossary#sequence-model
Dive into Deep Learning, Working with Sequences, autoregressive and Markov models: https://d2l.ai/chapter_recurrent-neural-networks/sequence.html
Previous: Sequence labeling Next: Sequence-to-sequence (seq2seq)