Large Language Models as Markov Chains

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zekri, Oussama, Odonnat, Ambroise, Benechehab, Abdelhakim, Bleistein, Linus, Boullé, Nicolas, Redko, Ievgen
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916594465112064
author Zekri, Oussama
Odonnat, Ambroise
Benechehab, Abdelhakim
Bleistein, Linus
Boullé, Nicolas
Redko, Ievgen
author_facet Zekri, Oussama
Odonnat, Ambroise
Benechehab, Abdelhakim
Bleistein, Linus
Boullé, Nicolas
Redko, Ievgen
contents Large language models (LLMs) are remarkably efficient across a wide range of natural language processing tasks and well beyond them. However, a comprehensive theoretical analysis of the LLMs' generalization capabilities remains elusive. In our paper, we approach this task by drawing an equivalence between autoregressive transformer-based language models and Markov chains defined on a finite state space. This allows us to study the multi-step inference mechanism of LLMs from first principles. We relate the obtained results to the pathological behavior observed with LLMs such as repetitions and incoherent replies with high temperature. Finally, we leverage the proposed formalization to derive pre-training and in-context learning generalization bounds for LLMs under realistic data and model assumptions. Experiments with the most recent Llama and Gemma herds of models show that our theory correctly captures their behavior in practice.
format Preprint
id arxiv_https___arxiv_org_abs_2410_02724
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Large Language Models as Markov Chains
Zekri, Oussama
Odonnat, Ambroise
Benechehab, Abdelhakim
Bleistein, Linus
Boullé, Nicolas
Redko, Ievgen
Machine Learning
Artificial Intelligence
Computation and Language
Large language models (LLMs) are remarkably efficient across a wide range of natural language processing tasks and well beyond them. However, a comprehensive theoretical analysis of the LLMs' generalization capabilities remains elusive. In our paper, we approach this task by drawing an equivalence between autoregressive transformer-based language models and Markov chains defined on a finite state space. This allows us to study the multi-step inference mechanism of LLMs from first principles. We relate the obtained results to the pathological behavior observed with LLMs such as repetitions and incoherent replies with high temperature. Finally, we leverage the proposed formalization to derive pre-training and in-context learning generalization bounds for LLMs under realistic data and model assumptions. Experiments with the most recent Llama and Gemma herds of models show that our theory correctly captures their behavior in practice.
title Large Language Models as Markov Chains
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2410.02724