paper-with-me

홈 › Papers

Transformers learn variable-order Markov chains in-context

2024-10-07 · Ruida Zhou, Chao Tian, Suhas Diggavi

Large language models have demonstrated impressive in-context learning (ICL) capability. However, it is still unclear how the underlying transformers accomplish it, especially in more complex scenarios. Toward this goal, several recent works studied how transformers learn fixed-order Markov chains (FOMC) in context, yet natural languages are more suitably modeled by variable-order Markov chains (VOMC), i.e., context trees (CTs). In this work, we study the ICL of VOMC by viewing language modeling as a form of data compression and focus on small alphabets and low-order VOMCs. This perspective allows us to leverage mature compression algorithms, such as context-tree weighting (CTW) and prediction by partial matching (PPM) algorithms as baselines, the former of which is Bayesian optimal for a class of CTW priors. We empirically observe a few phenomena: 1) Transformers can indeed learn to compress VOMC in-context, while PPM suffers significantly; 2) The performance of transformers is not very sensitive to the number of layers, and even a two-layer transformer can learn in-context quite well; and 3) Transformers trained and tested on non-CTW priors can significantly outperform the CTW algorithm. To explain these phenomena, we analyze the attention map of the transformers and extract two mechanisms, on which we provide two transformer constructions: 1) A construction with $D+2$ layers that can mimic the CTW algorithm accurately for CTs of maximum order $D$, 2) A 2-layer transformer that utilizes the feed-forward network for probability blending. One distinction from the FOMC setting is that a counting mechanism appears to play an important role. We implement these synthetic transformer layers and show that such hybrid transformers can match the ICL performance of transformers, and more interestingly, some of them can perform even better despite the much-reduced parameter sets.

📄 PDF Abstract BibTeX arXiv:2410.05493

Code (0)

등록된 구현이 없습니다.

Tasks

Data CompressionIn-Context LearningLanguage ModelingLanguage Modelling

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음
Focus 설명 없음

Similar Papers 제목 키워드 기반

Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chains

2024-02-06 · Ashok Vardhan Makkuva, Marco Bondaschi, Adway Girish, Alliot Nagle 외

In recent years, attention-based transformers have achieved tremendous success across a variety of disciplines including natural languages. A key ingredient behind their success is the generative pretraining procedure, d…

What One Cannot, Two Can: Two-Layer Transformers Provably Represent Induction Heads on Any-Order Markov Chains

2025-08-10 · Chanakya Ekbote, Marco Bondaschi, Nived Rajaraman, Jason D. Lee 외 arxiv

In-context learning (ICL) is a hallmark capability of transformers, through which trained models learn to adapt to new tasks by leveraging information from the input context. Prior work has shown that ICL emerges in tran…

Local to Global: Learning Dynamics and Effect of Initialization for Transformers

2024-06-05 · Ashok Vardhan Makkuva, Marco Bondaschi, Chanakya Ekbote, Adway Girish 외

In recent years, transformer-based models have revolutionized deep learning, particularly in sequence modeling. To better understand this phenomenon, there is a growing interest in using Markov input processes to study t…

The Evolution of Statistical Induction Heads: In-Context Learning Markov Chains

2024-02-16 · Benjamin L. Edelman, Ezra Edelman, Surbhi Goel, Eran Malach 외

Large language models have the ability to generate text that mimics patterns in their inputs. We introduce a simple Markov Chain sequence modeling task in order to study how this in-context learning (ICL) capability emer…

In-Context Learning

Concentration inequality for U-statistics of order two for uniformly ergodic Markov chains

2020-11-20 · Quentin Duchemin, Yohann de Castro, Claire Lacour

We prove a new concentration inequality for U-statistics of order two for uniformly ergodic Markov chains. Working with bounded and $\pi$-canonical kernels, we show that we can recover the convergence rate of Arcones and…

Blocking