TL;DR
Neural networks often fail to generalize on simple formal languages like $a^nb^n$, even though they are theoretically capable of representing the solution. This paper demonstrates that the problem isn't just optimization "bad luck," but rather that standard training objectives (like Cross-Entropy with L1/L2 regularization) actually disfavor the correct solution; by switching to a Minimum Description Length (MDL) objective, the theoretically perfect solution finally becomes a true mathematical optimum.
What Problem Does This Paper Address?
There is a frustrating gap between what neural networks can do in theory and what they actually do in practice. For example, we know that Long Short-Term Memory (LSTM) networks are expressive enough to "count" and solve formal languages like $a^nb^n$ (strings of $n$ 'a's followed by $n$ 'b's). However, in practice, LSTMs trained with standard methods almost always fail to generalize to strings longer than those seen during training.
The authors investigate whether this failure is due to the search algorithm (gradient descent) or the "goalpost" itself (the loss function). They argue that standard regularization techniques like L1 and L2, which penalize large weight magnitudes, are poor proxies for true simplicity and actually lead the model away from the generalizable, "correct" solution.
Methods
The researchers take a unique approach by comparing a "Golden" network to traditionally trained ones:
- The Golden Network: They manually construct an optimal LSTM that implements a stable counting mechanism, guaranteed to work for any length $n$.
- MDL Objective: They replace standard regularization with an MDL objective: $H^* = \arg \min_{H \in \mathcal{H}} |H|_C + |D : H|$. Here, $|H|_C$ is the length of the network's description (its "complexity") and $|D : H|$ is the data's description length given the model (cross-entropy).
- Novel Encoding: To measure $|H|_C$, they use a prefix-free binary encoding for weights represented as rational fractions. This penalizes "complex" weights (those requiring many bits to describe) rather than just "large" weights.
- Loss Surface Exploration: They visualize the loss landscape in the high-dimensional weight space around both the Golden and trained networks to see which objectives actually have a minimum at the perfect solution.
Datasets
The study uses the formal language $a^nb^n$, generated by a Probabilistic Context-Free Grammar (PCFG).
- Training: 1,000 strings with a maximum $n$ of 21.
- Validation: Strings with $22 \le n \le 71$.
- Testing: Strings with $1 \le n \le 1,500$ to evaluate extreme out-of-distribution generalization.
Key Insights and Ideas
- Simplicity $\neq$ Small Magnitude: Standard L1/L2 regularization assumes small weights are "simple." The authors show this is a fallacy: a model can "smuggle" huge amounts of specific information into very small weights (e.g., via fractal encodings), leading to overfitting. MDL's bit-count approach is a much more robust measure of true simplicity.
- The Objective is Pathological: The most striking finding is that the perfect "Golden" solution is not an optimum for Cross-Entropy + L1/L2. If you start at the perfect solution and perform gradient descent with these standard losses, the model will actually move away from the correct solution toward a suboptimal one that generalizes poorly.
- Generalization Failure is Inherent: These findings suggest that the failure of LSTMs to learn formal languages is an inherent property of current training objectives, not just a lack of data or compute.
Key Results
- Accuracy: The manually built Golden network achieved 100% test accuracy up to $n=1500$. The best trained LSTM (using standard hyperparameter grid search) failed at $n=73$, achieving only 77.3% accuracy.
- Loss Alignment: As shown in the table below, only the MDL objective aligned the minimum training loss with the highest test accuracy. For L1 and L2, the "best" models according to the loss function were actually quite poor at generalizing.
| Objective | Golden Net Accuracy | Trained Net Accuracy | Result |
|---|---|---|---|
| CE + L1 | 100% (Not an optimum) | 77.2% (Optimum) | Failure |
| CE + L2 | 99.8% (Not an optimum) | 77.2% (Optimum) | Failure |
| MDL | 100% (Optimum) | 77.9% | Success |
Limitations and Future Work
- Optimization Difficulty: The MDL objective results in a highly irregular, non-differentiable loss surface (see Figure 1c). This makes it extremely difficult to optimize using standard gradient descent, requiring alternative methods like neuroevolution.
- Scalability: The study focused on a single formal language ($a^nb^n$) and a small LSTM (hidden size 3). Whether these findings translate directly to massive Transformers or complex natural language tasks remains an open question, though the authors argue the MDL principle is general.
- Differentiable Proxies: A major future direction is finding differentiable "proxies" for MDL that capture its benefits while remaining compatible with backpropagation.
Summary updated