TL;DR
This paper bridges the gap between what Transformers can theoretically represent and what they can actually learn. By combining the "narrow teacher" framework with C-RASP (a programming language that compiles into Transformers), the authors derive the first sample complexity bounds for learning structured algorithmic tasks, showing that wider networks can easily find and embed compact, correct solutions.
What Problem Does This Paper Address?
Theoretical deep learning has a massive gap: while we know Transformers are incredibly expressive—meaning we can hand-craft weights to solve complex formal languages like Dyck-1 (well-balanced parentheses) or $a^nb^n$—we don't know if standard training can actually find these solutions. Most past work focuses purely on expressivity, leaving the question of learnability open.
This paper addresses this gap by establishing sample complexity bounds—calculating exactly how many data samples a Transformer needs to successfully learn a specific algorithmic task.
Methods
The authors connect expressivity to learnability by combining two distinct theoretical frameworks:
- The Narrow Teacher Framework: Borrowed from recent loss landscape analysis, this framework posits that a randomly initialized, wide "student" network will generalize well if there exists a smaller, valid "narrow teacher" network embedded within its hypothesis class. If the volume of these "good" solutions in the loss landscape is large enough, a simple learning procedure can find them.
- C-RASP (Counting RASP): A variant of the RASP programming language that maps directly onto soft-attention, future-masked Transformers.
The authors use a constraint-counting argument to determine how many parameters in a large student Transformer must be fixed to perfectly mimic a narrow teacher executing a given C-RASP program. They analyze these fixed-precision (Q-quantized) networks under a simplified "Guess and Check" learning algorithm to estimate the probability of hitting a generalizing solution.
Datasets
Not discussed in the paper. This is a purely theoretical work and does not introduce or evaluate empirical datasets.
Key Insights and Ideas
- Bridging the Gap: Instead of treating expressivity and optimization as separate problems, this work demonstrates that constructive expressivity proofs (like C-RASP programs) inherently contain the blueprints for bounding learnability.
- The "Garbage" Dimension Trick: When embedding a narrow teacher into a deeper student network ($L > L^*$), the student doesn't need to keep the entire network clean. It only needs to preserve the teacher's core coordinates in the top dimensions while letting the remaining wide dimensions accumulate arbitrary "garbage" values. This "weak identity" layer argument dramatically reduces the number of constraints required for deep networks.
- Tighter Bounds than Occam's Razor: Standard parameter-counting arguments (like Occam's razor) yield a sample complexity of $O(Ld^2)$ for a network of depth $L$ and width $d$. By exploiting the specific structural alignment of C-RASP, this paper tightens the bound to $O(Ld)$.
Key Results
The main theoretical contribution (Theorem 2.1) proves that for a C-RASP program of depth $n$ with $m$ variables, a single-head student Transformer of depth $L \ge n$ and width $d$ can learn the task with a sample complexity of:
$$N \ge O\left(\frac{1}{\epsilon} Ld \log Q\right)$$
To illustrate this, the authors look at a C-RASP program designed to recognize Dyck-1 (the language of well-balanced parentheses):
Because this program has a fixed depth ($n=7$) and number of variables ($m=9$), a student network with sufficient layers and width can learn to recognize well-balanced parentheses with a sample complexity of $N \ge O\left(\frac{Ld}{\epsilon}\right)$.
Limitations and Future Work
- No Empirical Validation: The authors note that their framework has not yet been empirically validated to see if the loss landscapes of actual Transformers or State Space Models reflect these length-generalization bounds in practice.
- Pessimistic Bounds: The current mathematical approach only accounts for a single unique encoding of the teacher within the student network. In reality, a narrow teacher could be embedded in many different permutations or ways inside a wide student, meaning the true success probability is likely higher and the sample complexity bound could be tightened further.
Summary updated