What is an AI autoregressive model?

An autoregressive model builds a sequence one element at a time, choosing each new element from a probability distribution conditioned on the elements produced so far.

It differs from masked language modelling in the direction of context: masked models predict hidden tokens from both sides and focus on understanding, while an autoregressive model looks only at the context to its left and generates text. Most of today's chat models are autoregressive and decoder-only.

Topic
Machine learning, models and training
Also known as
AR model

How an AI autoregressive model works

  1. The model reads all prompt tokens and computes a probability distribution over the vocabulary for the next token.
  2. A token is chosen from the distribution and appended to the sequence.
  3. The longer sequence becomes the new input; computed keys and values are kept in the KV cache so each step computes only the new token.
  4. The loop stops at an end token or maximum length; every token of the answer is a separate step.

In more detail

The chain rule and the causal attention mask

Mathematically, an autoregressive language model factorises the joint probability of a sequence via the chain rule into the product of each token's probability given the tokens before it. In Transformer architectures, this unidirectional dependency is enforced by a causal attention mask that prevents each position from attending to future tokens.

Prefill and decode phases, TTFT and TPOT

Autoregressive inference splits into two distinct phases: a compute-bound prefill phase that processes all prompt tokens in parallel and a memory-bandwidth-bound decode phase that generates output tokens one by one. Because of this split, production capacity planning separates Time to First Token (TTFT) from Time Per Output Token (TPOT).

Teacher forcing and exposure bias

During training, autoregressive models use teacher forcing, feeding the ground-truth prefix at every position so all tokens in a sequence are trained in parallel without waiting for step-by-step generation. At inference, ground truth is absent and the model conditions on its own previous outputs, creating a train-inference mismatch known as exposure bias.

Commonly confused terms

TermHow it differs
Encoder-decoder architectureA sequence-to-sequence encoder-decoder model (e.g. T5) encodes the full source sequence bidirectionally first and then decodes the target autoregressively via cross-attention. Most modern chat LLMs are decoder-only autoregressive models without a separate encoder.
Non-autoregressive and diffusion language modelsNon-autoregressive or diffusion language models predict multiple tokens simultaneously or iteratively denoise an entire sequence in parallel to bypass one-token-at-a-time latency, whereas autoregressive models factorise joint probability strictly sequentially via the chain rule.

Why an AI autoregressive model matters for on-premises AI

Autoregressive generation drives in-house capacity planning: tokens come one at a time, so time grows at least linearly with answer length and a single request cannot use a GPU's full parallel power. Techniques such as continuous batching, quantisation that cuts memory traffic and speculative decoding, which verifies several tokens per step, address this. Since a generated token cannot be taken back, an early error can carry through the rest of the answer.

ON-PREMISES EXAMPLE

A bank drafts monthly market commentary with an in-house autoregressive model, estimating response time for long reports from the number of tokens to generate and the server's tokens-per-second capacity.

Common questions

How does an autoregressive model differ from a masked language model?

An autoregressive model sees only left context and generates left to right. A masked model predicts hidden tokens from both sides and is strong for understanding and embeddings.

Why is autoregressive generation slow?

Each token depends on the previous one, so steps cannot run in parallel. Longer answers mean more steps; batching and speculative decoding ease this.

Sources

In the glossary: Glossary, A to D

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.