AI Dictionary of Terms

Autoregressive

A modeling approach where each element in a sequence is predicted based on all previous elements, generating outputs one token at a time in a left-to-right fashion — the foundational principle behind GPT, Llama, Claude, and most modern language models.

The Simple Version

Imagine writing a story where you can only write one word at a time, and each word must make sense given everything you’ve written so far. You write “The” → then “cat” → then “sat” → then “on” → then “the” → then “mat”. Each word depends on all the words before it.

That’s autoregressive generation. The AI predicts the next token based on the entire sequence it has generated so far, adds it to the sequence, and repeats. It’s like a very sophisticated autocomplete that builds text one piece at a time.

Detailed Explanation

In autoregressive models, the probability of a sequence is decomposed as a product of conditional probabilities:

P(x₁, x₂, …, xₙ) = P(x₁) × P(x₂ x₁) × P(x₃ x₁,x₂) × … × P(xₙ x₁,…,xₙ₋₁)

Each token is sampled from the model’s probability distribution conditioned on all previous tokens. This creates a causal dependency — you cannot generate token N without first generating tokens 1 through N-1.

Key Properties:

Autoregressive vs. Non-Autoregressive:

Key Characteristics

Business Context

Understanding autoregressive generation helps explain AI behavior and limitations:

Implications:

Optimization Strategies:

Real-World Analogy

Building a tower of blocks one at a time. Each block must be placed carefully based on the structure below it. You can’t place the 10th block without first placing blocks 1-9. The sequential nature ensures stability but limits speed.

Code Example

# Autoregressive generation with Hugging Face
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")

prompt = "The future of AI is"
inputs = tokenizer(prompt, return_tensors="pt")

# Autoregressive generation - one token at a time
output = model.generate(
    **inputs,
    max_new_tokens=20,
    do_sample=True,
    temperature=0.7
)

# Each token was generated sequentially based on all previous tokens
print(tokenizer.decode(output[0]))

Common Misconceptions

Sources & Further Reading