Transformers Can Represent $n$-gram Language Models

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Svete, Anej, Cotterell, Ryan
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866929391727017984
author Svete, Anej
Cotterell, Ryan
author_facet Svete, Anej
Cotterell, Ryan
contents Existing work has analyzed the representational capacity of the transformer architecture by means of formal models of computation. However, the focus so far has been on analyzing the architecture in terms of language \emph{acceptance}. We contend that this is an ill-suited problem in the study of \emph{language models} (LMs), which are definitionally \emph{probability distributions} over strings. In this paper, we focus on the relationship between transformer LMs and $n$-gram LMs, a simple and historically relevant class of language models. We show that transformer LMs using the hard or sparse attention mechanisms can exactly represent any $n$-gram LM, giving us a concrete lower bound on their probabilistic representational capacity. This provides a first step towards understanding the mechanisms that transformer LMs can use to represent probability distributions over strings.
format Preprint
id arxiv_https___arxiv_org_abs_2404_14994
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Transformers Can Represent $n$-gram Language Models
Svete, Anej
Cotterell, Ryan
Computation and Language
Artificial Intelligence
Computational Complexity
Formal Languages and Automata Theory
Machine Learning
Existing work has analyzed the representational capacity of the transformer architecture by means of formal models of computation. However, the focus so far has been on analyzing the architecture in terms of language \emph{acceptance}. We contend that this is an ill-suited problem in the study of \emph{language models} (LMs), which are definitionally \emph{probability distributions} over strings. In this paper, we focus on the relationship between transformer LMs and $n$-gram LMs, a simple and historically relevant class of language models. We show that transformer LMs using the hard or sparse attention mechanisms can exactly represent any $n$-gram LM, giving us a concrete lower bound on their probabilistic representational capacity. This provides a first step towards understanding the mechanisms that transformer LMs can use to represent probability distributions over strings.
title Transformers Can Represent $n$-gram Language Models
topic Computation and Language
Artificial Intelligence
Computational Complexity
Formal Languages and Automata Theory
Machine Learning
url https://arxiv.org/abs/2404.14994