Transformers on Markov Data: Constant Depth Suffices

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Rajaraman, Nived, Bondaschi, Marco, Ramchandran, Kannan, Gastpar, Michael, Makkuva, Ashok Vardhan
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866914886414499840
author Rajaraman, Nived
Bondaschi, Marco
Ramchandran, Kannan
Gastpar, Michael
Makkuva, Ashok Vardhan
author_facet Rajaraman, Nived
Bondaschi, Marco
Ramchandran, Kannan
Gastpar, Michael
Makkuva, Ashok Vardhan
contents Attention-based transformers have been remarkably successful at modeling generative processes across various domains and modalities. In this paper, we study the behavior of transformers on data drawn from \kth Markov processes, where the conditional distribution of the next symbol in a sequence depends on the previous $k$ symbols observed. We observe a surprising phenomenon empirically which contradicts previous findings: when trained for sufficiently long, a transformer with a fixed depth and $1$ head per layer is able to achieve low test loss on sequences drawn from \kth Markov sources, even as $k$ grows. Furthermore, this low test loss is achieved by the transformer's ability to represent and learn the in-context conditional empirical distribution. On the theoretical side, our main result is that a transformer with a single head and three layers can represent the in-context conditional empirical distribution for \kth Markov sources, concurring with our empirical observations. Along the way, we prove that \textit{attention-only} transformers with $O(\log_2(k))$ layers can represent the in-context conditional empirical distribution by composing induction heads to track the previous $k$ symbols in the sequence. These results provide more insight into our current understanding of the mechanisms by which transformers learn to capture context, by understanding their behavior on Markov sources.
format Preprint
id arxiv_https___arxiv_org_abs_2407_17686
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Transformers on Markov Data: Constant Depth Suffices
Rajaraman, Nived
Bondaschi, Marco
Ramchandran, Kannan
Gastpar, Michael
Makkuva, Ashok Vardhan
Machine Learning
Computation and Language
Information Theory
Attention-based transformers have been remarkably successful at modeling generative processes across various domains and modalities. In this paper, we study the behavior of transformers on data drawn from \kth Markov processes, where the conditional distribution of the next symbol in a sequence depends on the previous $k$ symbols observed. We observe a surprising phenomenon empirically which contradicts previous findings: when trained for sufficiently long, a transformer with a fixed depth and $1$ head per layer is able to achieve low test loss on sequences drawn from \kth Markov sources, even as $k$ grows. Furthermore, this low test loss is achieved by the transformer's ability to represent and learn the in-context conditional empirical distribution. On the theoretical side, our main result is that a transformer with a single head and three layers can represent the in-context conditional empirical distribution for \kth Markov sources, concurring with our empirical observations. Along the way, we prove that \textit{attention-only} transformers with $O(\log_2(k))$ layers can represent the in-context conditional empirical distribution by composing induction heads to track the previous $k$ symbols in the sequence. These results provide more insight into our current understanding of the mechanisms by which transformers learn to capture context, by understanding their behavior on Markov sources.
title Transformers on Markov Data: Constant Depth Suffices
topic Machine Learning
Computation and Language
Information Theory
url https://arxiv.org/abs/2407.17686