Manuscript Offprint
arXiv:2610.23242Anisotropic Representation Dynamics in Transformers
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Small differences between internal representations can shrink or grow as they pass through a Transformer layer, affecting how information is preserved and how sensitive the model is to perturbations. Yet it remains unclear when changes in attention weights can turn a representation difference that would otherwise shrink into one that grows. We develop a Mixture-Gated Theory of Anisotropic Representation Dynamics that separates self-attention into value transport, query gating, and key gating. Our analysis reveals how the geometry of attended representations constrains gating and how interactions between these mechanisms can reverse contraction induced by value transport. We formalize this phenomenon as gating-induced regime switching, where a representation difference contracts under fixed attention routing but expands under full attention. We derive a necessary and sufficient spectral criterion that certifies the existence or absence of switching and identifies switching directions without exhaustive search. Beyond existence, our theory characterizes maximum relative switching strength, certifies the severity of contraction that gating can overcome, and determines the largest dimension of a subspace in which every nonzero direction switches. Experiments across four Transformer architectures validate these predictions through analytical and finite-forward comparisons, revealing distinct and joint query-key gating mechanisms and nontrivial switching subspaces. Our results provide a mechanistic and spectral understanding of how attention routing can alter local representation dynamics.
1 Introduction
Many practical problems involving Transformers depend on how small changes to internal representations evolve during computation. Some changes gradually disappear, while others grow and affect the model's behavior. For example, in model editing, correcting a wrong fact should change the intended answer without affecting unrelated behaviors [9]. An overly strong edit may unintentionally change other answers, so we want useful and independent changes to be amplified while unwanted changes are suppressed. A similar challenge appears in adversarial attacks, where an attacker may need to query a target model many times to find a small perturbation that flips its prediction [4]. Understanding which perturbation directions are likely to be amplified could help identify promising attacks without relying entirely on repeated trial-and-error queries. This problem also appears in many other Transformer applications, including representation steering, model robustness, and long-context modeling, where preserving useful changes and suppressing unwanted ones is important [16, 8].
Previous studies have provided important insights into how Transformer representations evolve. Research on representation collapse and signal propagation explains how repeated attention can make token representations increasingly similar or reduce their diversity [3, 11, 6]. Other work studies when token representations converge or diverge across layers [13, 15]. Jacobian and spectral analyses further reveal how sensitive Transformer representations are to perturbations and how this sensitivity depends on attention computations [7, 2, 1, 14, 12]. However, knowing that a representation difference
Preprint.
grows does not necessarily explain what causes it to grow. In particular, we still need to distinguish changes caused by the information being passed through attention from those caused by attention selecting different information. This leads to our central question: Can attention routing turn a representation difference that would otherwise shrink into one that grows?
To answer this question, we develop a Mixture-Gated Theory of Anisotropic Representation Dynamics. Our starting point is that the same Transformer computation can shrink some representation differences while amplifying others. We refer to this direction-dependent behavior as anisotropic representation dynamics. To understand why this happens, we examine how self-attention changes its output. Attention combines information from different tokens, and a small perturbation can affect this process in two ways. First, it can change the information carried by the tokens themselves, which we call value transport. Second, it can change how much attention each token receives, which we call gating. We further distinguish query gating, which changes attention through the query, from key gating, which changes attention through the keys. This decomposition allows us to compare how representation differences evolve when only the transported information changes, and when changes in attention allocation also contribute to their evolution. A representation difference may therefore evolve very differently depending on whether attention routing responds to it (See Figure 1).
Nearby states at layer
small local difference
Transport only
difference contracts
State-dependent routing
tiny shift re-routes attention
Full dynamics
difference is amplified

Figure 1: Conceptual illustration of gating-induced regime switching. Two nearby representations initially differ by a small perturbation . Under fixed attention weights, value transport contracts this difference. However, a small change in the query can redistribute attention among token representations, introducing an additional gating contribution. When this contribution is sufficiently strong, the full attention computation amplifies the same representation difference rather than suppressing it. The illustration motivates our analysis of how attention routing can reverse transport contraction.
Our analysis shows that changing attention weights does not always produce a change in the output. If attended tokens have nearly identical representations, shifting attention between them has little effect. We characterize this limitation geometrically, showing that differences among attended representations restrict which perturbation directions can affect the output through query gating. Even when attended tokens differ, some perturbations produce no local query-gating response. More importantly, gating can either reinforce or counteract value transport. Consider a representation difference that becomes smaller under value transport alone. By changing which tokens receive attention, gating can oppose this contraction. If the gating response is sufficiently strong, the full attention computation makes the same difference grow instead of shrink. We call this reversal a gating-induced regime switch. Our theory establishes a spectral condition for when switching is possible, identifies directions that exhibit this reversal, and characterizes the largest subspace in which every nonzero direction switches.
Our theory also shows that not all regime switches are equally significant. In some directions, value transport only weakly suppresses a representation difference, making it relatively easy for gating to amplify it. In other directions, gating can still amplify a difference even when value transport strongly suppresses it. To distinguish these cases, we introduce two complementary measures: relative switching strength, which compares the gating effect against the suppression caused by value transport, and absolute reversal severity, which measures how strongly transport can suppress a difference that gating can still amplify. Our theory characterizes both measures, establishes conditions under which switching cannot occur, and examines the reliability of switching directions when the underlying operators are estimated with error. We validate these predictions on pretrained Transformer models by applying small perturbations to hidden representations and comparing the observed changes with our theoretical predictions. The experiments show that high relative switching strength does not necessarily indicate that gating overcomes strong suppression. Moreover, unguided random search often fails to identify directions that are strongly suppressed by transport but amplified by full attention, whereas spectral analysis identifies such directions directly and can be more efficient when many directions must be examined. Our contributions are summarized as follows:
• We explain why the same Transformer attention computation can amplify some representation differences while suppressing others. To understand this behavior, we decompose self-attention into three mechanisms: value transport, query gating, and key gating. We then show that query gating is constrained by the geometry of the attended representations: it can only produce changes through directions in which those representations differ.
• We develop a spectral theory to explain when attention gating can reverse the contraction caused by value transport. Our results provide a precise condition for this reversal, identify the directions where gating is strongest relative to transport contraction, and determine how severe a contraction can still be reversed. We also characterize the largest subspace in which every nonzero direction exhibits such a reversal.
• We validate our theoretical predictions across different Transformer models. Through finite-forward experiments, we verify the predicted geometric and gating mechanisms and examine how switching behavior varies across architectures and layers. We further show that spectral analysis can identify directions where gating reverses particularly severe contraction, even when these directions are difficult to discover through unguided perturbation search.
Sensitivity, Jacobians, and attention derivatives. Previous studies have examined how sensitive Transformers are to changes in their inputs and hidden representations. Kim et al. [7] study Lipschitz properties of self-attention, while Aubry et al. [1] and Saratchandran and Lucey [14] analyze attention Jacobians and their spectral properties. Ormaniec et al. [12] further investigate the Hessian of the attention loss and its dependence on query, key, and value projections. Rather than simply measuring sensitivity, we investigate which attention mechanisms cause a representation difference to be suppressed or amplified. Specifically, we compare what happens when attention weights remain fixed with what happens when query gating, key gating, or both are allowed to change them. Although these mechanisms can be separated mathematically, their effects on representation growth interact and cannot generally be added independently. This comparison allows us to determine when changes in attention routing reverse the suppression caused by value transport.
Mixture interpretations and state-dependent routing. Prior work has explored mixture-based interpretations of attention, including softmax and sigmoid attention [17], hierarchical mixtures for gated attention [10], and Mixture-of-Head architectures [5]. We view standard self-attention through a Mixture-of-Experts (MoE) perspective, where each attended token provides a value representation and the attention weights act as input-dependent routing coefficients. This viewpoint allows us to distinguish two mechanisms: transporting information under fixed attention weights and changing how information is selected through query and key gating. By analyzing how these mechanisms affect the evolution of representation differences, we show that query gating is constrained by the variation among attended representations. More importantly, we characterize how changes in attention routing interact with value transport, explaining when a representation difference suppressed by transport can become amplified under full attention.
Positioning: spectral certification of regime switching. Our objective is to determine when state-dependent routing turns a direction suppressed by transport into one amplified by full attention. On a transport-contractive subspace, comparing transport contraction with the gating-induced growth correction yields a generalized spectral criterion for whether switching occurs and which direction has the strongest relative reversal. We also characterize absolute reversal severity, which distinguishes overcoming strong suppression from reversing only weak suppression, the maximal dimension of an all-switching subspace, and stability under operator-estimation error. The eigenvalue and perturbation tools are classical; our contribution is their attention-specific, mechanistically interpretable formulation, which can identify severe reversals without unguided direction-by-direction probing.
3 Problem Setting
Consider a Transformer block at layer and a representation at the operating point of interest. We suppress the surrounding sequence context and focus on the local representation map , so that . We study how a small difference between two nearby representations, and , evolves through the block. Define
For sufficiently small ,
where is the local Jacobian of the block. To determine whether a representation difference grows or shrinks, we must first specify how its magnitude is measured. We therefore introduce a symmetric positive-definite matrix and define the representation metric . The matrix defines the geometry in which representation differences are measured: recovers the usual Euclidean norm, while a general allows different representation directions to be weighted differently. Under the local transformation , the squared -magnitude after the block is
Thus is the metric induced on the incoming perturbation by the local Transformer dynamics. Comparing the outgoing and incoming magnitudes gives
Accordingly, indicates local amplification, whereas indicates local suppression. Importantly, the sign of may depend on the direction . A single Transformer block can therefore suppress some representation differences while amplifying others. We refer to this direction-dependent behavior as anisotropic representation dynamics. Equation (4) characterizes which representation differences grow or shrink, but does not yet explain why. Our goal is to connect this directional growth to the internal computation of self-attention. We separate the local dynamics into transport, which propagates changes in the information carried by attended representations, and state-dependent gating, which arises when the perturbation changes the attention allocation itself. This leads to the central question of the paper:
When and why can attention routing turn a representation difference that would shrink dramatically under value transport into one that grows?
We call such a transition a gating-induced regime switch, and seek to characterize both when such switching directions exist and which directions exhibit the strongest reversal.
4 Mechanism of State-Dependent Attention
The growth operator in Section 3 tells us whether a representation difference grows or shrinks, but not which part of self-attention causes this behavior. To understand why, we decompose the attention Jacobian into three pathways: value transport, which propagates changes in the information carried by attended tokens; query gating, which changes attention allocation through the query; and key gating, which changes attention allocation through the keys. This decomposition allows us to understand how each pathway contributes to representation growth.
4.1 Transport and Gating in Self-Attention
Consider one self-attention head in a Transformer layer. Let denote the representation of token , the query-token index, and the index of the token whose representation is perturbed. For query token , the attention score assigned to token is , where combines the query and key projections, and is the query/key dimension. The corresponding attention weight is . Let denote the combined value and output transformation. The attention output for query token is
Equation (5) shows that a perturbation can change the attention output in two ways. First, it can change the information carried by the attended tokens through the value term . Second, it can change the attention weights , causing the model to place more or less weight on different tokens. We call these two effects value transport and gating, respectively. While transport changes the information being passed forward, gating changes how that information is selected.
To understand how each pathway affects the output, lets consider a small change in the representation of token . The Jacobian captures how this change affects the attention output of query token . For gating, the effect also depends on how different the attended representations are from one another. To capture these differences, we use the attention-weighted mean and covariance . The mean describes the average information selected by attention, while the covariance measures how much the attended representations differ around this average. Differentiating Eq. (5) then gives
Here, equals one when the perturbed token is also the query token and zero otherwise. The full derivation is provided in Appendix 9.4. Equation (6) separates the attention Jacobian into three pathways. The value-transport pathway directly propagates the perturbation through the value transformation. The query-gating pathway captures how changing the query alters its attention to the available tokens, and contributes only when . The key-gating pathway captures how changing token affects the attention it receives as a key. When , both gating pathways can contribute to the same output change. This decomposition allows us to distinguish changes caused by the information being transported from those caused by changes in attention allocation. In the next subsection, we show how the differences among attended tokens limit which perturbation directions can affect the output through query gating.
4.2 Geometry of Query Gating
We now investigate how query gating changes a representation difference and which perturbation directions can influence the attention output through this mechanism. From Eq. (6), we isolate the query-gating component
which contributes to the full Jacobian only when the perturbed token is the query itself, i.e., . This decomposition reveal that query gating has three components. The matrix determines how a query perturbation changes attention scores, captures variation among the attended representations, and maps the resulting change into the output space. We are particularly interested in the role of , since it connects changes in attention routing to the representations being attended to. To characterize this connection, we define the attended variation subspace as , where is the attention-weighted mean of the attended representations. This subspace describes the directions along which those representations differ from their mean. The following proposition characterizes how this geometry constrains query gating.
Proposition 1 (Geometric Support of Query Gating). Let be the attended variation subspace and the query-gating Jacobian. Then

Figure 2: Geometric support and null directions of query gating. Centered attended representations span a subspace , whose dimension may be substantially smaller than the ambient representation dimension. The transformed subspace determines which query perturbation directions can influence the attention output through query gating. Perturbations orthogonal to this subspace produce no first-order query-gating change. Consequently, query gating is insensitive to at least independent input directions. The three-dimensional projections provide a schematic visualization of the higher-dimensional geometry.
Insight. Proposition 1 shows that query gating is constrained by the geometry of attended representations in two ways. First, the range restriction limits the possible output changes, while the rank bound limits their number of independent directions. For example, if several attended representations differ along only one direction, query gating can produce changes along at most one independent output direction, even in a high-dimensional representation space. If all attended representations are identical, then , implying : there is no difference for attention to redistribute. Second, the condition shows that not every query perturbation can produce an output change through gating. Therefore, changing attention weights does not always change the attention output. Query gating can only exploit differences among attended representations, and its effect depends on which perturbation directions interact with those differences.
Figure 2 illustrates how the geometry of attended representations restricts the perturbation directions that can influence the attention output through query gating. The complete proof, pairwise covariance interpretation, and additional geometric bounds are provided in Appendix 9.5. While the proposition identifies which directions query gating can affect, it does not determine whether these changes suppress or amplify a representation difference. We next examine how gating interacts with value transport and when this interaction leads to regime switching.
5 Theory of Gating-Induced Regime Switching
The previous section established how attention routing changes representations and how the geometry of attended tokens constrains query gating. However, changing attention allocation does not necessarily make a representation difference grow. The effect depends on how gating combines with value transport. We now study when this interaction can reverse transport contraction, turning a representation difference that would otherwise shrink into one that grows.
5.1 From Transport Contraction to Regime Switching
We now investigate whether attention routing can turn a representation difference suppressed by value transport into one amplified by full attention. Consider a small perturbation to the token representations. We first study how this perturbation changes the attention output when the attention weights are held fixed, considering only value transport. We then include the additional changes caused by query and key gating. Both cases use the same initial representations and perturbation, allowing us to distinguish the effect of value transport from the additional contribution of attention routing. This comparison helps us understand when gating reinforces transport contraction and when it reverses that contraction, causing a representation difference to grow instead of shrink.
Recall the attention Jacobian decomposition in Eq. (6). Let , , and denote the value-transport, query-gating, and key-gating Jacobians, respectively, with token indices omitted for simplicity. We define the combined gating Jacobian as , so that the full attention Jacobian is

Figure 3: From self-attention decomposition to gating-induced regime switching. Self-attention induces three local mechanisms: value transport, query gating, and key gating, represented by their corresponding Jacobian components. These components jointly determine directional representation growth through the induced growth operator . The three-dimensional illustration shows how different perturbation directions can exhibit contraction or expansion. Interactions between value transport and attention gating can reverse transport contraction, causing a representation difference to grow under full attention.
. When analyzing a residual attention sublayer, the shared residual contribution is included consistently in the transport-only and full Jacobians. Using the representation metric introduced in Section 3, we define the corresponding growth operators as
For a perturbation direction , the quadratic forms and measure the changes in its squared magnitude under transport-only and full attention, respectively. We are interested in directions for which these two quantities have opposite signs.
Definition 1 (Gating-Induced Regime Switch). A nonzero perturbation direction v undergoes a gating-induced regime switch if
Definition 1 describes a change from suppression to amplification along the same direction. Under fixed attention weights, value transport suppresses the representation difference. When query and key gating are included, full attention amplifies it. To determine when this reversal occurs, we compare the two growth operators and isolate the additional contribution caused by gating.
Proposition 2 (Exact Gating-Induced Growth Correction). Let denote the gating-induced growth correction. Then . For any nonzero perturbation direction , the corresponding change in directional growth is
Consequently, if , a gating-induced regime switch occurs if and only if . (Proof in Appendix 10.1)
Insight. Proposition 2 shows that the effect of attention gating depends on how it combines with value transport. In Eq. (11), the interaction term can increase or decrease representation growth, depending on the alignment between transport and gating. Furthermore, since , the term contains an additional interaction between query and key gating, given by . Therefore, the combined effect of query and key gating on representation growth is not simply the sum of their individual effects. In particular, query or key gating may each fail to reverse transport contraction, yet succeed when acting together. Such a reversal occurs when the combined gating effect is strong enough to overcome the contraction caused by value transport .
Proposition 2 establishes when a given perturbation direction undergoes a regime switch. However, identifying such directions individually can be difficult in a high-dimensional representation space. We next develop a spectral criterion that determines whether switching is possible and identifies switching directions without testing perturbations one by one.
5.2 Spectral Certification of Gating-Induced Regime Switching
Proposition 2 provides an exact condition for determining whether a given perturbation direction undergoes a regime switch. However, it does not tell us whether such a direction exists without first selecting and testing individual perturbations. Since representation spaces can be high-dimensional, searching over possible directions is difficult. We therefore seek a spectral condition that determines whether gating can reverse transport contraction along at least one direction and, if so, identifies such a direction directly. We focus on a transport-contractive subspace , in which value transport suppresses every nonzero perturbation direction. Let have orthonormal columns spanning , so that every can be expressed as , where . By definition, transport contraction throughout this subspace requires . Such a subspace can be constructed from the eigenvectors of associated with its negative eigenvalues.
To determine whether gating can reverse this contraction, we compare the transport-induced suppression with the additional growth introduced by gating. We define the corresponding operators restricted to S as
Here, measures how strongly transport suppresses perturbations, while measures how much the inclusion of query and key gating changes their growth. For any direction , we have
Since , every nonzero direction in is contracted by transport. A regime switch therefore exists precisely when the growth correction introduced by gating exceeds this contraction along at least one direction, i.e., for some . The following theorem establishes a necessary and sufficient spectral condition for this reversal.
Theorem 1 (Spectral Criterion for Gating-Induced Regime Switching). For the transport switching operator , there exists a nonzero direction undergoing a gating-induced regime switch if and only if . Moreover, when this condition holds, a switching direction is , where is a unit eigenvector of associated with .
The theorem follows by expressing the switching condition as , which is well-defined because . The maximum of this ratio over all nonzero directions equals , yielding the necessary and sufficient condition. The complete proof is provided in Appendix 10.2.
Insight. Theorem 1 addresses a fundamental limitation of testing perturbation directions individually: even if many directions are tested and no regime switch is found, this does not prove that switching is impossible. In contrast, the spectral criterion provides a necessary and sufficient condition for the existence of switching within the transport-contractive subspace S. The operator compares the growth introduced by gating with the contraction caused by transport across this subspace. If , no switching direction exists in S. If , switching is guaranteed to occur, and the leading eigenvector allows us to construct a switching direction directly. Thus, spectral analysis can certify both the existence and absence of switching without relying on direction-by-direction search. However, the identified direction does not necessarily correspond to the strongest transport contraction that gating can reverse, motivating our subsequent analysis of reversal severity.
We next distinguish the relative strength of gating-induced switching from the absolute severity of transport contraction that gating can overcome.
5.3 Relative Switching Strength and Certified Reversal Severity
Theorem 1 establishes when gating can reverse transport contraction and identifies a switching direction when one exists. However, this direction does not necessarily correspond to the strongest contraction that gating can overcome. For instance, a direction may show a large gating effect relative to transport simply because transport barely suppresses it. In contrast, another direction may remain expanding under full attention even after transport removes most of its original magnitude. To distinguish these cases, we introduce two different measures: relative switching strength, which compares the gating-induced growth correction against transport contraction, and absolute reversal severity, which measures how strongly transport suppresses a difference that gating can still amplify.
Relative switching strength. For a nonzero direction , the gating-induced growth correction is , while the magnitude of transport contraction is . Their ratio defines the relative switching strength:
This ratio tells us how much gating changes representation growth compared with the contraction it must overcome. In particular, means that the gating-induced correction exceeds transport contraction, resulting in a regime switch. The spectral analysis in Theorem 1 also allows us to identify the direction that maximizes this ratio.
Corollary 1 (Maximum Relative Switching Strength). Let , and let be a unit eigenvector associated with . Then
The direction , up to nonzero scaling, maximizes relative switching strength and undergoes a regime switch whenever .
Corollary 1 follows from the generalized Rayleigh quotient in Eq. (14), with the complete proof provided in Appendix 10.3. Although the corollary identifies the direction with the largest relative switching strength, a large value of does not necessarily indicate that gating has reversed strong contraction. When transport barely reduces a representation difference, even a modest gating-induced correction can produce a large ratio. Therefore, maximizing relative switching strength does not directly answer how much contraction gating can overcome.
Absolute reversal severity. To measure the contraction itself, we introduce the absolute reversal severity, defined for any nonzero transport-contractive direction as
Unlike , which compares gating against transport, measures the fraction of incoming squared representation magnitude removed by transport. Since every nonzero direction in is transport-contractive, . For example, means that transport removes 80% of the incoming squared magnitude. If full attention nevertheless amplifies this direction, gating has reversed a substantial contraction.
Our goal is to determine the strongest transport contraction that gating can still reverse. Let denote the supremum of over all switching directions in , with if no switching direction exists. Finding this quantity requires a direction that is both strongly suppressed by transport and amplified by full attention. Rather than searching over individual directions, we develop a spectral certificate that determines whether switching is possible among directions whose contraction exceeds a prescribed severity threshold. To construct this certificate, we first need to identify directions that transport suppresses sufficiently strongly. Recall that every can be expressed as . Let , which measures the original squared representation magnitude in the coordinates of . Since measures the magnitude removed by transport, the severity can be written as . Thus, measures how much magnitude is removed, while measures how much was present initially.
We identify directions with different contraction severities by solving the generalized eigenvalue problem , with , and order the eigenvalues as . Each eigenvector specifies a direction in the original representation space, while its eigenvalue gives the fraction of squared magnitude removed by transport along that direction. Larger eigenvalues therefore identify directions that transport suppresses more strongly. Given a desired severity threshold , we retain the eigenvectors whose contraction severity is at least and construct
This construction guarantees that every nonzero direction in , including linear combinations of the selected eigenvectors, satisfies . For example, choosing gives a subspace in which transport removes at least 80% of the incoming squared magnitude along every direction. We can focus on strongly suppressed differences while excluding directions whose contraction is weaker than the chosen threshold. Having identified directions with strong transport contraction, the remaining question is whether gating can reverse this contraction. We answer this by applying the spectral criterion from Theorem 1 to . Let have orthonormal columns spanning this subspace, assuming . We define the restricted transport-contraction and gating-growth operators as
Here, measures how strongly transport suppresses directions in the selected subspace, while measures the additional growth introduced by gating. Following Section 5.2, we construct the restricted switching operator , which compares the gating-induced growth correction against transport contraction within this strongly contracting subspace. The following theorem establishes whether gating can reverse contraction of at least the prescribed severity.
Theorem 2 (Certified Absolute Reversal Severity). Fix and suppose . Every nonzero direction satisfies . Moreover, there exists a gating-induced regime-switch direction in if and only if . Consequently, whenever this condition holds, gating can reverse transport contraction of severity at least , implying .
The theorem follows by combining two results: the construction of guarantees the required contraction severity for every nonzero direction in this subspace, while the spectral criterion determines whether at least one of these directions becomes expanding under full attention. The complete proof is provided in Appendix 10.3. By increasing the threshold , we can determine whether gating can still reverse progressively stronger transport contraction. This motivates the strongest severity threshold certified by our method:
We set when no threshold is certified. Importantly, is a lower bound on the strongest reversal severity, rather than necessarily its exact value. Our construction considers subspaces where every direction satisfies the required severity threshold. However, individual switching directions with equally strong contraction may exist outside these subspaces. Therefore, failure to obtain a certificate at a particular threshold does not rule out the existence of switching directions with that severity elsewhere in S.
Insight. The strongest regime switch in relative terms need not be the most substantial reversal of transport contraction. In particular, a direction that transport barely suppresses may achieve a much larger relative switching strength than one where gating overcomes substantial contraction. This distinction reveals why the leading eigenvalue of the switching operator alone cannot characterize the severity of a reversal. A more demanding test is whether switching remains possible after directions with weak transport contraction have been excluded. Our severity certificate provides precisely this guarantee: when the spectral condition holds within the restricted subspace, gating can reverse contraction of at least the prescribed severity, even though not every strongly contracted direction must undergo a switch.
5.4 No-Switch Certification and Effective Switching Dimension
The preceding results establish when gating can reverse transport contraction and how severe that contraction can be. However, identifying a switching direction does not reveal how broadly this reversal extends across representation space. In particular, switching along several individual directions does not guarantee that their linear combinations also undergo a regime switch. We therefore ask two questions: when can switching be ruled out entirely, and when switching is possible, what is the largest subspace in which every nonzero direction undergoes the contraction-to-expansion reversal? To address these, we return to the transport switching operator introduced in Section 5.2. Every nonzero is contracted by value transport, while its growth under full attention is . Using the transformed coordinates , this growth becomes . Thus, the spectrum of determines not only whether full attention can reverse contraction, but also the number of independent directions that can form a subspace where switching holds uniformly. The following theorem provides an exact characterization.
Theorem 3 (No-Switch Criterion and Effective Switching Dimension). No gating-induced regime switch exists in S if and only if
Moreover, the effective switching dimension is the largest dimension of a linear subspace of in which every nonzero direction undergoes a gating-induced regime switch. In particular, the subspace
achieves this dimension, where are orthonormal eigenvectors of . Every nonzero undergoes a gating-induced regime switch.
The theorem follows from the quadratic form . If all eigenvalues of are at most one, this quantity is nonpositive in every direction, ruling out switching throughout . Otherwise, the eigenvectors associated with eigenvalues greater than one span a subspace on which full directional growth is strictly positive. Since the number of positive eigenvalues of equals the maximum dimension of a subspace on which its quadratic form is positive for every nonzero vector, no larger linear subspace can satisfy the switching condition uniformly. The proof is in Appendix 10.4.
The effective switching dimension therefore provides a complementary characterization to the existence and severity results developed earlier. When , no switching direction exists within S. When , at least one one-dimensional subspace exhibits switching along every nonzero direction, but no two-dimensional linear subspace has this guarantee. More generally, a larger certifies that the contraction-to-expansion reversal persists throughout a higher-dimensional subspace, rather than only along an individually identified direction.
Insight. Theorem 3 reveals an important distinction between finding switching directions and identifying a subspace where switching is guaranteed. Even if many individual directions undergo a regime switch, their linear combinations may not. The effective switching dimension captures this distinction by identifying the largest number of independent degrees of freedom that can be combined while preserving the reversal for every nonzero combination. For example, does not mean that only one direction can switch; many switching directions may exist, but no two-dimensional subspace is guaranteed to consist entirely of switching directions. Thus, beyond certifying whether switching exists, the spectrum of W characterizes the dimensional extent over which this reversal holds uniformly.
6 Experiments
Experiments follow the progression from geometric constraints on attention gating to the emergence and spectral characterization of regime switching. We examine how attended-representation geometry restricts query-gating responses, and whether query and key gating can reverse contraction induced by value transport. We move beyond individual switching directions to investigate how spectral analysis certifies their existence, dimensionality, and reversal severity. Finally, we examine whether these mechanisms and their structure persist across Transformer architectures and depths. We evaluate these predictions through analytical computations, finite-forward perturbations, and pathway ablations, with experimental details and analyses provided in Appendix 11.
Experimental Setup. We evaluate pretrained GPT-2 Medium, Gemma-2-2B, Llama-3.2-1B, and Qwen2.5-0.5B on the WikiText-2 validation set. Detailed mechanistic and spectral analyses focus on a selected operating point in layer 23 of GPT-2 Medium; cross-architecture analyses examine multiple layers of all four models. We construct the value-transport, query-gating, and key-gating Jacobians , , and and compare transport-only, transport plus query gating, transport plus key gating, and full-attention dynamics. For residual attention sublayers, the common residual contribution is included consistently in these comparisons. Unless otherwise specified, we use the Euclidean metric . Analytical Jacobians are checked against automatic differentiation and finite differences. Experiments were run on an NVIDIA A100 GPU with 40 GB of memory.
(a) Support geometry slice

(b) Analytic support test
(c) Finite-forward routing response

Figure 4: Geometric support of query gating. (a) Schematic three-dimensional slice illustrating directions orthogonal to the query-gating support. (b) Analytical response versus support overlap, including near-null directions and the theoretical upper bound. (c) Finite-forward changes in attention weights under fixed-key query perturbations.
(a) Analytical mechanism map
(b) Finite-forward mechanism map

(c) Switching regions
(d) Growth of representative directions
Figure 5: Theory-predicted regime geometry and gating-pathway ablations. (a,b) Analytical and finite-forward regime maps on the same selected directional slice, with exact switching and mechanism-label agreement across the tested directions. (c) Growth-sign boundaries separating the observed regimes. (d) Directional growth under transport-only, single-gating-pathway, and full-attention counterfactuals for representative directions.
6.1 Geometric Support of Query Gating
From attended geometry to query-gating support. Before asking whether attention gating can reverse transport contraction, we first identify the directions along which query gating can act. Proposition 1 predicts that the variation among attended representations restricts the query-gating response: if , then . Figure 4(a) illustrates this geometric constraint on a three-dimensional slice: perturbations orthogonal to cannot produce a first-order query-gating output response. To test the prediction, we compare the support overlap with the analytical response , and separately measure finite-forward changes in attention weights after perturbing the query with keys held fixed.
From geometric selectivity to finite-forward behavior. Figure 4(b) confirms that query gating is highly selective: directions outside the attended-variation support produce negligible analytical responses, whereas directions aligned with that support can produce substantial changes. The observed Jacobian rank attains the predicted geometric bound, reinforcing that the response is constrained by variation among the attended representations rather than by query perturbations alone. This directional selectivity also appears in the finite-forward test in Figure 4(c), where near-null perturbations produce negligible routing changes while support-active perturbations can
(a) Certified projected switching dimension

(b) Routing mechanisms (pooled counts)
Figure 6: Switching across architectures and depths. (a) Median normalized effective switching dimension across seven normalized depths and four Transformer architectures. Normalization uses the projected transport-contractive subspace. (b) Mechanism composition among sampled switching directions. Measurements use two WikiText-2 validation prompts per model and 64-dimensional random orthonormal probe subspaces.
alter attention allocation. Importantly, the proposition constrains the attention output, not attention weights in general; the finite-forward routing result is specific to the tested directions. Thus, attended geometry rules out certain gating responses without fully determining the magnitude of the remaining ones. Even when gating is active, its effect on representation growth remains unknown. We therefore next examine when query and key gating can overcome value-transport contraction and induce a regime switch. Additional geometric analyses appear in Appendix 11.2.
6.2 From Gating Support to Regime Switching
From geometric support to theory-predicted regimes. Attended-representation geometry constrains the directions along which query gating can act, but does not by itself determine whether gating reverses transport contraction. Proposition 2 establishes the mechanism underlying this reversal: a direction undergoes regime switching when the gating-induced growth correction exceeds the contraction imposed by fixed-weight value transport. To examine the resulting directional structure, we construct analytical regime maps on selected spherical slices of four Transformer architectures, as illustrated in Figure 7(a). The spheres distinguish transport non-contraction, contraction without switching, and query-driven, key-driven, either-pathway, and joint query-key switching. Although the relative sizes and spatial arrangements of these regions vary substantially across architectures, the same growth-sign criteria consistently explain their classification. At the selected operating point used for finite-forward validation, the analytical predictions in Figure 5(a) agree with Figure 5(b) on all tested directions, achieving 100% agreement in both switching status and mechanism attribution.
Pathway interactions explain regime boundaries and spatial adjacency. The pathway ablations in Figure 5(d) distinguish directions that remain contracting from those rescued by query gating, key gating, or both. The adjacency graphs in Figure 7(b) reveal direct boundaries between the no-switch (NS) regime and both the query-driven (Q) and either-pathway-sufficient (E) regimes across all four architectures. An NS–E boundary occurs where full directional growth vanishes while transport contracts and either gating pathway alone produces expansion. This requires a sufficiently negative query–key interaction to offset positive single-pathway growth, showing that the combined gating effect is not simply additive. These boundaries connect pathway interactions to spatial adjacency, while differences in regime proportions reveal architecture-dependent geometry. The results concern selected three-dimensional slices, not universal topology or full-space prevalence.
6.3 Spectral Certification and Reversal Severity
From observed switching to spectral certification. Having established that attention gating can reverse transport contraction along selected directions, a fundamental question remains: does switching occur only along isolated directions, or does it exhibit a richer geometric structure? To address this question, we examine the spectral predictions of Theorems 1, 3, and 2. Figure 8(a) shows that the switching spectrum contains multiple eigenvalues above the critical threshold, certifying a

Figure 7: Cross-architecture regime geometry and spatial adjacency. (a) Analytic regime spheres: Two orthographic views (View A and B) of selected spherical slices across four Transformer architectures, colored by their predicted growth regimes. (b) Spatial adjacency graphs: Node sizes indicate regime proportions, and edges represent shared regime boundaries. NC: transport non-contractive; NS: contraction without switching; Q/K: query-/key-driven switching; E: either pathway sufficient; J: joint query-key required. Percentages are computed over all sampled sphere directions, rather than only switching directions as in Figure 6(b). Results characterize the selected slices, not the full representation space.
47-dimensional subspace in which every nonzero direction contracts under transport but expands under full attention. Thus, switching is not restricted to isolated directions; it occupies a nontrivial linear subspace of the local representation geometry.
Relative switching strength versus reversal severity. While the spectrum certifies switching, its largest eigenvalue may not identify the direction undergoing the strongest absolute contraction reversal. Figure 8(b) reveals that the direction maximizing relative switching strength experiences weak transport contraction, whereas another direction undergoes severe contraction before being rescued by gating. The severity certificate closely matches this extreme while providing a rigorous lower bound rather than an exact optimum. These directions also involve different mechanisms: the relative-optimal switch is query-driven, whereas the severe switch requires both query and key gating (Appendix 11.4). Together, these findings distinguish the existence of switching from its absolute severity and connect spectral structure to the gating mechanisms. We next investigate whether switching geome-
(a) Spectral certification of switching

(b) Relative optimum vs. severe reversal

Figure 8: Spectral certification. (a) Switching spectrum; (b) relative/absolute reversal severity.


Figure 9: Search quality and amortized cost of spectral guidance. (a) Blind random search finds no switch within the tested budget, while oracle-assisted sampling in the transport-contractive subspace finds ordinary switches but misses severe reversals. (b) Spectral preprocessing incurs a one-time setup cost but becomes advantageous for sufficiently many directional evaluations. Total-cost curves are projected from measured setup and throughput timings.
try persists across Transformer architectures and depths.
Search quality and amortized computational cost. Spectral guidance provides a principled alternative to unguided directional search by exploiting the geometry of transport contraction and gating-induced growth. Figure 9(a) shows that random probing struggles to recover severe switching directions, even when restricted to the transport-contractive subspace S. While such restriction facilitates the discovery of ordinary switches, it does not identify directions where gating overcomes particularly strong contraction. In contrast, spectral analysis directly characterizes switching directions and enables the certification of severe reversals. Figure 9(b) further illustrates the computational benefit of this characterization: after a one-time spectral preprocessing cost, directional properties can be evaluated through inexpensive quadratic forms, making the approach increasingly efficient as the number of queries grows. Together, these results demonstrate that spectral theory provides not only existence guarantees but also a structured and computationally useful characterization of regime switching. We next examine whether switching geometry persists across Transformer architectures and depths.
6.4 Cross-Architecture Switching Geometry
From local certification to cross-architecture geometry. Having established that spectral analysis can certify the existence, dimensionality, and severity of switching at a selected operating point, we next investigate whether this geometry persists across Transformer architectures and depths. We examine GPT-2 Medium, Gemma-2-2B, Llama-3.2-1B, and Qwen2.5-0.5B using projected perturbation subspaces. Figure 6(a) reveals nontrivial switching subspaces across all evaluated architectures and depths, although their relative dimensions vary substantially without a universal depth trend. Moreover, Figure 6(b) shows that the mechanism-level distinctions also persist: query-driven switching dominates among sampled switching directions, while joint query-key mechanisms appear across all four architectures. These observations suggest that switching is not specific to a single model configuration, although its spectral geometry and pathway composition remain architecture-dependent.
Spatial organization of switching regimes. While spectral dimensions and mechanism frequencies quantify where switching occurs, they do not reveal how different regimes are organized across perturbation directions. Figure 7 addresses this question by visualizing the regime partitions and their spatial adjacency on selected spherical slices. The same mechanism classes emerge across architectures, yet their spatial distributions differ markedly: query-driven regions occupy relatively small portions of the selected GPT-2 and Qwen spheres, but substantially larger regions in Llama and Gemma. The adjacency graphs further reveal how distinct regimes meet within each slice, illustrating that switching is organized into structured directional regions rather than appearing only as isolated examples. Together, these findings suggest a recurring mechanism of gating-induced switching.
with architecture-dependent geometric organization. However, the visualizations do not establish a universal topological structure, and the limited prompts and projected subspaces preclude conclusions about full-space prevalence. Additional sensitivity analyses are provided in Appendix 11.6.
7 Conclusion
We developed a mixture-gated theory of anisotropic representation dynamics in Transformers, revealing how interactions between value transport and attention gating can reverse representation contraction. Our analysis establishes geometric constraints on query gating and provides spectral criteria to characterize the existence, severity, and dimensionality of regime switching. Experiments across multiple pretrained Transformers support these theoretical predictions and demonstrate the distinct and joint contributions of query and key gating. Future work will extend this local analysis to representation dynamics across multiple layers and investigate its implications for downstream model behavior.
References
[1] Murdock Aubry, Haoming Meng, Anton Sugolov, and Vardan Papyan. Transformer block coupling and its correlation with generalization in llms. In The Thirteenth International Conference on Learning Representations, 2025.
[2] Han Bao, Ryuichiro Hataya, and Ryo Karakida. Self-attention networks localize when QK-eigenspectrum concentrates. In Ruslan Salakhutdinov, Zico Kolter, Katherine Heller, Adrian Weller, Nuria Oliver, Jonathan Scarlett, and Felix Berkenkamp, editors, Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 2903–2922. PMLR, 21–27 Jul 2024.
[3] Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: Pure attention loses rank doubly exponentially with depth. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 2793–2803. PMLR, 2021.
[4] Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 2137–2146. PMLR, 2018.
[5] Peng Jin, Bo Zhu, Li Yuan, and Shuicheng Yan. MoH: Multi-head attention as mixture-of-head attention. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pages 28233–28255. PMLR, 2025.
[6] Akhil Kedia, Mohd Abbas Zaidi, Sushil Khyalia, Jungho Jung, Harshith Goka, and Haejun Lee. Transformers get stable: An end-to-end signal propagation theory for language models. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 23449–23531. PMLR, 2024.
[7] Hyunjik Kim, George Papamakarios, and Andriy Mnih. The lipschitz constant of self-attention. In International Conference on Machine Learning, pages 5562–5571. PMLR, 2021.
[8] Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157–173, 2024.
[9] Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. In Advances in Neural Information Processing Systems, volume 35, 2022.
[10] Viet Nguyen, Tuan Minh Pham, Thinh Cao, Tan Dinh, Huy Nguyen, Nhat Ho, and Alessandro Rinaldo. A statistical theory of gated attention through the lens of hierarchical mixture of experts. arXiv preprint arXiv:2602.01468, 2026.
[11] Lorenzo Noci, Sotiris Anagnostidis, Luca Biggio, Antonio Orvieto, Sidak Pal Singh, and Aurelien Lucchi. Signal propagation in transformers: Theoretical perspectives and the role of rank collapse. In Advances in Neural Information Processing Systems, volume 35, 2022.
[12] Weronika Ormaniec, Felix Dangel, and Sidak Pal Singh. What does it mean to be a transformer? insights from a theoretical hessian analysis. In International Conference on Learning Representations, volume 2025, pages 17046–17081, 2025.
[13] Duy-Tung Pham, An The Nguyen, Viet-Hoang Tran, Nhan-Phu Chung, Xin Tong, Tan M. Nguyen, and Thieu N. Vo. Dynamical properties of tokens in self-attention and effects of positional encoding. In Advances in Neural Information Processing Systems, volume 38, 2025.
[14] Hemanth Saratchandran and Simon Lucey. Spectral conditioning of attention improves transformer performance. In Advances in Neural Information Processing Systems, volume 38, 2025.
[15] Akiyoshi Tomihari and Ryo Karakida. Recurrent self-attention dynamics: An energy-agnostic perspective from jacobians. In Advances in Neural Information Processing Systems, volume 38, pages 155236–155269, 2025.
[16] Alexander Matt Turner, Lisa Thiergart, Gavin Leech, David Udell, Ulisse Mini, and Monte MacDiarmid. Activation addition: Steering language models without optimization, 2024.
[17] Fanqi Yan, Huy Nguyen, Pedram Akbarian, Nhat Ho, and Alessandro Rinaldo. Sigmoid self-attention has lower sample complexity than softmax self-attention: A mixture-of-experts perspective, 2025. Preprint.
Supplementary for A Mixture-Gated Theory of Anisotropic Representation Dynamics in Transformers
This supplementary material serves as the appendix to the main paper and provides additional mathematical details, complete proofs of the theoretical results, extensions of the proposed analysis, and full experimental settings and additional results. It is organized as follows:
- TABLE OF NOTATION ..... 19
- MATHEMATICAL DETAILS OF REPRESENTATION DYNAMICS ..... 20
9.1. Notation and Technical Setup ..... 20
9.2. Local Representation Dynamics and Growth Operator ..... 20
9.3. Self-Attention and the Transport–Gating Decomposition ..... 22
9.4. Exact Query, Key, and Value Jacobian Decomposition ..... 24
9.5. Geometry and Support of Query Gating ..... 28
9.6. Directional Routing Alignment ..... 35
9.7. Extensions to Modern Transformer Blocks ..... 40 - THEORY OF GATING-INDUCED REGIME SWITCHING ..... 43
10.1. Transport-Only and Full Representation Dynamics ..... 44
10.2. Spectral Criterion for Regime Switching ..... 45
10.3. Strength of Regime Switching ..... 48
10.4. No-Switch Conditions and Effective Switching Dimension ..... 52
10.5. Robustness to Operator Estimation Error ..... 54 - EXPERIMENTAL DETAILS AND ADDITIONAL RESULTS ..... 56
11.1. Models, Datasets, and Operator Estimation ..... 56
11.2. Anisotropic Dynamics and Routing Mechanisms ..... 57
11.3. Empirical Regime Switching and Spectral Validation ..... 57
11.4. Strongest Switching Directions ..... 59
11.5. Cost of Theory-Free Search ..... 60
8 TABLE OF NOTATION
Table 1 summarizes the notation central to the representation-dynamics, attention-gating, and spectral regime-switching theory.
Table 1: Summary of the main theoretical notation.
| Notation | Meaning |
|---|---|
| Local representation dynamics | |
| , , , | Layer index, incoming representation, local perturbation, and Transformer block map. |
| , , | Block Jacobian, nonzero perturbation direction, and symmetric positive-definite representation metric. |
| Local growth operator , governing directional expansion and contraction. | |
| Self-attention and query-gating geometry | |
| , , , | Token representation; query-token, attended-token, and perturbed-token indices. |
| Combined query-key score operator and value-output transformation. | |
| Attention score, softmax weight, and attention output at query token . | |
| Attention-weighted mean and covariance of attended token representations. | |
| Attended-variation subspace Range() and query-gating Jacobian . | |
| Transport-gating decomposition and growth | |
| Transport, query-gating, key-gating, and combined gating Jacobians (). | |
| Full-attention Jacobian . | |
| Transport-only and full-attention growth operators and . | |
| Gating-induced growth correction , including transport-gating interactions. | |
| Signed directional gating contribution and its diversity-sensitivity-alignment factors, . | |
| Scalar directional growths and , with the metric understood. | |
| Spectral regime-switching theory | |
| Transport-contractive subspace, an orthonormal basis matrix, and coordinates . | |
| Projected contraction and projected gating correction . | |
| Symmetric, transport-whitened switching operator. | |
| Largest switching eigenvalue and an associated unit eigenvector. | |
| Relative switching strength and its maximizing direction. | |
| Effective switching dimension and a largest-dimensional subspace in which every nonzero direction switches. | |
| Absolute reversal severity and certification | |
| Fraction of incoming squared -magnitude removed by transport and supremal severity among switching directions. | |
| Projected metric and generalized severity eigenpairs . | |
| Severity threshold, uniformly contractive subspace, and its orthonormal basis matrix. | |
| Contraction, gating-correction, and whitened switching operators restricted to . | |
| Strongest certified severity threshold, satisfying . | |
9 MATHEMATICAL DETAILS OF REPRESENTATION DYNAMICS
9.1 Notation and Technical Setup
We first fix the notation used throughout the supplementary material. A Transformer is viewed as a composition of blocks , where always denotes the layer index. The representation entering layer is , and the block output is . We study two nearby representations and , where denotes their local difference. The Jacobian of the block at is .
Throughout the local analysis, we assume that each block is twice continuously differentiable in a neighborhood of the representation under consideration. This ensures that, for sufficiently small , the block admits the first-order expansion
The term collects the higher-order contribution that vanishes quadratically as the perturbation magnitude approaches zero. Unless stated otherwise, all directional statements in the main theory refer to this local linearization.
Representation magnitudes are measured using a fixed symmetric positive-definite matrix . For , we write and . The Euclidean norm is denoted by . For a matrix , denotes its spectral norm, its largest eigenvalue when is symmetric, its column space, and its rank.
For the self-attention analysis, we fix one Transformer layer and one attention head and suppress their layer and head superscripts whenever no ambiguity arises. Let be the number of tokens and let denote the representation of token at this fixed layer. Token indices are kept distinct from the layer index: denotes the query token, denotes a token attended to by that query, and denotes the token whose representation is perturbed. Thus, is reserved exclusively for Transformer depth, whereas index tokens.
For the single-head attention formulas, let denote the query and key projection matrices, where is the query/key dimension. We use the combined query-key operator , so that the score between query token and token is . The corresponding attention weight is . We denote by the combined value and output transformation, so the attention output associated with query token is
We use for the attention-weighted mean of the token representations and for their attention-weighted covariance. The Jacobian measures how perturbing token changes the attention output of query token . Later, and denote the components of an attention Jacobian arising respectively from changes in the transported information and from changes in the state-dependent routing weights.
For a subspace , denotes a matrix whose columns form a basis of . The notation means that is positive semidefinite, while means that is positive definite. These conventions will be used in the spectral characterization of gating-induced regime switching.
9.2 Local Representation Dynamics and Growth Operator
We formalize how a small representation difference evolves through a Transformer block and derive an operator that determines whether this difference grows or shrinks along a given direction. Let , where denotes the transformation implemented by layer . Consider two nearby representations and . Their difference after the block is . Assuming that is twice continuously differentiable in a neighborhood of , Taylor expansion gives
where is the Jacobian evaluated at , and collects the higher-order terms. Thus, for sufficiently small perturbations, the block acts locally as the linear transformation .
From representation magnitude to the growth operator. To determine whether a representation difference grows or shrinks, we must compare its magnitude before and after the transformation. Let be a fixed symmetric positive-definite matrix defining the squared representation magnitude . The choice gives the usual Euclidean norm, while a general allows different representation directions to be measured with different weights. Importantly, is a choice of measurement geometry, not an additional transformation implemented by the Transformer. Unless otherwise specified, the following derivation applies to any fixed .
For a perturbation , we are interested in the change in its squared magnitude,
A positive value means that the representation difference has grown after the block, whereas a negative value means that it has shrunk. Substituting the local approximation , we obtain
(25)
This calculation shows that the change in squared representation magnitude is governed by the matrix . The first term, , measures the squared magnitude of a perturbation after applying the local transformation, while the second term, , measures its original squared magnitude. Their difference therefore determines whether the block increases or decreases the magnitude of a perturbation. This motivates the following definition of the representation growth operator:
The growth operator is not an additional model parameter or a separate component of the Transformer. It is derived entirely from the block Jacobian and the chosen metric M, and summarizes how the local transformation changes squared representation magnitudes across different directions.
The approximation in Eq. (25) can also be expressed with an explicit remainder. Substituting Eq. (24) into the exact squared-magnitude difference gives
Indeed, expanding produces a cross term of order and a squared-remainder term of order . Consequently, the quadratic form induced by gives the leading-order change in squared representation magnitude. It characterizes the local dynamics without asserting that the same growth behavior necessarily persists under arbitrarily large perturbations.
Directional amplification and contraction. For a nonzero perturbation direction , define its local amplification factor as . By construction, the growth operator satisfies the exact identity
Therefore, indicates local amplification, indicates local contraction, and equality indicates preservation of squared magnitude at the linearized level. Because is symmetric, the growth operator is also symmetric, satisfying . Its eigenvalues are therefore real, and the signs of its quadratic form provide a direct characterization of directional growth.
In particular, if has both positive and negative eigenvalues, there exist nonzero directions and such that and . The same block then locally amplifies some representation differences while suppressing others. We refer to this coexistence of expanding and contracting directions as anisotropic representation dynamics.
Connection to singular values. When , the growth operator becomes . The matrix is symmetric positive semidefinite, and its eigenvectors are the right singular vectors of , with eigenvalues equal to the squared singular values. Hence, if is a right singular vector associated with singular value , then
A singular value greater than one therefore identifies a locally expanding direction, while a singular value smaller than one identifies a contracting direction. The growth operator expresses these behaviors through a single symmetric matrix, with zero separating expansion from contraction.
A simple geometric example. Consider a two-dimensional local transformation with and . The transformation doubles perturbations along the first coordinate direction while halving those along the second. Its growth operator is
For , the squared magnitude changes from 1 to 4, giving . For , it changes from 1 to 1/4, giving . Thus, a single local transformation can simultaneously amplify and contract different directions, and the growth operator captures both behaviors through the signs of its quadratic form.
The growth operator provides a general description of these directional dynamics, but does not yet explain which components of self-attention produce them. In the following sections, we decompose the attention Jacobian into value transport, query gating, and key gating, and examine how their interaction determines the sign of directional growth.
9.3 Self-Attention and the Transport–Gating Decomposition
We begin with a general state-dependent mixture, which will later be specialized to self-attention. Let denote the state on which the mixture depends, and consider , where denotes the information contributed by candidate . The mixture weight is obtained from a differentiable scalar score through the softmax
A perturbation of can therefore affect in two different ways: it can change the candidate information , or it can change the weights used to combine the candidates. Let and . Differentiating the mixture output term by term gives
Since , Eq. (30) implies
The first term in Eq. (31) describes how the candidate information changes while the current mixture weights are held fixed. We therefore define the transport Jacobian as
It remains to simplify the second term, which is caused entirely by the state dependence of the mixture weights. To differentiate the softmax, define , so that . Applying the quotient rule gives
(33)
The gradient of the normalizing factor is
(34)
Substituting Eq. (34) into Eq. (33) and using yields
(35)
where we define
as the mixture-weighted mean score gradient. Thus, the change of a softmax weight is determined not by the absolute score response , but by its response relative to the weighted average response . Substituting Eq. (35) into the weight-dependent term of Eq. (31) gives
(36)
Using , the last term can itself be written as
(37)
Combining Eqs. (36) and (37) therefore gives
(38)
The same quantity can also be centered in score-gradient space. Since the mixture output satisfies , we have
(39)
Consequently,
(40)
We therefore define the gating Jacobian as
Substituting Eqs. (32) and (41) into Eq. (31) gives the transport–gating decomposition
The two Jacobians correspond to different computational effects. measures how the information carried by the candidates changes while their current routing weights are fixed. In contrast, measures how the output changes because the state perturbation redistributes those routing weights. Its centered form is particularly informative: measures how candidate i differs from the current mixture output, whereas measures how the routing preference for that candidate changes relative to the average routing response. The gating effect therefore depends jointly on where different candidate information lies and how the perturbation changes routing among those candidates.
Self-attention is a special case of this state-dependent mixture. For a fixed query token , recall from Eq. (23) that . Hence the candidate information is , while the weights are determined by query-key scores. The generic decomposition above therefore separates representation changes propagated through the value pathway from changes caused by attention reallocation. The next subsection further resolves this gating term into the exact query and key pathways of self-attention.
9.4 Exact Query, Key, and Value Jacobian Decomposition
We now specialize the transport–gating decomposition to dot-product self-attention and derive the exact Jacobian with respect to an individual token representation. Recall that we fix one Transformer layer and one attention head, suppressing the corresponding layer and head indices. Let denote the query token, a candidate token, and the token whose representation is perturbed. The attention score and weight are and , respectively, and the attention output is .
Our goal is to compute , which measures how a perturbation of token changes the attention output associated with query token . Consider an infinitesimal perturbation . Differentiating the attention output gives
(43)
Because only is perturbed, for and is the only nonzero token differential. Hence the second term becomes
This is the direct value transport contribution. The remaining term arises because perturbing may also change the attention weights. To compute this routing contribution, we first differentiate the score . The token can affect this score in two different roles: it may be the query when , and it may be the key associated with candidate when . To make these two pathways explicit, recall that , so that
where is the query vector produced by token , and is the key vector produced by token . Hence affects the score through the query , while affects it through the key . Differentiating the score therefore gives
(45)
The first term in Eq. (45) is produced by perturbing the representation that generates the query. Indeed,
(46)
We therefore refer to this term as the query pathway. A perturbation of the query token changes , and consequently can change its compatibility with every candidate key . The second term is produced by perturbing the representation that generates the key:
(47)
We refer to this term as the key pathway. In this case, the query representation is fixed, while the perturbation changes the key of the candidate token and therefore changes how strongly that candidate matches the query.
Because our Jacobian considers a perturbation only to token , we have and . Substituting these relations into Eq. (45) gives
(48)
Here, denotes the indicator function. The factor activates the query pathway only when the perturbed token is the query token itself, whereas activates the key pathway only when the perturbed token is the candidate whose score is being evaluated. These two cases are not mutually exclusive: if , the same token generates both the query and the key, and both contributions to are present.
The softmax differential derived in Section 9.3 gives
We next evaluate the query and key contributions separately.
Query contribution. Suppose first that the perturbation acts through the query role. From Eq. (48), the query-induced score differential is
(50)
Its attention-weighted average is
(51)
where, recall, is the attention-weighted mean representation. Substituting Eqs. (50) and (51) into the softmax differential gives
(52)
The corresponding contribution to the attention output is therefore
(53)
The matrix inside brackets is exactly the attention-weighted covariance. To see this, write . Then
(54)
The second term vanishes because
(55)
Hence, recalling the definition , Eq. (53) reduces to
The exact query-gating Jacobian is therefore
Key contribution. We now isolate the effect of perturbing token m through its role as a key. From Eq. (48),
(58)
Taking the attention-weighted average over candidate tokens gives
(59)
Substituting into the softmax differential yields
(60)
The resulting change in the attention output is
(61)
Since , we obtain
Hence the exact key-gating Jacobian is
Complete decomposition. Combining the value contribution in Eq. (44), the query-gating contribution in Eq. (56), and the key-gating contribution in Eq. (62), we have
(64)
Therefore,
This decomposition is exact for the single-head dot-product attention map considered here. The first term propagates a perturbation directly through the value pathway. The second arises because perturbing the query changes its relative preference over all candidate tokens, and its dependence on shows that this effect is mediated by variation among the currently attended representations. The third arises because perturbing token m changes its compatibility with the fixed query and therefore changes how strongly that token is selected as a key. When m = r, the same representation participates simultaneously as value, query, and key, and all three terms in Eq. (65) contribute.
Equation (65) refines the generic decomposition of Section 9.3: the value term is the transport contribution, whereas the query and key terms together form the state-dependent gating contribution. In the next subsection, we study the geometry of the query-gating operator , which makes explicit the representation subspace in which changes to attention routing can act.
9.5 Geometry and Support of Query Gating
We now examine how the geometry of attended representations constrains the query-gating response and provide the complete proof of Proposition 1. For a fixed query token r, recall that the query-gating component of the attention Jacobian is
where the indicator is omitted because we consider perturbations of the query token itself. Here, denotes the attention-weighted covariance of the token representations,
The attention weights satisfy and .
The factorization in Eq. (66) suggests that query gating is governed by more than the query-key transformation alone. Although determines how a query perturbation changes attention scores, the resulting change in the output also depends on whether the attended representations differ from one another. The covariance captures precisely this variation, while maps the resulting redistribution into the output representation space. Our objective is therefore to identify the subspace on which can act and determine how this subspace constrains the query-gating Jacobian.
Geometric support of query gating. Let denote the active attention set, which also accommodates attention masks that assign zero weight to unavailable tokens. Define the attended variation subspace as
This subspace contains all linear combinations of deviations of the attended representations from their attention-weighted mean. We show that the covariance acts only within this subspace and that its exact support determines the possible output directions, rank, and null directions of query gating.
Proposition 1 (restated: Geometric Support of Query Gating). Let be the attended variation subspace and the query-gating Jacobian. Then
(69)
Proof. The central observation is that the range of the attention-weighted covariance is exactly the attended variation subspace. Once this relationship is established, the three claims follow directly from the factorization of the query-gating Jacobian.
To see why the covariance is restricted to , consider its action on an arbitrary vector . Expanding Eq. (67) gives
(70)
The final expression is a linear combination of the centered attended representations . By the definition of their span, this implies
The inclusion shows that the covariance cannot produce components outside , but it does not yet establish whether every direction in belongs to its range. To prove equality, we characterize the null space of . Since is a sum of symmetric rank-one matrices with nonnegative weights, it is symmetric positive semidefinite. Its quadratic form satisfies
(72)
Every summand is nonnegative, and for all . Consequently, the quadratic form vanishes if and only if every inner product vanishes. Furthermore, because is positive semidefinite, holds if and only if . We therefore obtain
(73)
Thus, . Since is symmetric, its range is the orthogonal complement of its null space. Taking orthogonal complements yields
The last equality follows because is a finite-dimensional linear subspace and is therefore equal to its double orthogonal complement. This establishes the exact geometric support of the covariance: its range consists precisely of the directions spanned by variation among the attended representations.
We now return to the query-gating Jacobian. Since , any output response first passes through and then through . In particular, for an arbitrary perturbation ,
(75)
The last expression shows that every query-gating response is a linear combination of the transformed centered representations . We can express the same observation through the range of the matrix product:
Here, the inclusion follows from the fact that right multiplication cannot enlarge the column space of a matrix, while the final equality follows from Eq. (74). Therefore, query gating cannot generate an arbitrary output perturbation: its response must remain within .
This output-support restriction also limits the dimensionality of query gating. Since the rank of a matrix is the dimension of its range, and multiplication cannot increase rank beyond that of either factor, we have
Thus, even if the ambient representation space has dimension d, the rank of the query-gating Jacobian cannot exceed the dimension of the attended variation subspace.
It remains to identify perturbation directions that produce no query-gating response. The null-space characterization in Eq. (73) provides this condition directly. Suppose that . Then
(78)
Substituting this relation into the query-gating Jacobian yields
Equivalently, for any , the identity shows that is equivalent to . Hence perturbations orthogonal to the transformed variation subspace cannot activate query gating. This establishes the final claim and completes the proof.
The proposition gives both an output-side and an input-side characterization of query gating. On the output side, the response is confined to , with rank at most . On the input side, a perturbation cannot induce query gating when its transformation through is orthogonal to the attended variation subspace. The latter condition is sufficient but not necessary: the response may also vanish when annihilates a nonzero covariance response. These distinctions are important because the exact covariance support does not imply that the full query-gating Jacobian has the same range or rank.
Pairwise form of the covariance. The preceding proof shows that the covariance is supported precisely on variation among attended representations. We now express this variation directly through pairwise differences, rather than deviations from the attention-weighted mean. Besides providing a geometric interpretation, this alternative representation will be useful for bounding the magnitude of query gating.
Starting from the covariance definition, expanding the centered outer product gives
(80)
The fourth equality uses and . Thus, the covariance equals the attention-weighted second moment minus the outer product of the weighted mean.
To recover this expression from pairwise differences, consider
Expanding the outer product gives
(81)
The first two sums contain terms depending on only one of the indices. Since the attention weights sum to one, they reduce to
(82)
The two cross terms instead factor into products of the attention-weighted means:
(83)
Substituting these identities into Eq. (81), we obtain
where the last equality follows from Eq. (80). We therefore obtain the pairwise covariance identity
Substituting this identity into the query-gating Jacobian gives
(86)
This representation makes the role of attended-representation diversity explicit. Each contribution depends on a pairwise difference , scaled by the corresponding attention weights. If all active attended representations coincide, every difference vanishes, and hence and . The routing distribution may still be sensitive to the query in principle, but redistributing attention among identical representations cannot change the query-gating output. More generally, small pairwise differences constrain the strength of the response, as quantified next.
A geometric upper bound. The pairwise covariance identity allows us to relate the magnitude of query gating to two properties of the attended representations: their geometric diversity and the concentration of the attention distribution. Define
The first quantity is the diameter of the active attended representations. The second measures attention concentration, with for one-hot attention and smaller values when attention is spread across multiple tokens.
To derive the bound, we start from Eq. (85) and apply the triangle inequality for the spectral norm. Since every is nonnegative,
(87)
The last equality uses the rank-one identity , which follows because has a single nonzero eigenvalue equal to .
The terms with vanish because . For the remaining terms, the squared distance is bounded by . Therefore,
(88)
The remaining sum measures the total probability mass assigned to pairs of distinct tokens. We can express this quantity through the attention concentration:
(89)
Combining the last two equations gives
It remains to transfer this covariance bound to the query-gating Jacobian. By submultiplicativity of the spectral norm,
(91)
The final equality follows from the invariance of the spectral norm under transposition. Substituting Eq. (90) yields
(92)
Hence,
The bound identifies two limiting regimes in which query gating becomes weak. When the attended representations approach one another, their diameter decreases, suppressing the covariance through the squared-distance factor. When attention becomes nearly one-hot, approaches zero, reducing the effect of reallocating probability mass among different representations. These conclusions concern the corresponding limits with bounded representations and transformation norms. Conversely, a large diameter and diffuse attention do not guarantee a large response, because the query-key and value-output transformations may eliminate or attenuate the relevant directions.
Geometric interpretation. The preceding results provide a geometric description of how query gating responds to representation perturbations. For a perturbation v, the operator determines the direction in which the query attempts to change its routing preferences. The covariance then restricts this response to variation that actually exists among the attended representations. Finally, maps the surviving variation into the output space.
This interpretation explains why the range restriction is generally an inclusion rather than an equality. Although , the surrounding transformations can remove additional directions. The operator may fail to reach some directions in , while may map some nonzero covariance responses to zero. Consequently, query gating may operate in a subspace of substantially smaller dimension than the attended variation subspace.
A simple two-dimensional example illustrates this geometry. Consider two equally attended representations,
Their attention-weighted mean is
Since the weighted mean is zero, the covariance becomes
Thus, the covariance has rank one, and its range is
The attended representations vary only along the horizontal axis. To isolate the covariance effect, suppose , giving .
For a horizontal perturbation , the query-gating response is
The response is nonzero because the perturbation acts along the direction in which the two attended representations differ. In contrast, for a vertical perturbation ,
Although the query representation changes, the two attended representations have no variation along the vertical direction. The covariance therefore removes the perturbation, producing no query-gating response.
The geometric norm bound is also exact in this example. The representation diameter and attention concentration are
Since both transformation matrices are identities, Eq. (93) gives
Directly from Eq. (94), we have , so the bound is attained. The example therefore illustrates both the exact directional restriction imposed by the covariance and the dependence of query-gating magnitude on representation separation and attention concentration.
Taken together, these results establish that query gating is governed by the geometry of the representations currently receiving attention. The attended variation subspace determines the covariance support, the surrounding query-key and value-output transformations constrain which of those directions remain accessible, and the pairwise covariance identity quantifies how representation diversity and attention concentration bound the response magnitude. These results characterize where query gating can act and how strongly it can act. They do not, however, determine whether the resulting perturbation amplifies or suppresses a representation difference. That signed effect depends on how query gating interacts with value transport and key gating, motivating the subsequent analysis of directional growth and regime switching.
9.6 Directional Routing Alignment
We now ask a complementary question: once a direction v is fixed, does gating reinforce or oppose motion along that direction? This signed directional effect is important because the same routing mechanism can strengthen one representation difference while suppressing another. We return to the state-dependent mixture formulation from Section 9.3. From this point onward, we consider representation maps from to , so that input and output perturbations lie in the same representation space. Recall that
with gating Jacobian
When specialized to self-attention, collects the state-dependent routing contributions, including query and key gating. Let be the representation metric and let be a representation direction. We define the signed directional gating contribution as
The sign of indicates whether the first-order gating response reinforces or opposes displacement along : is reinforcing, is opposing, and gives no signed first-order contribution along that direction. Substituting Eq. (95) into Eq. (96) yields
(97)
For each candidate i, we define
The quantity measures where candidate lies relative to the current mixture output F along direction v. In contrast, measures how a perturbation along v changes the relative routing preference for candidate i. With this notation,
Both directional quantities are centered under the routing distribution . Since the softmax weights satisfy and , they define a discrete probability distribution over the candidates. For any candidate-dependent scalar quantity , we write its expectation under this routing distribution as
For the directional candidate displacement , we have
The equality follows because is the routing-weighted mean of the candidate representations. Thus is already a centered candidate displacement, and its weighted average is zero. Similarly, for the directional routing response ,
where is the routing-weighted mean score gradient. Hence is also centered under the same routing distribution. The weighted covariance between and is defined as
Because both weighted expectations are zero, this simplifies to
(103)
Comparing Eq. (103) with Eq. (99), we obtain
This covariance identity gives a direct interpretation of the sign of the directional gating effect. Recall that measures where candidate lies relative to the current mixture output along direction , whereas measures whether a perturbation along increases or decreases the relative routing preference for that candidate. If candidates with tend to have , while candidates with tend to have , then the two quantities vary together, their weighted covariance is positive, and gating reinforces motion along . Conversely, if routing increasingly favors candidates lying on the opposite side of , then and tend to have opposite signs, the covariance becomes negative, and gating opposes motion along . To separate magnitude from sign, define the directional candidate diversity
(105) the directional routing sensitivity
and, whenever , the directional routing alignment
To characterize the range of , apply the weighted Cauchy–Schwarz inequality to the two weighted sequences and :
(108)
Taking the nonnegative square root of both sides gives
Since , dividing both sides by yields
(110)
Therefore,
Equivalently, is the cosine similarity between the two weighted vectors
and
Indeed,
Hence corresponds to perfect directional alignment, to perfect anti-alignment, and to zero weighted linear alignment between candidate displacement and routing response. We now recover the directional gating contribution. From Eq. (99),
When , rearranging the definition of gives
(114)
Combining this identity with therefore yields
The same identity also remains valid when . In that case, either or . If , then , which implies for every candidate with . Similarly, if , then for every candidate with positive routing weight. In either case,
and because we define , the right-hand side is also zero. Thus Eq. (115) holds in all cases. Equation (115) separates three distinct requirements for a strong directional gating effect. measures whether the available candidate representations contain meaningful variation along ; measures whether routing is locally responsive to perturbations along ; and determines whether this routing response favors candidates that reinforce or oppose the direction.
Corollary 2 (Three Mechanisms of Weak Gating). If , , or , then
These cases have different interpretations. means that the candidates are indistinguishable along , so changing their routing weights cannot move the representation in that direction. means that routing itself is locally insensitive to . Finally, means that candidate displacement and routing response are individually present but cancel because they are directionally unaligned. This distinction is useful diagnostically: an observed lack of representation change may arise because the relevant information is absent, because routing does not respond to it, or because routing responds in a directionally neutral manner.
Corollary 3 (Directional Upper Bound). For any direction ,
Thus diversity and routing sensitivity determine the maximum possible magnitude of the local gating effect, while determines how much of this potential effect is realized with positive or negative sign.
Example: reinforcing versus suppressing routing. Consider a one-dimensional directional view with two equally weighted candidates, . Suppose their projected displacements along v are
The two candidates therefore lie symmetrically on opposite sides of the current mixture output along v. The directional diversity is
Now suppose that a perturbation along v increases the relative score of the positive-side candidate and decreases that of the negative-side candidate:
Then
and
Therefore,
Routing shifts mass toward the candidate lying in the positive v-direction and away from the candidate lying in the negative direction, so gating reinforces the perturbation. If instead the routing response is reversed,
then
and hence
The candidate geometry and routing sensitivity are unchanged: and in both cases. Only the alignment changes. Nevertheless, the qualitative behavior reverses from reinforcement to suppression. This example illustrates why large candidate diversity and large routing sensitivity alone are insufficient to determine directional growth; their alignment is essential.
Implications for downstream interventions. The decomposition above provides a local diagnostic for several downstream settings in which an intervention is useful only if its representation effect is not immediately suppressed. Consider, for example, a candidate steering or editing direction v. A positive value of indicates that state-dependent routing locally reinforces this intervention, whereas a negative value indicates that routing locally opposes it. The quantities , , and further identify why: the relevant feature may be absent from the available candidate representations, routing may be insensitive to it, or routing may respond but redirect information in the unfavorable direction.
The same distinction is useful for adversarial perturbations. A perturbation direction with large is not necessarily effective if the candidate representations exhibit little diversity along that direction or if . Directions with large positive are therefore natural candidates for further downstream evaluation, whereas directions with negative alignment are locally resisted by routing.
For pruning and head-level diagnosis, the decomposition separates routing activity from functional routing effect. A head may exhibit substantial changes in its attention weights, corresponding to non-negligible routing sensitivity, while still having small because the representations between which it redistributes mass are nearly identical. Such a head can appear dynamically active in attention space while producing little directional representation change. Conversely, a head with substantial and positive alignment may have a larger functional effect despite less visually dramatic attention changes.
For robustness, the same factorization identifies distinct ways of reducing sensitivity to an undesirable direction: decreasing the available candidate diversity , decreasing routing sensitivity , or reducing the directional alignment . These mechanisms are not equivalent, and distinguishing them can help separate representational causes of instability from routing-induced causes.
These interpretations remain local. A positive gating contribution at one layer does not by itself guarantee that the corresponding representation difference will survive to the model output, because subsequent layers may rotate or suppress the direction. Likewise, a large local value of does not by itself guarantee a label change or successful steering outcome. Downstream behavior additionally depends on later Jacobian composition and output alignment, which lie beyond the scope of the present local analysis.
Most importantly, Eq. (115) evaluates gating after a direction v has already been specified. Our central theoretical question is stronger: whether there exists any direction for which gating is sufficiently strong to overturn contraction induced by transport, and which direction maximizes this effect. The next section converts the directional analysis above into a spectral characterization of such gating-induced regime switches.
9.7 Extensions to Modern Transformer Blocks
The preceding analysis used a single-head dot-product attention map to expose the transport–gating mechanism in its simplest form. We now show how the same decomposition extends to the components commonly surrounding self-attention in a Transformer block. The central transport–gating distinction is preserved under multi-head aggregation and differentiable composition, although some of the more specific factorizations, such as , must be modified when the score operator itself depends on token position.
Multi-head self-attention. Consider attention heads. For head , let denote the attention weight from query token to candidate token , and let denote the corresponding value transformation together with the portion of the output projection associated with that head. The multi-head output can then be written as
This representation is equivalent to the usual concatenation followed by an output projection, after partitioning the output projection into the blocks associated with individual heads.
Because differentiation is linear, the Jacobian with respect to a perturbation of token m is the sum of the head-wise Jacobians:
For ordinary dot-product attention without position-dependent score transformations, each head satisfies the decomposition derived in Section 9.4:
where and .
Thus the complete multi-head Jacobian retains the additive structure
with the transport and gating terms obtained by summing the corresponding contributions across heads. Different heads may therefore reinforce, cancel, or act on different representation subspaces.
Pre-normalization and residual connections. We next incorporate token-wise normalization. Let denote either LayerNorm, RMSNorm, or another differentiable normalization map, and define
Suppose attention is evaluated on the normalized representations, . If denotes the attention Jacobian with respect to the normalized token, then the chain rule gives
Hence normalization does not remove the transport–gating decomposition; it transforms the input directions through the local normalization Jacobian .
For a pre-normalized residual attention sublayer,
the token-to-token Jacobian becomes
The identity term propagates the residual stream directly, while contains the attention transport and gating effects.
For completeness, consider LayerNorm
where , , , and . Its Jacobian is
For RMSNorm,
and
These expressions show explicitly that normalization can rotate and rescale perturbation directions before they enter the attention mechanism. The attention decomposition itself is applied after this local transformation.
Feed-forward and gated feed-forward sublayers. The feed-forward network is token-wise and therefore does not introduce additional cross-token routing. Nevertheless, it can transform an attention-induced representation difference before that difference reaches later layers.
For a standard feed-forward map
its Jacobian is
For a gated feed-forward map of the form
which includes SwiGLU-type structures for the appropriate choice of , define and . Differentiating the element-wise product gives
(131)
Hence
The feed-forward sublayer therefore contributes an additional local transformation of the directions produced by attention, but it does not alter the distinction between value transport and state-dependent attention routing inside the attention sublayer.
Full pre-normalized Transformer block. The preceding components can be combined through the chain rule. Let X denote the vectorized sequence representation, let A denote multi-head attention, and let H denote the token-wise feed-forward map. A pre-normalized block has the form
Let and denote the block-diagonal Jacobians of the two token-wise normalization maps, and let and denote the Jacobians of attention and the feed-forward map with respect to their normalized inputs. Then
and therefore
If , then
Thus the attention routing effect remains explicitly identifiable inside the full block, while normalization, residual connections, and the feed-forward sublayer determine how that effect is subsequently transformed.
Rotary positional embeddings. Rotary positional embeddings require slightly more care because the query-key interaction becomes position dependent. Let denote the rotations applied at query position and key position , respectively. Define
The attention score becomes
(136)
Define the position-dependent score operator
Then , and the query-score gradient is
Because now depends on the candidate position i, a single common matrix can no longer, in general, be factored outside the attention-weighted sum. The query-gating Jacobian instead follows directly from the generic gating formula. Define
Then
(138)
The matrix in brackets is an attention-weighted cross-covariance between candidate representation variation and query-score-gradient variation. Define
Then
The covariance factorization from Section 9.5 is recovered as a special case. Without position-dependent score rotations, for every i, so
(141)
Consequently,
(142)
and therefore , as derived previously. Thus RoPE does not remove the transport–gating mechanism; it replaces the simple covariance factorization by a position-dependent representation–routing cross-covariance.
Grouped-query and multi-query attention. Grouped-query attention and multi-query attention share key and/or value projections across multiple query heads. Let denote the key-value group associated with query head h. A head-specific score may then be written as
The corresponding output remains a state-dependent weighted mixture, so the head-wise transport-gating decomposition continues to hold. Sharing changes the parameterization of the score and value maps but not the product-rule argument that separates changes in candidate information from changes in routing weights. The full Jacobian is again obtained by summing the head-wise contributions, with the shared key and value projections appearing in the corresponding terms.
Attention masks. Causal, padding, or structured masks restrict the candidate set available to a query. If denotes the set of unmasked candidates, then all sums above can be restricted to . In particular,
so the centering, covariance, and transport–gating derivations remain unchanged on the active candidate set. The geometric support of gating is consequently determined by the variation among the representations that are actually available to the query.
Summary. The extensions above separate architecture-specific transformations from the underlying routing mechanism. Multi-head aggregation adds head-wise transport and gating contributions; normalization preconditions the perturbation directions; residual connections add a direct identity path; feed-forward sublayers post-process the resulting representation differences; and positional transformations such as RoPE modify the precise score geometry. In all cases, however, the local attention response retains the same fundamental distinction: one component changes the information being transported, while another arises because the state perturbation changes how information is routed. The regime-switch analysis in the next section is formulated at the operator level and therefore applies once these architecture-specific contributions have been incorporated into the corresponding local transport and gating Jacobians.
10 THEORY OF GATING-INDUCED REGIME SWITCHING
The previous section showed how transport and gating contribute to the local attention dynamics. We now ask whether gating can turn a representation direction that contracts under transport alone into one that expands under the full dynamics. To answer this, we compare two dynamics for the same direction. In the first, the attention routing is held fixed, so the direction evolves only through transport. In the second, routing is allowed to change with the representation, so both transport and gating are present. We call it a gating-induced regime switch when a direction contracts in the transport-only dynamics but expands in the full dynamics.
The main problem is therefore to determine whether such a direction exists, and if so, which direction is affected most strongly by gating. We formulate this comparison using the growth operators of the transport-only and full dynamics. Their difference measures how much adding gating changes directional growth. This leads to a spectral criterion that is necessary and sufficient for the existence of a switching direction, and also identifies the direction for which gating most strongly overcomes transport-induced contraction. We then derive conditions under which switching cannot occur, study how many independent switching directions can exist, and analyze how robust the criterion is when the relevant operators are estimated approximately.
10.1 Transport-Only and Full Representation Dynamics
Recall that the local attention Jacobian separates as . We compare the growth of the same representation direction under two counterfactual dynamics: one in which the routing weights are held fixed and only transport remains, and one in which state-dependent gating is restored. Using the growth operator from Section 9.2, these two cases are
Definition 1 (restated): Gating-Induced Regime Switch. A nonzero direction v undergoes a gating-induced regime switch if
Thus, the direction contracts when routing is fixed but expands once state-dependent gating is restored. To quantify how restoring gating changes directional growth, define
Proposition 2. The change in the growth operator induced by gating is
Proof. Since , we have
(147)
Expanding the product gives
The first line is exactly . Therefore,
which proves the result.
Equation (146) shows that gating changes representation growth through two distinct effects. The first two terms describe the interaction between the transport and gating responses, and can either increase or decrease growth depending on their alignment. The final term is the growth contributed by gating itself and is nonnegative in every direction because . Thus, the effect of gating cannot be characterized by its magnitude alone; its interaction with transport also matters.
For any direction v,
If transport contracts v, so that , then gating reverses this contraction exactly when
The left-hand side measures how much restoring gating changes growth along v, whereas the right-hand side is the amount of transport-induced contraction that must be overcome. The next subsection asks whether such a direction exists without searching over directions individually.
10.2 Spectral Criterion for Regime Switching
Equation (151) determines whether a fixed direction undergoes a regime switch. We now ask whether such a direction exists within an entire region in which transport alone is contracting. Let be an -dimensional subspace, and let have orthonormal columns spanning . Thus, every direction can be written as for some coordinate vector . We call transport-contractive when transport decreases the -energy of every nonzero direction in this subspace, i.e.,
Such a subspace exists whenever has at least one negative eigenvalue. More generally, if it has negative eigenvalues, their associated eigenvectors span an -dimensional transport-contractive subspace. Substituting gives
Therefore, requiring every nonzero direction in S to be transport-contractive is equivalent to
In other words, the projected operator describes transport growth using coordinates inside , and its negative definiteness guarantees contraction along every nonzero direction in that subspace. Because this projected operator is negative definite, its negation is positive definite. We denote , so that measures the transport contraction experienced by the direction . On the same subspace, the change in growth produced by restoring gating is represented by . Hence the full growth operator restricted to takes the simple matrix form
A regime switch therefore exists whenever the gating-induced growth R can overcome the transport-contraction operator C along at least one direction. The following result gives an exact criterion.
Theorem 1 (restated): Spectral Criterion for Gating-Induced Regime Switching. Let S be a transport-contractive subspace satisfying Eq. (154). Define . Then there exists a nonzero direction that undergoes a gating-induced regime switch if and only if
Moreover, whenever this condition holds, a switching direction is
where is a unit eigenvector of W associated with .
Proof. Because the columns of form an orthonormal basis of , every nonzero direction can be written uniquely as
Since S is transport-contractive, . Therefore, for every ,
where . Hence the transport-contraction part of Definition 1 is automatically satisfied throughout . It remains to determine whether the full dynamics expand at least one direction in this subspace. Using , we obtain
where . Thus, a gating-induced regime switch exists in if and only if there exists such that
Because , we have for every nonzero . Therefore, dividing both sides of Eq. (159) by preserves the inequality and gives
The regime-switch problem is therefore equivalent to asking whether the generalized Rayleigh quotient associated with the pair can exceed one. We next transform this generalized quotient into an ordinary Rayleigh quotient. Since , the symmetric matrices and exist and are nonsingular. For simplicity, we introduce the change of coordinates
Because is invertible, if and only if . Under this change of coordinates, the denominator in Eq. (160) becomes
where we used the symmetry of . Similarly, the numerator becomes
Substituting Eqs. (162) and (163) into Eq. (160) yields
Let
Since both and are symmetric, is symmetric, and therefore is symmetric. Hence is also symmetric. Equation (164) therefore shows that a regime switch exists if and only if
By the Rayleigh–Ritz characterization for symmetric matrices,
(167)
Consequently, we have
(168)
This proves the necessary and sufficient condition.
It remains to verify the explicit construction of a switching direction. Let be a unit eigenvector of associated with , and define
Since and has orthonormal columns, . Its transport-only growth satisfies
Meanwhile, its full growth is
Therefore, satisfies both inequalities in the definition of a gating-induced regime switch, which completes the proof of the constructive claim.
The whitening by has a direct interpretation. Transport may contract different directions in S by very different amounts, so comparing gating growth in its original coordinates would not account for how difficult each direction is to reverse. The matrix
measures the gating-induced change after normalizing by this transport contraction. Its threshold therefore has a fixed meaning: eigenvalues below one correspond to directions in which gating is insufficient to overcome transport, whereas an eigenvalue above one certifies a contraction-to-expansion switch.
10.3 Strength of Regime Switching
The existence criterion in the previous subsection is binary: it determines whether gating can reverse transport-induced contraction somewhere inside S, but does not quantify how strong that reversal is. Two complementary notions are useful for this purpose. The first measures how strongly gating overcomes transport relative to the contraction it faces, whereas the second measures how severe the reversed transport contraction is in absolute terms. These notions distinguish a direction that is easy to flip because transport is nearly neutral from one that remains switchable despite substantial transport contraction.
Relative switching strength. For a nonzero direction , the gating-induced growth correction is , while the magnitude of the transport contraction is . Their ratio
measures how much gating-induced growth is obtained per unit of contraction that must be overcome. Because every direction in is transport-contractive, a direction switches precisely when .
Corollary 1 (restated): Maximum Relative Switching Strength. Let , and let be a unit eigenvector associated with . Then maximizes over all nonzero , up to arbitrary nonzero scaling, and . Consequently, if , then undergoes a gating-induced regime switch.
Proof. Because the columns of form an orthonormal basis of , every nonzero direction can be written uniquely as for some . By the definitions and , the transport contraction along satisfies
(175)
while the gating-induced growth correction satisfies
(176)
Therefore
Since , introduce the whitened coordinate
The denominator becomes
(179)
and similarly
(180)
Hence
The matrix is symmetric. Therefore, by the Rayleigh–Ritz theorem,
Let be a unit eigenvector associated with . This vector is optimal in the whitened coordinate system, rather than directly in the original representation space. To recover the corresponding representation direction, we undo the two coordinate transformations introduced above. First, based on equation 161, the whitening transformation implies
Thus, is the maximizing direction expressed in the coordinates of the transport-contractive subspace S. Since the columns of P form an orthonormal basis of S, a coordinate vector u corresponds to the representation direction . Mapping back to the original representation space therefore gives
Hence is the optimal direction after normalizing by transport contraction, is the same direction in the coordinates of S, and is the corresponding direction in the original representation space. Substituting into (181) then yields
where the final equality follows because and . Finally, if , then . Since ,
(186)
At the same time, because . Therefore undergoes a gating-induced regime switch.
Relative strength is useful because it compares directions on a common scale and admits an exact spectral optimum. However, it can become large when transport contraction is very small. For example, a direction with transport growth -0.001 and gating correction 1 has , even though only a very weak contraction must be reversed. Relative strength therefore does not by itself quantify how severe the underlying transport contraction is.
Absolute reversal severity. Relative switching strength identifies directions for which gating is large compared with the transport contraction that it must overcome. This relative comparison is useful, but it can favor directions that are already almost neutral under transport. A complementary question is therefore whether gating can reverse a direction that transport suppresses strongly.
For a transport-contractive direction , the squared -energy removed by transport is . Its raw magnitude, however, scales quadratically with , so it cannot be compared meaningfully across directions of different size. The natural quantity is instead the fraction of the incoming energy that transport removes:
This quantity has a direct interpretation in terms of the transported representation. Recall that . Therefore,
(188)
Substituting this identity into (187) gives
Hence is exactly the fraction of incoming squared M-energy removed by transport. Because is transport-contractive, . Values near zero correspond to weak suppression, whereas near one means that transport removes almost all of the incoming energy. For example, means that only 20% of the incoming squared M-energy remains after transport.
We are interested specifically in directions for which this contraction is subsequently reversed by state-dependent gating. The strongest such reversal is characterized by
Since every nonzero direction in S is already transport-contractive, the remaining constraint selects exactly the directions that undergo a regime switch. Thus, asks how severe the transport contraction can be while still being overturned into expansion by the full state-dependent dynamics.
Unlike the relative objective , this optimization does not reduce directly to a single generalized Rayleigh quotient. The direction must simultaneously exhibit sufficiently strong transport contraction and positive full growth. Rather than optimizing these two requirements jointly, we first isolate directions whose transport contraction is guaranteed to exceed a prescribed severity level, and then ask whether any direction in that region switches.
For , the removed transport energy is . Its incoming energy is . Let . Then
Absolute contraction severity is therefore a generalized Rayleigh quotient for the pair . This observation provides a natural coordinate system in which transport modes are ordered by how strongly they contract.
Let satisfy , with the generalized eigenvectors chosen B-orthonormally so that , and order the eigenvalues as . Along an individual generalized eigenvector,
so has a direct meaning: it is the absolute transport severity of that mode. Moreover,
and hence . Together with , this implies .
Now fix a desired severity level . We retain only the generalized transport modes whose contraction is at least this threshold:
The important point is not merely that each selected basis direction has severity at least , but that every nonzero direction in their span does as well. Thus, is a region in which transport contraction is uniformly strong. For example, restricts the analysis to a subspace in which transport removes at least 80% of the incoming squared M-energy along every direction.
The remaining question is whether gating can reverse any direction inside this strongly contractive subspace. Let be an orthonormal basis of , assuming that the subspace is nontrivial, and restrict the transport and gating-growth operators to it:
Because , we still have . The same whitening used in the existence theorem therefore yields the restricted switching operator
Theorem 2 (restated): Certified Absolute Reversal Severity. Fix and suppose . Every nonzero direction in has absolute transport severity at least . Moreover, if and only if contains a gating-induced regime-switch direction. Consequently, whenever , the strongest absolute reversal satisfies .
Proof. We first verify that the severity threshold holds uniformly over . Any nonzero can be written as , where
for coefficients not all zero. Since the generalized eigenvectors are B-orthonormal and satisfy ,
(195)
Therefore,
Thus every nonzero direction in is guaranteed to experience at least the prescribed transport contraction.
It remains to determine whether any such direction becomes expanding after gating is restored. Write . Its transport-only and full growths are
Since , transport contracts every nonzero direction in this subspace. A regime switch therefore exists precisely when some satisfies
or, equivalently,
To evaluate the largest value of this ratio, set , so that . Then
Rayleigh–Ritz therefore gives
Hence a switching direction exists inside if and only if .
Whenever this condition holds, the resulting direction is both switching and contained in . The first part of the proof therefore guarantees , and consequently
This proves the certificate.
The theorem converts absolute reversal severity into a sequence of increasingly demanding spectral tests. If , then : raising the threshold removes weaker transport modes and asks whether switching persists after progressively stronger contraction. The largest threshold certified in this way is
with if no threshold is certified. The theorem immediately implies
The inequality is intentional. The condition describes a quadratic region of representation space and need not itself form a linear subspace. Our construction instead extracts a linear subspace on which the severity threshold holds uniformly, and then applies the exact spectral switch criterion inside that subspace. Consequently, is a certified lower bound on the strongest absolute reversal, rather than necessarily its exact value.
When , the orthonormality of gives . The generalized eigenproblem then reduces to , and is simply the span of the transport-contraction eigenvectors with eigenvalues at least . This is the nested-subspace form used in our experiments.
Interpretation. Relative and absolute switching strength answer different questions. Suppose has transport growth -0.2 and gating correction 1.0, while has transport growth -0.8 and gating correction 2.0, with both directions normalized to the same incoming M-energy. Both directions switch, with full growth 0.8 and 1.2, respectively. Relative strength favors , because : gating is larger relative to what must be overcome. Absolute severity instead favors , because transport removes a substantially larger fraction of its incoming energy before the reversal.
Thus, characterizes the most favorable gating-to-transport competition, whereas asks how severe transport contraction can be while still being overturned. The certified quantity makes the latter operational: a large value shows that regime switching persists even after restricting attention to directions that transport suppresses strongly, rather than arising only near the transport-neutral boundary.
10.4 No-Switch Conditions and Effective Switching Dimension
The previous results characterize whether a regime switch exists and how strong such a reversal can be. We now ask two complementary questions. First, when is gating provably unable to overturn transport contraction anywhere in S? Second, when switching is possible, is it confined to a low-dimensional portion of representation space or supported over a broader family of directions? Both questions are determined by the spectrum of the whitened switching operator .
Recall that every nonzero can be written as , and that its full growth satisfies
Thus, a regime switch occurs precisely when the quadratic form is positive along at least one direction.
Theorem 3 (restated): No-Switch Criterion and Effective Switching Dimension. Let , with eigenvalues . There is no gating-induced regime switch anywhere in if and only if , equivalently , or equivalently . Moreover, if , then is the largest dimension of a linear subspace of in which every nonzero direction undergoes a regime switch.
Proof. For any nonzero , write with . Using the definitions of and , the full directional growth becomes
(202)
Because every direction in is already transport-contractive, a regime switch exists exactly when there is some such that . Therefore, no switch occurs anywhere in exactly when
which is equivalent to
Since , we may again whiten the transport contraction by writing , so that . Substituting this relation gives
(205)
Hence, no switch exists if and only if
Because is symmetric, this condition is equivalent to
By the spectral theorem, holds exactly when every eigenvalue of is at most one, which yields
This proves the no-switch equivalences.
We next characterize the largest linear subspace on which switching holds uniformly for every nonzero direction. Let be an orthonormal eigenbasis of , with , and define
Its dimension is . For any nonzero , write
with coefficients not all zero. Then
(211)
Therefore every nonzero vector in produces positive full growth after mapping back to S. The corresponding representation subspace is
(212) and the invertibility of , together with the full column rank of P, implies
Hence every nonzero direction in the -dimensional subspace undergoes a regime switch.
It remains to show that no larger all-switching linear subspace can exist. The symmetric matrix has exactly positive eigenvalues, since
By the inertia theorem, the maximum dimension of a linear subspace on which the quadratic form is positive for every nonzero vector is exactly the number of positive eigenvalues of . Therefore no linear subspace of dimension greater than can have the property that every nonzero direction switches. This proves that is the effective switching dimension.
Interpretation. The effective switching dimension measures the breadth of the regime-switching phenomenon rather than the number of individual switching directions. Specifically, is the largest dimension of a linear subspace in which every nonzero direction is converted from transport contraction into full-dynamics expansion. This distinction is important: individual switching directions may exist outside , but arbitrary linear combinations of such directions need not themselves switch. Thus, should not be interpreted as the number of linearly independent switching vectors.
When , gating cannot overturn transport contraction anywhere in S. When , there exists an all-switching one-dimensional subspace, but there is no two-dimensional linear subspace in which every nonzero direction is guaranteed to switch. Larger values indicate increasingly broad switching behavior: gating can reverse transport contraction uniformly over a higher-dimensional region of representation space rather than only along specially selected directions.
This distinction also has a practical interpretation. A small indicates that routing-induced reversal is geometrically narrow, so an intervention or perturbation must be well aligned with a specific portion of representation space to benefit from the effect. A large , in contrast, indicates that an entire higher-dimensional family of perturbations is guaranteed to undergo the same contraction-to-expansion reversal. The quantity can therefore be used as a measure of how broadly routing-induced sensitivity or controllability is distributed across representation space, and can support comparisons across layers, heads, or model architectures.
A simpler sufficient no-switch condition can also be obtained without forming the whitened operator explicitly. Since and , the condition implies for every , and therefore rules out regime switching throughout . This bound is generally more conservative than the exact spectral criterion, but makes the competition between the largest gating correction and the weakest transport contraction explicit.
10.5 Robustness to Operator Estimation Error
The previous results are stated for exact local operators. In practice, however, Jacobians and growth operators may be obtained through numerical differentiation, finite samples, or approximate Jacobian-vector products. We therefore ask whether the predicted regime switch remains valid when these operators are only approximately known. The relevant quantity is the margin to the switching boundary: conclusions far from zero directional growth, or far from the spectral threshold 1, remain stable under sufficiently small operator perturbations.
Robustness of an individual switching direction. Let and denote estimated growth operators satisfying
Proposition 3 (Margin-based robustness of regime switching). For any unit direction , if and , then the exact operators satisfy and . Hence the estimated switch is guaranteed to persist under the stated operator errors.
Proof. For the transport operator, write
(215)
Similarly, for the full operator,
(216)
Thus the direction remains contractive under transport-only dynamics and expansive under the full dynamics.
The proposition shows that a regime switch is reliable whenever both signs are separated from zero by more than the corresponding estimation errors. In particular, a strong reversal such as a substantially negative transport growth followed by substantially positive full growth is intrinsically more robust than a switch occurring arbitrarily close to the zero-growth boundary.
Robustness of the spectral switching criterion. The same margin principle applies to the whitened switching operator. Let be an estimate of satisfying
Theorem 4 (Robust spectral certification). Let the eigenvalues of and be ordered nonincreasingly. Then for every . Consequently, certifies the existence of a true regime switch, while certifies that no regime switch exists in . Moreover, the true effective switching dimension satisfies
Proof. Since both W and are symmetric, Weyl's eigenvalue perturbation inequality gives
(217)
for every i. Therefore, if , then
which, by the spectral switching criterion, guarantees the existence of a true regime switch. Conversely, if , then
(219) so no regime switch can occur in S.
For the switching dimension, suppose . Then
so every estimated eigenvalue above corresponds to a true switching mode. This yields the lower bound
Conversely, if , then
Hence every true switching mode must appear among the estimated eigenvalues above , giving
Combining the two bounds proves the result.
The theorem gives a direct interpretation of spectral margin. Eigenvalues far above 1 correspond to switching modes that are stable to substantial operator error, whereas eigenvalues close to 1 are intrinsically ambiguous under finite estimation accuracy. In particular, if no estimated eigenvalue lies within , then the effective switching dimension is exactly identified despite the operator perturbation.
11 EXPERIMENTAL DETAILS AND ADDITIONAL RESULTS
The main experiments in Section 6 establish the central empirical observations: query gating has restricted geometric support, query and key pathways can reverse transport contraction, and spectral operators identify switching directions without direction-by-direction search. Here we examine what those headline results do not fully resolve. We first clarify the operating-point and measurement protocol, then use additional directional counterfactuals to identify how a switch is produced. We subsequently examine what a severity certificate does and does not establish, quantify the interaction between the gating pathways in extreme directions, and report the search budgets and projection sensitivities that limit the interpretation of the experiments. Throughout, the reported properties are local to the tested operating points and perturbation subspaces.
11.1 Models, Datasets, and Operator Estimation
Operating points and local operators. We use pretrained GPT-2 Medium, Gemma-2-2B, Llama-3.2-1B, and Qwen2.5-0.5B with inputs from the WikiText-2 validation set. Detailed mechanism and severity measurements use a selected operating point in layer 23 of GPT-2 Medium. The cross-architecture experiment instead probes several layers of each model, as specified in Section 11.6. We analyze residual self-attention sublayers and construct transport, query-gating, and key-gating Jacobians , , and using the decomposition in Appendix 9.4 and the architectural extensions in Appendix 9.7. The common residual pathway is included consistently in transport-only and full-attention comparisons. Unless otherwise specified, .
What is evaluated. For a perturbation direction v, we compare the quadratic growth forms , , , and , corresponding to the transport-only, transport-plus-query, transport-plus-key, and complete Jacobians. Their signs specify switching status and pathway sufficiency; differences between the values quantify how far a direction lies from a growth-sign boundary. Analytical Jacobians are checked against automatic differentiation and finite-difference or finite-forward evaluations. Restricted growth and switching operators are formed in the chosen perturbation subspace and analyzed by symmetric eigendecomposition. Experiments were performed on an NVIDIA A100 GPU with 40 GB of memory. These measurements concern local residual-attention dynamics, not end-to-end changes in model predictions.
11.2 Anisotropic Dynamics and Routing Mechanisms
What the attended representations actually contribute. The main paper tests the support condition for query gating in Figure 4. A separate issue is how to interpret the attended representations from which that support is constructed. For the selected head, we center the token representations at their attention-weighted mean and visualize a three-dimensional projection in Figure 10. The points are not weighted equally: their marker sizes and colors encode the attention weights that enter . Consequently, the relevant geometry is not merely the unweighted spread of visible points, but the weighted variation of the attended representations in the original hidden space.
The attended-variation subspace at this operating point has dimension . Thus, Figure 10 shows only a three-dimensional view of a higher-dimensional object. In particular, neither the apparent separation of points in this projection nor the attention weights alone establish which input perturbations lie in the null space of . That question depends on the full operator , as characterized by Proposition 1 and tested in the main paper.
Insight. The attended-representation plot gives a concrete interpretation of the covariance entering query gating, but it is not itself a test of query-gating rank or response. This distinction matters: the attended tokens can exhibit substantial visible variation while a given query perturbation still produces no first-order output response, because the perturbation may miss the transformed support or be annihilated.

Figure 10: Attended-representation geometry. Three-dimensional projection of the centered representations ; marker size and color indicate attention weights . The plot visualizes a selected head, not the full attended-variation subspace.
lated by the output projection. Geometry therefore constrains the available routing response; the sign of representation growth must be determined by its interaction with transport. The next experiment examines that interaction through explicit pathway counterfactuals.
11.3 Empirical Regime Switching and Spectral Validation
Disentangling the pathway conditions. The regime maps in Figure 5 establish that the analytic and finite-forward classifications can agree on a selected slice. Figure 11 provides a more detailed account of the classification itself. Its five columns progressively introduce the growth-sign conditions on the same fixed three-dimensional subspace. First, directions with are excluded from the transport-contraction question. Among the remaining directions, identifies contraction that persists after routing is restored. Switching directions satisfy both and ; the single-pathway counterfactuals then distinguish the mechanism of that reversal.
In particular, the cyan class requires and even though : neither gating pathway suffices individually. By contrast, green and purple directions cross the growth boundary with query or key gating alone, while orange directions cross it under either single-pathway counterfactual. These categories should not be interpreted as independent contributions that sum to full growth; the squared-norm growth operator contains interactions between pathways.
How large are the counterfactual margins? A regime label records a sign, but does not say whether the reversal is marginal or substantial. Figure 12 therefore reports two selected directions. In panel (a), transport growth is approximately -0.963, transport plus query gating reaches 0.006, and full growth reaches 0.289. Query gating is sufficient, but its single-pathway result lies close to the zero-growth boundary. Panel (b) illustrates a different mechanism: transport growth is about -0.967; transport plus query and transport plus key remain negative at -0.184 and -0.952, respectively; yet full growth is positive at 0.072. The sign reversal in panel (b) therefore genuinely requires the joint query-key counterfactual at this operating point. These deliberately selected directions expose possible mechanisms and margins; they do not estimate their frequency in the full representation space.
Experiment 1: Regime-switching geometry on the same sphere
Top row: 1a Analytic growth-operator partition • Bottom row: 1b Finite-forward validation

Figure 11: Progressive classification of local switching regimes. Five columns reveal the conditions defining transport non-contraction (blue), persistent contraction (red), joint query-key necessity (cyan), query-only or key-only sufficiency (green or purple), and either-pathway sufficiency (orange). The top and bottom rows apply analytic and finite-forward tests to the same selected directional slice. The classifications concern counterfactual growth signs, not an additive partition of total growth.

Figure 12: Growth margins under pathway ablations. (a) Query gating alone crosses the zero-growth boundary. (b) Neither query nor key gating alone produces expansion, whereas their joint inclusion does. Bars in each panel evaluate the same perturbation direction under different counterfactual dynamics; dashed lines mark zero growth.
Agreement and its scope. The finite-forward row of Figure 11 reproduces the analytic mechanism partition on the tested slice. The reported held-out evaluation at this selected operating point yields 100% agreement in switch/no-switch and mechanism labels, with an analytic–finite-forward full-growth correlation reported as to the displayed precision. These results support the local Jacobian approximation at the perturbation scale used. They do not certify agreement for arbitrary perturbation magnitudes, other operating points, or directions outside the evaluated slice.
From individual directions to severity-restricted subspaces. The main paper has already established the switching spectrum and effective dimension at this operating point (Figure 8). We retain the spectrum in Figure 13(a) here only as context for the more restrictive experiment in panel (b). The spectrum has and within a 357-dimensional transport-contractive subspace. These quantities certify existence and the dimension of a uniformly switching subspace; they do not measure how much contraction its switching directions reverse.
Panel (b) asks a stronger question: after excluding directions whose transport contraction is weaker than a threshold , can gating still reverse the remaining contraction? The restricted subspaces are nested as increases, so the spectral test is applied to progressively more demanding candidates. The plotted sweep illustrates this restriction, whereas the independently evaluated certificate gives . By Theorem 2, the certified threshold establishes the existence of a switching direction

Figure 13: Switching spectrum and severity-restricted certification. (a) Ordered eigenvalues of , shown for comparison with the severity test; the switching boundary is . (b) Leading eigenvalue of on subspaces constrained to have transport severity at least . The green reference line indicates a separately computed ; the displayed orange sweep does not reach that threshold and is not, on its own, the certificate.
Table 2: Relative-optimal and severe-switch counterfactuals. Directional growth, transport severity, and relative strength at the selected GPT-2 Medium operating point. Values are rounded.
| Direction | ||||||
|---|---|---|---|---|---|---|
| -0.003361 | 5.7437 | -0.002801 | 5.8107 | 0.003361 | 1729.98 | |
| Severe switch | -0.967349 | -0.1842 | -0.952478 | 0.0722 | 0.967349 | 1.07465 |
on which transport removes at least of the incoming squared magnitude. It is a lower bound on the supremal reversal severity, not an estimate that can be read directly from the displayed sweep.
Insight. The mechanism plots and spectral tests answer different questions. The counterfactuals identify how a particular direction crosses zero growth; the spectrum establishes whether switching is possible and how many dimensions can switch uniformly; severity restriction asks how much contraction can still be overcome. Neither a large leading switching eigenvalue nor a high agreement rate alone answers the last question. We next examine the directions selected by relative and absolute optimization and quantify the query-key interaction responsible for a severe reversal.
11.4 Strongest Switching Directions
Two objectives select different perturbations. Corollary 1 identifies the direction maximizing the relative switching ratio , but this ratio is normalized by the contraction that gating must overcome. As discussed in Section 6.3, a large ratio need not represent a severe contraction reversal. Figure 14 and Table 2 provide the operating-point values behind that distinction. The relative optimum achieves with transport severity . The numerically identified severe-switch direction instead has and . Thus, a ratio only slightly above the switching threshold can correspond to overcoming far stronger transport suppression than the direction maximizing the ratio.
Why the severe switch requires both gating pathways. The numerical contrast becomes more informative when we inspect the counterfactual growth values in Table 2. For , transport plus query gating already produces positive growth (5.7437), while transport plus key gating remains negative (-0.002801). Query gating is therefore sufficient for this direction. For the severe direction, both single-pathway outcomes remain negative, and , whereas . The combined pathways cross zero where neither does alone.
RELATIVE STRENGTH DOES NOT MEASURE REVERSAL SEVERITY
Same operating point · two different optimization objectives
a Relative switching strength

b Absolute reversal severity

Full growth : 5.8107 (relative optimum) | 0.0722 (max-severity switch)
Certified lower bound coincides with the numerical maximum at the shown precision.
Figure 14: Relative strength and absolute contraction severity. (a) Relative switching ratios for the relative optimum and a numerically identified severe switch (logarithmic axis; dashed line at ). (b) Fractions of incoming squared magnitude removed by transport for the same directions. The green reference marks . The two panels compare different objectives, not two estimates of the same quantity.
The growth decomposition lets us go further than the sign labels. Because , the interaction between query and key gating can be isolated from the four counterfactual evaluations:
(224)
For the severe direction, the values in Table 2 yield a positive query–key interaction of approximately 0.2415. Indeed, including the key pathway on top of transport plus query changes growth by about 0.2564, of which approximately 0.2415 comes from this cross term. This makes the joint mechanism more precise: the severe switch is not explained by adding two independent single-pathway growth improvements. It depends substantially on their interaction in the full quadratic growth operator.
What the severity comparison certifies. Theorem 2 and the definition of imply . At this operating point, the reported certificate and numerical severe-switch value are both close to 0.967349. Their agreement is specific to the computation; it does not establish the identity for arbitrary operators, nor does a relative optimum generally solve the absolute severity problem.
Insight. The important distinction is not merely that the two optima have different values. They probe different mechanisms: the relative optimum can succeed through query gating against almost neutral transport, while a severe reversal can require a positive query–key cross interaction to rescue a direction that both single-pathway counterfactuals still suppress. Thus, relative strength measures a ratio, absolute severity measures the contraction overcome, and pathway ablations identify the mechanism of rescue. Conflating these three questions can make a spectrally strong switch appear more substantial than it is.
11.5 Cost of Theory-Free Search
Ordinary switches versus severe switches. Figure 9 in the main paper compares blind finite-forward search, random sampling with oracle access to the transport-contractive subspace S, and spectral guidance. The underlying budgets clarify what the comparison establishes. In the reported experiment, blind ambient-space sampling finds no switch among 8192 tested directions. When sampling is restricted to S, 2928 of 4096 directions switch (approximately 71.5%), but none reaches severity ; the best sampled severity is only about 0.0718. These outcomes should not be interpreted as estimates of a zero ambient-space switching probability or of the probability of recovering an extreme direction. They instead show that making the search subspace favorable can render ordinary switches easy to find without making severe switches easy to recover within the tested budget.
(a) Relative switching strength

(b) Effective switching dimension
Figure 15: Projected spectra across architecture and depth. (a) Median leading switching eigenvalue and the threshold. (b) Median normalized effective switching dimension within the retained probe subspace. Shaded interquartile bands summarize variation across the sampled prompts and are not confidence intervals.
When does spectral preprocessing pay off? The two approaches also have different cost structures. Finite-forward probing incurs work for each candidate direction, whereas spectral analysis incurs an initial operator-construction and eigendecomposition cost and then reuses quadratic forms for additional directional tests. The reported setup time is approximately 0.0492 s, with measured break-even budgets of about 3993 directions for switch detection and 1981 for full mechanism classification. Below these budgets, finite-forward checks can be cheaper; beyond them, reusing the spectral operators becomes advantageous in this implementation. These crossover points depend on the hardware, implementation, operating point, and precisely which evaluations are charged to each method. They are not asymptotic complexity guarantees.
Insight. Spectral guidance provides two distinct benefits, and neither should be overstated. It identifies a direction satisfying a global spectral criterion within the specified subspace instead of hoping that random samples approach an extreme direction; and, after preprocessing, it amortizes the cost of evaluating many directions. The former addresses a search-quality limitation; the latter is a query-budget trade-off. Faster evaluation for large budgets does not imply that spectral preprocessing is always preferable for a single perturbation.
11.6 Cross-Architecture Switching and Probe Sensitivity
What the cross-model comparison actually samples. The architecture-level trends summarized in Section 6.4 are based on projected, local measurements rather than full hidden-space spectral decompositions. For each of GPT-2 Medium, Gemma-2-2B, Llama-3.2-1B, and Qwen2.5-0.5B, we use two WikiText-2 validation prompts, the final token, and seven normalized depth positions, with a 64-dimensional random orthonormal probe subspace. Accordingly, the quantities below characterize the projected transport-contractive region at those operating points. This protocol matters when interpreting differences across architectures, particularly for statistics normalized by the dimension of the retained contractive subspace.
Spectral strength is not switching-subspace size. Figure 15 compares two summaries of the projected switching operator. The leading eigenvalue in panel (a) measures the strongest relative growth correction, whereas panel (b) measures the fraction of retained contractive dimensions that support uniform switching. The two statistics vary differently with model and depth: a large leading eigenvalue need not accompany a large normalized switching dimension. Neither panel shows a common monotonic depth law. This is an important qualification of cross-model comparisons based on one spectral summary alone.
Mechanism frequencies. Figure 16 expands the aggregate mechanism comparison in Figure 6(b). Among the sampled switching directions, query-only sufficiency accounts for approximately 79.5% in GPT-2, 90.2% in Gemma, 82.6% in Llama, and 87.5% in Qwen. Joint query-key switching occurs in every evaluated family, but its proportion and those of the other pathway classes vary. The
Routing mechanisms of contraction reversal

Fractions reconstructed from the draft figure/text; categories are conditional on switching directions.
Figure 16: Mechanism composition among projected switching directions. Fractions are pooled over the sampled switching directions within each architecture. Query-only, key-only, joint query–key, and either-pathway-sufficient classes are disjoint under the specified counterfactual tests. Fractions are conditional on full-dynamics switching and are not ambient-space probabilities.
(a) Spectral strength

(b) Switching dimension
(c) Mechanism prevalence
Figure 17: Probe-dimension sensitivity of projected switching statistics. Nested orthonormal probe spaces of dimensions 32, 64, 128, and 256 are evaluated at matched model–prompt–depth operating points. (a) Median projected ; (b) median normalized effective switching dimension; (c) median query-sufficient fraction among sampled switches. Shaded regions indicate interquartile ranges across operating points, not confidence intervals or convergence guarantees.
query-heavy composition is conditional on switching, the selected prompts, and the query-token perturbation protocol; it does not imply that query gating causally dominates other pathways for arbitrary tokens, layers, or inputs.
Sensitivity to probe dimension. The projected measurements above leave a final methodological question: would the same numerical summaries be obtained using a different probe dimension? Figure 17 repeats the analysis using nested orthonormal probe spaces of dimensions 32, 64, 128, and 256 at three normalized depths and two prompts per architecture. Increasing the probe dimension generally raises the projected leading eigenvalue, consistent with making more directions available to the restricted spectral problem. However, the normalized effective switching dimension and the fraction of query-sufficient sampled switches also change, and need not stabilize at the same rate. In particular, the experiments do not establish convergence to full-space switching statistics at dimension 256.
Insight. The cross-architecture results support the applicability of the same local mechanism and spectral tests to several Transformer families, but they do not establish architecture-independent switching frequencies or universal depth laws. The sensitivity experiment explains why: a larger probe can reveal stronger projected switching modes while changing the apparent size and pathway composition of the switching set. Consequently, claims about the existence of local switching within a measured subspace are firmer than claims about its prevalence in the full hidden space. Broader prompt sampling, other token positions, and more extensive probe convergence tests would be needed to strengthen the latter claims.