Learning and Transferring Sparse Contextual Bigrams with Linear Transformers

Yunwei Ren, Zixuan Wang, Jason D. Lee
10/30/2024
cs.LGcs.CL

No confident code implementation found for this paper.

Abstract

Transformers have excelled in natural language modeling and one reason behind this success is their exceptional ability to combine contextual informal and global knowledge. However, the theoretical basis remains unclear. In this paper, first we introduce the Sparse Contextual Bigram (SCB), a natural extension of the classical bigram model, where the next token's generation depends on a sparse set of earlier positions determined by the last token. We then analyze the training dynamics and sample complexity of learning SCB using a one-layer linear transformer with a gradient-based algorithm. We show that when trained from scratch, the training process can be split into an initial sample-intensive stage where the correlation is boosted from zero to a nontrivial value, followed by a more sample-efficient stage of further improvement. Additionally, we prove that, provided a nontrivial correlation between the downstream and pretraining tasks, finetuning from a pretrained model allows us to bypass the initial sample-intensive stage. We also empirically demonstrate that our algorithm can outperform SGD in this setting and discuss its relationship with the usual softmax-based transformers.

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. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

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

Cite this paper

@article{ren2024learning,
  title  = {Learning and Transferring Sparse Contextual Bigrams with Linear Transformers},
  author = {Yunwei Ren and Zixuan Wang and Jason D. Lee},
  year   = {2024},
  eprint = {2410.23438},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2410.23438},
  url    = {http://arxiv.org/abs/2410.23438v1},
  journal = {NEURIPS 2024 2024}
}

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.23438.svg)](https://codeofpaper.com/paper/2410.23438)

Discussion