Learning In-context $n$-grams with Transformers: Sub-$n$-grams Are Near-Stationary Points
In this article, we explore the loss landscape of next-token prediction with transformers. Specifically, we focus on learning in-context n-gram language models with cross-entropy loss using a simplified two-layer transformer. We design a series of transformers that represent $k$-grams (for $k \leq n…