Autoregressive model

An autoregressive model predicts the next value in a sequence from the values before it, then feeds each prediction back in to produce the one after, which is how most chatbots generate text.

The term comes from statistics. A classic autoregressive model expresses the next value of a time series, such as a monthly sales figure, as a weighted combination of its own previous values plus some random noise. A classic way to estimate those weights is named after Udny Yule, who worked on it in 1927, and Gilbert Walker, in 1931. Models of this kind remain a staple of forecasting and econometrics.

Machine learning applies the same idea with neural networks and much richer predictions. Instead of a single number, the model outputs a probability for every possible next element given everything that came before. To generate, it picks an element, appends it to the sequence and repeats. Google's machine learning glossary describes an autoregressive model as one that bases each prediction on its own previous predictions, such as predicting the next token from the tokens it has already produced.

Many landmark systems work this way. When OpenAI introduced GPT-3 in May 2020, its authors described it as an autoregressive language model with 175 billion parameters. DeepMind's WaveNet, from September 2016, generated speech audio the same way, predicting each audio sample from all the samples before it. The Wikipedia article on the statistical model points out one distinction: language models are called autoregressive, but unlike the classical models they are not linear.

The approach has consequences you can see. Text appears word by word because it really is produced token by token, and a long answer takes longer than a short one because each token requires another pass through the model. Once a token is emitted the model cannot go back and revise it; it can only continue. Diffusion language models, which refine a whole block of text over several steps, are one attempt to escape this sequential bottleneck.

Common questions

What does autoregressive mean in AI?

It means the model generates a sequence one piece at a time, with each new piece predicted from all the pieces before it, including the ones the model has just produced itself. Most large language models generate text this way, one token after another.

Are large language models autoregressive?

Most widely used ones are. GPT-3 was described by its authors as an autoregressive language model, and families such as Llama and Gemma are decoder-only transformers trained to predict the next token. Diffusion language models are an exception, generating blocks of text in parallel rather than strictly left to right.

What is an autoregressive model in time series analysis?

In statistics, an autoregressive model forecasts the next value of a series as a linear combination of a fixed number of its previous values plus random noise. An AR(1) model uses the last value, an AR(2) model the last two, and so on. These models are widely used in economics, finance and signal processing.

Why do chatbots show their answers word by word?

Because they generate them that way. An autoregressive model produces one token, adds it to the text so far, and runs again to produce the next. Streaming each token to the screen as it is produced lets you start reading before the full answer is finished.

Finding more

Search for "autoregressive language model", "next-token prediction" or "AR model time series" depending on whether you are interested in AI or statistics. Statistics textbooks and the documentation of tools such as statsmodels cover the classical model; papers on arXiv and documentation from model developers cover the neural version. Be aware that the same word describes both, so check which meaning an article intends.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.