InfoFlow: A Framework for Multi-Layer Transformer Analysis

Penghao Yu, Haotian Jiang, Zeyu Bao, Qianxiao Li

TL;DR

While we know multi-layer Transformers perform exceptionally well in practice, mathematically proving why they outperform single-layer architectures has remained a major challenge. This paper establishes a formal "depth separation" proof showing that two layers can be exponentially more parameter-efficient than one, and introduces InfoFlow—a framework that tracks discrete information propagation to predict whether a Transformer architecture can successfully learn a given task.

What Problem Does This Paper Address?

Most theoretical breakthroughs in understanding Transformers have been restricted to single-layer architectures. Analyzing multi-layer Transformers is notoriously difficult because of the complex, non-linear interplay between self-attention layers and feed-forward networks (FFNs) across multiple levels of depth.

As a result, we lack answers to fundamental questions: How much more powerful is a multi-layer Transformer than a single-layer one? and Can we quantitatively predict if a specific architecture (given its depth, head count, and embedding size) can efficiently learn a task before we spend millions training it? This paper tackles these questions by analyzing the structural mechanisms of information flow across layers.

Methods

The authors approach the problem by first proving a depth separation result and identifying the core limitations of softmax attention. They then build InfoFlow, a coarse-grained theoretical framework inspired by effective theories in physics (like thermodynamics).

Instead of tracking continuous hidden vector representations, InfoFlow associates a discrete information set $I(t, l)$ to each token position $t$ at layer $l$, representing the collection of input positions whose information remains accessible. InfoFlow models information propagation using three distinct structural mechanisms:

  1. Max-position retrieval: Softmax attention naturally concentrates on and efficiently retrieves only the token with the maximum attention score (argmax).
  2. Global information aggregation: A head compresses information from the entire sequence into a single token state (highly inefficient for long sequences).
  3. Specific position aggregation: Utilizing positional encodings to select fixed indices independent of token content.

By defining a task's complexity through a metric called the Number of Comparison (derived via a "Tree of Comparison"), InfoFlow can estimate the parameter cost lower bounds for $\varepsilon$-approximation prior to training.

Datasets

Because this is a pure theoretical and architectural analysis paper, the authors do not use standard NLP datasets (like WikiText or GLUE). Instead, they validate their framework using precisely controlled synthetic mathematical targets designed to isolate specific retrieval behaviors:

  • Permutation-invariant pairwise max target: Used to evaluate the "intrinsic dimension" of a network by requiring $D$ independent matrix-multiplication comparisons.
  • Triangle-center target: A higher-order retrieval task requiring three tokens to be compared simultaneously: $F(X_T) = \min_{1\leq t_1,t_2,t_3\leq T} \|x(t_1) + x(t_2) + x(t_3)\|_2^2$.
  • Fixed position target: Used to verify specific position aggregation using positional encodings.

Key Insights and Ideas

  • The Power of Two Layers: A single-layer Transformer must resolve all sequence comparisons in one shot, forcing its FFNs to blow up exponentially with sequence length $T$. A two-layer Transformer can decompose the problem: Layer 1 finds the most relevant local neighbors, and Layer 2 aggregates these local results globally. This drops the parameter cost from exponential ($\Omega(\varepsilon^{-k})$) to linear ($O(\varepsilon^{-1})$).
  • Softmax is an Argmax Maximalist: Softmax attention is fundamentally limited to retrieving the maximum attention score token. Trying to retrieve the $k$-th largest token ($k \geq 2$) causes parameter costs to scale exponentially with sequence length $T$.
  • The Intrinsic Dimension Match: For a task requiring $D$ independent pairwise comparisons, the first layer must have at least $D$ attention heads ($h_1 \geq D$). If it has fewer, the model experiences a catastrophic failure in approximation.
  • Higher-Order Hardness: Transformers are inherently bad at tasks requiring simultaneous multi-token comparisons (order $\beta' > 2$, like the triangle-center problem). InfoFlow correctly predicts that the parameter cost for such tasks scales super-polynomially with sequence length $T$, meaning fixed-size Transformers will inevitably fail as the input sequence grows.

Key Results

  • Empirical Phase Transition: When training a 2-layer Transformer on a pairwise max target of dimension $D$, the authors observed a sharp phase transition. Architectures with $(D, D)$ heads achieved a best validation Normalized Mean Square Error (NMSE) of $\sim 10^{-5}$. Dropping just a single head to $(D-1, D)$ or $(D, D-1)$ degraded the NMSE by two to three orders of magnitude ($10^{-3}$ to $10^{-2}$).
Pairwise Max Task (T=64)
Heads (h1, h2) | Validation NMSE
---------------------------------
(D,   D)       | ~ 10^-5  (Success)
(D-1, D)       | ~ 10^-3  (Failure)
(D,   D-1)     | ~ 10^-2  (Failure)
  • Triangle-Center Failure: On the higher-order triangle-center task, all tested Transformer configurations (regardless of head count or embedding dimension) showed rapidly growing NMSE as sequence length $T$ scaled. The NMSE exceeded 0.85 at $T=16$ and approached 1.0 (equivalent to a random/constant predictor) at $T \geq 32$, empirically validating InfoFlow's prediction of super-polynomial hardness.

Limitations and Future Work

  • Attention Matrix Rank: The current InfoFlow parameter cost law does not account for the mathematical rank of the attention weight matrices, which plays a known role in attention capacity.
  • Synthetic vs. Real-World: The three information propagation modes were formulated based on synthetic tasks. Validating their exact relevance to real-world LLM behaviors (like next-token prediction in natural language) remains an open step.
  • Target Restrictions: The framework is currently optimized for retrieval-type targets where the active index set does not grow with sequence length $T$. Extending InfoFlow to more general, complex functional targets will require new theoretical tools.

Summary updated

Abstract

While the approximation properties of single-layer Transformer architectures have been studied in recent works, a rigorous theoretical understanding of the multi-layer setting remains limited. In this work, we establish that multi-layer Transformers possess fundamentally different approximation capabilities from single-layer ones: for certain retrieval tasks, any single-layer Transformer requires least $Ω(\varepsilon^{-k})$ parameters to achieve precision $\varepsilon$, where $k$ grows linearly with sequence length $T$, whereas a two-layer Transformer with a single head per layer achieves the same approximation precision with at most $O (\varepsilon^{-1})$ parameters. To understand this separation, we identify two structural mechanisms underlying multi-layer approximation. Specifically, softmax attention can only efficiently retrieve the token attaining the maximum attention score, incurring exponential-in-length parameter cost for $k$-th largest retrieval with $k \geq 2$. Moreover, the parameter cost of decoding coupled information scales with the size of the retrieved token set. Motivated by these findings, we propose InfoFlow, a framework for multi-layer Transformers. The framework tracks an information set of accessible input positions at each token and layer, assigning an explicit approximation rate to each mode of information propagation. This abstraction recovers known approximation bounds, remains consistent with experimental observations on trained networks, and yields concrete predictions in settings where direct theoretical analysis is currently intractable. Our results provide a principled framework for reasoning about the approximation efficiency of multi-layer Transformers.
BibTeX
@inproceedings{yu2026infoflow,
  author = {Penghao Yu and Haotian Jiang and Zeyu Bao and Qianxiao Li},
  title = {{InfoFlow: A Framework for Multi-Layer Transformer Analysis}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=vtzQl6Q3H4},
}
Figure