arXiv:2610.18104cs.LGOct 2026

Manuscript Offprint

arXiv:2610.18104

The Effect of Layer Ordering in Hybrid Architectures

John Cooper, Mingchen Ma, Jiaqi Mo, Shengqi Qiu, Nathaniel Bastian, Ilias Diakonikolas, Frederic Sala

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Hybrid attention is rapidly becoming the dominant architectural choice for frontier models. Despite their successes, such architectures complicate model design by introducing additional choices, including the types and locations of layers. This combinatorially large design space has been studied empirically, but given the vast expense of training and evaluating models with different configurations, a principled understanding of the effects of layer selection and ordering is needed. We provide the first such analysis, showing that the dominant hybrid architecture is highly task-specific. Concretely, for any layer configuration, we prove that there exists a task where we can construct a model with this configuration that provably outperforms any other model of any different configuration under fixed resource constraints. Empirically, we observe that for standard training, learned hybrid architectures exhibit separations between layer orderings that match our theoretical findings. For instance, under the same memory budget, the optimal architecture predicted by our theory for a segmented retrieval task consistently achieves perfect accuracy, whereas the next strongest plateaus below 0.5. These results extend to deeper models, where “containing” the dominant architecture for a task indicates whether the model attains high performance. In addition, we investigate the mechanisms learned by hybrids, observing that Transformer layers contribute the largest share of performance on associative recall across architectures. This work establishes insights into task-dependent hybrid architecture design relevant to the training and scaling of frontier-scale hybrids. 1^{1}

1 Introduction

Hybrid architectures have become the design of choice for frontier models [20, 25, 12]. This is due to their superior scalability: the quadratic complexity of full self-attention limits the vanilla Transformer architecture on long-context tasks [11, 24]. Hybrid models replace many self-attention layers with efficient subquadratic alternatives that require smaller memory and offer faster inference. Popular choices include state-space layers like linear attention, Mamba, Gated DeltaNet, etc. [8, 32]. The use of these layers produces scalable and highly-performant models.

However, as each layer can be selected from among many variations, layer selection and ordering is a critical design challenge [32, 8, 10]. Indeed, each layer type brings different constraints when processing

∗^{*}Equal contribution. Authors listed in alphabetical order.

1^{1}Code is available at https://github.com/SprocketLab/layer-importance.

Figure

Figure 1: Structure of tasks that exhibit performance differences among different hybrid architectures. Large gaps need SSM layers to communicate each segment's query, while the dense computation per segment is done by the Transformers.

sequences: full-attention is memory-bound by retrieval distance while recurrent alternatives are bound by their state size. The most popular layer ordering among frontier models uses a block design that involves one softmax-attention layer followed by many subquadratic layers. This is supported empirically [29]. While some work has investigated the selection ratio between softmax-attention and linear attention [30, 7] and others have shown a theoretical separation with hybrids utilizing less memory [6], the benefits and drawbacks of various layer orderings are still unclear. Given the combinatorially large space of different layer orderings, a complete empirical sweep across architectures is intractable.

A theoretical characterization of hybrid architectures would cut down on this combinatorial space. However, identifying differences between hybrid layer orderings is highly challenging. Tasks can be solved by a variety of algorithms, each best suited for a different hybrid architecture. For instance, the greatest difficulty stems from processing order: some architectures focus on reordering the sequence in early layers to allow for a few later layers to solve the task. These shortcuts can reduce model size and depth compared to more direct algorithms with sequential processing.

In this work, we obtain a new theory-driven approach to hybrid architecture design. Inspired by [6], we study the expressivity of different hybrid architectures under computational resource constraints. We identify tasks and associated architecture designs where no other design (i.e., layer ordering) is able to solve the task under identical constraints. We begin by abstracting full-attention (TF) and sub-quadratic attention variants as generalized windowed functions and generalized state-space models (SSMs), respectively. This allows us to focus on the critical elements constraining layer types: the window width, state size, and embedding precision. For a given layer ordering of generalized SSMs and generalized causal windowed models, we show there exists a task and hybrid architecture such that any architecture deviating from the provided one must use more resources at some layer. This indicates that large-scale hybrid architecture design is situation-specific; in other words, structural properties of a desired task determines the optimal hybrid architecture.

In addition, we zoom in on 2- and 3-layer hybrid architectures to characterize and expand the set of such separating tasks. These tasks are natural, mirroring behaviors found in real-world natural language scenarios. Specifically, we establish tasks where the TF → SSM (TS) and TF → SSM → TF (TST) architectures are resource optimal. The task for TST supplies a natural task that requires layer alternation in a hybrid design. For these tasks, we show a separation in learnability between different layer orderings. By modifying the context window for the Transformers and varying the state in Mamba, we constrain the memory of these hybrid under some fixed budget. We empirically show that the learned hybrids exhibit identical separations as predicted theoretically. For segmented retrieval (designed for the TS architectures) and the TST task, we observe a phenomenon crucial for large-scale design: on hybrids of depth 4 and depth 5, containing TS or TST as a sub-architecture determines performance. This suggests that such “containment” is important in deep hybrids.

We empirically study such deeper hybrids as well. We find that a TS architecture achieves higher performance than all ST architectures for this task. Mechanistically, through linear probing, we observe that the top-performing model, TTSSSSSS, shows a slow increase in decodability in its SSM layers which are not seen in TTTSSSSS. This supports that hybrid design is nuanced, as slightly different architectures fail to use their SSM layers to improve performance.

The paper is structured as follows. In Section 2, we begin with proving that there are tasks and resource constraints for any hybrid architecture that any other architecture must violate. For shallow hybrids, we establish a natural task family capturing important operations in natural language. In Section 3, we experiment on these natural tasks, identifying that these separations appear for learned hybrids. Lastly, in Section 4, we experiment on 8-layer hybrids on associative recall, observing that mildly different architectures have drastically different performances.

References (26)