Large Language Models as Markov Chains

Oussama Zekri, Ambroise Odonnat, Abdelhakim Benechehab, Linus Bleistein, Nicolas Boullé +1 more
10/3/2024
stat.MLcs.AIcs.CL

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zekri2024large,
  title  = {Large Language Models as Markov Chains},
  author = {Oussama Zekri and Ambroise Odonnat and Abdelhakim Benechehab and Linus Bleistein and Nicolas Boullé and Ievgen Redko},
  year   = {2024},
  eprint = {2410.02724},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.02724v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.02724.svg)](https://codeofpaper.com/paper/2410.02724)

Discussion