LGAIJan 30, 2025

On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learning

MIT
arXiv:2501.18187v35 citationsh-index: 67
Originality Highly original
AI Analysis

This addresses a key limitation in understanding and improving Transformers for nonlinear in-context learning, which is incremental but provides theoretical insights for AI researchers.

The paper tackles the problem of enabling Transformers to perform in-context learning for nonlinear tasks, proving that linear self-attention alone is insufficient and showing that feed-forward layers allow Transformers to implement gradient descent on polynomial kernel regression, with deep models overcoming expressivity limits by distributing computation across blocks.

Transformer-based models demonstrate a remarkable ability for in-context learning (ICL), where they can adapt to unseen tasks from a few prompt examples without parameter updates. Recent research has illuminated how Transformers perform ICL, showing that the optimal linear self-attention (LSA) mechanism can implement one step of gradient descent for linear least-squares objectives when trained on random linear regression tasks. Building on this, we investigate ICL for nonlinear function classes. We first prove that LSA is inherently incapable of outperforming linear predictors on nonlinear tasks, underscoring why prior solutions cannot readily extend to these problems. To overcome this limitation, we analyze a Transformer block consisting of LSA and feed-forward layers inspired by the gated linear units (GLU), which is a standard component of modern Transformers. We show that this block achieves nonlinear ICL by implementing one step of gradient descent on a polynomial kernel regression loss. Furthermore, our analysis reveals that the expressivity of a single block is inherently limited by its dimensions. We then show that a deep Transformer can overcome this bottleneck by distributing the computation of richer kernel functions across multiple blocks, performing block-coordinate descent in a high-dimensional feature space that a single block cannot represent. Our findings highlight that the feed-forward layers provide a crucial and scalable mechanism by which Transformers can express nonlinear representations for ICL.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes