A while ago I ran a small experiment based on an interpretability paper by Bick et al.: take a pretrained LLM, cut out some of its layers, and see what happens to downstream scores. In my naive understanding of deep neural networks, I assumed that the model would fall apart and performance completely degrade. But it gracefully lowered and sometimes not even at all.

Downstream scores after pruning layers

Figure from Bick et al. (2025).

You see have knowledge scores lower gracefully with every layer being gradually pruned? For MMLU it even stays constant until layer 17 (which means all leayers from 31 to 17) are removed completely?

That result bugged me for a while, because it does not fit the picture most of us (at least me) carry around. We draw a neural network as a pipeline of functions calling functions: layer 1 transforms the input and hands it to layer 2, which transforms it again, and so on. Rip one function out of the middle of a call chain and the program should crash.

A different picture fits the result much better. There is one hidden state per token, and every layer reads from it and adds something back to it, so the layers are enrichers of a shared state. That shared state is the residual stream. The more I read about current architecture research, the more it looks like a lot of the interesting work is happening right there: Hyper-Connections, DeepSeek’s mHC, Kimi’s Attention Residuals and looped models are all proposals for how this stream should work.

So this post is a small appreciation of the residual stream: what it is, why it makes LLMs so robust to surgery, where it falls short, and how recent work tries to fix that.

Chapter 1

Two ways to look at the same network

Every modern decoder-only transformer is built from blocks that look like this (the “Pre-Norm” variant that basically every LLM uses):

\[h_{l+1} = h_l + f_l\big(\mathrm{Norm}(h_l)\big)\]

Here \(h_l\) is the hidden state of a single token entering layer \(l\), and \(f_l\) is either an attention block or an MLP. The \(h_l \,+\) is the crux here: the layer computes an update and adds it on top of the hidden state it got.

If you unroll this recurrence over all \(L\) layers, you get

\[h_L = h_0 + \sum_{l=0}^{L-1} f_l\big(\mathrm{Norm}(h_l)\big), \qquad \text{logits} = W_U \, \mathrm{Norm}(h_L)\]

where \(h_0\) is the token embedding and \(W_U\) the unembedding matrix. The final representation is literally the embedding plus a sum of everything every layer ever wrote. Each layer reads the current state through a normalization and a few linear projections, and writes its result back by addition. The figure below shows both pictures side by side. Try removing a layer.

Figure 1 · Same network, two mental models

In the composition view (A), each function consumes exactly what the previous one produced, so removing one leaves everything downstream with inputs it has never seen. In the residual view (B), removing a layer just deletes one term from the sum. The stream, and everything the other layers wrote into it, is still there.

Mathematically, a residual network is still a composition. Each block is the map \(h \mapsto h + f_l(\mathrm{Norm}(h))\), and the network chains \(L\) of those maps together. Each of these maps is close to the identity, though. When every step is “keep what you have, plus a small edit”, the whole program behaves much more like a sum of edits than like a deep chain of transformations.

Anthropic’s Mathematical Framework for Transformer Circuits (Elhage et al., 2021) made this view popular in interpretability. They describe the residual stream as a communication channel: it does no processing itself, layers communicate with each other only by writing into it and reading from it, and since it is high-dimensional, different layers can use different subspaces without stepping on each other. Attention heads are the only place where information moves between token positions. Everything else happens inside each token’s own stream.

That is why in some literature Attention is generalized to a Token Mixer. There exist now other competitive ones like the Delta Rule Family (GDN; KDA, EDA, etc.) and SSM (Mamba) and the MLP is the Channel Mixer.

Chapter 2

Why you can cut an LLM and it keeps working

Many paths instead of one

A nice way to see why residual networks tolerate missing layers comes from Veit et al. (2016), who looked at ResNets for image classification. Write each block as \((I + f_l)\) and multiply out the product for three layers:

\[(I + f_3)(I + f_2)(I + f_1) = I + f_1 + f_2 + f_3 + f_2 f_1 + f_3 f_1 + f_3 f_2 + f_3 f_2 f_1\]

Every term is a path through the network that either visits a layer or skips it. With \(L\) layers there are \(2^L\) paths, and most of them have a length around \(L/2\). (This expansion is exact if the \(f_l\) are linear. With nonlinear layers it’s only an intuition, though a useful one.)

Now delete one layer. In a plain network without skip connections, there is exactly one path, and it is gone. In a residual network, you lose the half of the paths that went through that layer, and the other half, with exactly the same distribution of lengths, is untouched.

Figure 2 · Paths through a residual network

Number of paths of each length in the unrolled view of an L-layer residual network (a binomial distribution). Deleting a layer removes the dashed half of the paths. The surviving paths have the same shape, shifted by at most one. Veit et al. showed that deleting single blocks from a trained ResNet barely changes its error, while doing the same to a VGG network sends it to chance.

The same holds for LLMs

For LLMs, several papers found the same thing, and more extreme than I would have guessed:

  • The Unreasonable Ineffectiveness of the Deeper Layers (Gromov et al., 2024) removes contiguous blocks of layers from open-weight models such as Llama-2-70B and reports minimal degradation on question-answering benchmarks until a large fraction, up to roughly half, of the layers are gone (with a small QLoRA “healing” step after pruning). They choose which block to cut by the angular distance between a block’s input and output: if the stream barely changes direction across a block, that block is a good candidate.
  • ShortGPT (Men et al., 2024) uses a similar score (“Block Influence”, one minus the cosine similarity between a layer’s input and output) and finds a lot of redundancy in the layers of LLMs.
  • The Remarkable Robustness of LLMs: Stages of Inference? (Lad et al., 2024) deletes and swaps adjacent layers and finds the models keep most of their prediction accuracy without any fine-tuning. Swapping two layers in a call chain should be fatal, while swapping two edits to a shared state often does little.

In all of these, the first and last layers are the exception. They turn tokens into features and features back into a next-token distribution, and removing them hurts a lot. The redundancy sits in the middle and later layers.

You can read the stream mid-way

There is another hint that the stream is a shared workspace. You can take the hidden state after any intermediate layer, push it through the final norm and unembedding, and get a reasonable next-token distribution. This is the logit lens (nostalgebraist, 2020). Predictions start vague and get sharper as you go deeper, as if every layer refines a running guess. The tuned lens (Belrose et al., 2023) shows that a small learned affine map per layer does even better, so the representation does drift a bit across depth. Still, a (nearly) shared readout working at all means the layers write into roughly the same space.

Chapter 3

The downside of one shared lane

Every layer writes into the same vector with a fixed weight of 1, and nothing is ever removed, so the stream keeps growing with depth.

With Pre-Norm this has a specific side effect. Each layer reads a normalized version of the stream, so it does not see the growing magnitude, but it writes an unnormalized update into it. As the stream gets bigger, a write of a given size becomes a smaller and smaller relative change. The Attention Residuals paper calls this PreNorm dilution: hidden-state magnitudes grow as \(O(L)\) with depth and progressively dilute each layer’s contribution, and later layers have to learn larger outputs to get any influence over the accumulated state.

The toy below shows the mechanism. Every layer writes a vector of the same size into a 256-dimensional stream. If the writes point in random, unrelated directions, the stream grows like \(\sqrt{L}\). If they share a common direction, it grows like \(L\). Either way, a deep layer’s write ends up being a small fraction of what is already there.

Figure 4 · Toy model of stream growth (not a real model)

Each of 32 layers adds a unit-length vector to the stream. The slider sets how much the writes share a common direction. Top: norm of the stream after each layer, with √L and L for reference. Bottom: size of each layer's write relative to the stream at the moment it is written.

This ties back to the pruning results. If a deep layer’s write only nudges the stream, the angle between that layer’s input and output is small, and removing it changes little. Gromov et al. and ShortGPT use exactly this angle to decide what to cut. So some of the “redundant” layers might just be layers that the architecture doesn’t let speak loudly enough.

The AttnRes paper lists two more limitations of a single additive lane. A layer can only see the mixture of everything before it, never the individual contributions, so there is no way to selectively retrieve, say, what layer 3 wrote. And attention and MLP layers have to read the same mixture, even though they might benefit from different weightings.

Chapter 4

Engineering the stream

What if the network could learn how the stream works? The recent proposals answer three different questions: how wide the stream should be, how layers read from it, and how often they write into it. Click through the diagrams first, then I’ll go through each one.

Figure 5 · Ways to wire the residual stream

Standard residual: \( h_{l+1} = h_l + f_l(\mathrm{Norm}(h_l)) \). One lane, every write has weight 1.

Hyper-Connections: \( x_{l+1} = H^{\mathrm{res}}_l x_l + {H^{\mathrm{post}}_l}^{\top} F(H^{\mathrm{pre}}_l x_l) \) with \( x_l \in \mathbb{R}^{n \times C} \). The stream is \( n \) lanes wide. \( H^{\mathrm{pre}} \) mixes the lanes into the layer input, \( H^{\mathrm{post}} \) distributes the output back, and \( H^{\mathrm{res}} \) mixes the lanes with each other. The mixing weights in the diagram are random, for illustration.

mHC: the same wiring, but \( H^{\mathrm{res}}_l \) is projected onto the doubly stochastic matrices (all rows and columns sum to 1, all entries non-negative) with Sinkhorn-Knopp. Mixing can move signal between lanes, but it cannot amplify or cancel it.

Attention Residuals: \( h_l = \sum_{i=0}^{l-1} \alpha_{i \to l}\, v_i \) with \( v_0 = h_1 \) (the embedding), \( v_i = f_i(h_i) \), and \( \alpha_{i \to l} = \mathrm{softmax}_i\big(w_l^{\top} \mathrm{RMSNorm}(v_i)\big) \). Each layer attends over all previous layer outputs with its own learned query \( w_l \). The weights shown are illustrative, shaped like the pattern the paper reports: most weight on the previous layer, some on the embedding.

Looping: a block \( R \) with shared weights is applied \( T \) times, each time reading the stream and writing a refinement back. Depth (compute) grows with \( T \), the parameter count does not.

Wiring diagrams, simplified. Normalization layers are omitted.

Hyper-Connections: make the stream wider

Hyper-Connections (Zhu et al., ByteDance, ICLR 2025) replace the single residual vector with \(n\) parallel copies, an \(n \times C\) matrix instead of a \(C\)-dimensional vector. Each layer gets three small learnable mappings: one that mixes the \(n\) lanes into the layer’s input, one that spreads the layer’s output back over the lanes, and an \(n \times n\) matrix that mixes the lanes with each other:

\[x_{l+1} = H^{\mathrm{res}}_l \, x_l + {H^{\mathrm{post}}_l}^{\top} \, F\big(H^{\mathrm{pre}}_l \, x_l,\; W_l\big)\]

The layers themselves still see a normal \(C\)-dimensional input, so the expensive part of the model does not change. What changes is that the stream now has more room, and the network can learn how strongly each layer’s output is mixed in and where it goes. With \(n = 1\) and all mappings set to 1, you get the standard residual back.

mHC: make it wider, safely

The problem with Hyper-Connections shows up at scale. DeepSeek’s mHC: Manifold-Constrained Hyper-Connections (December 2025) points out that if you unroll HC over many layers, the signal from an early layer reaches a late layer multiplied by the product \(\prod_l H^{\mathrm{res}}_l\). In a standard residual this product is the identity, which is exactly what gives you the stable “gradient highway”. With unconstrained matrices, nothing keeps this product near the identity. In their 27B model they measure the maximum gain of this composite mapping and see peaks around 3000, along with a loss spike during training.

Their fix is elegant: constrain every \(H^{\mathrm{res}}_l\) to be doubly stochastic, meaning non-negative with every row and every column summing to 1. Such a matrix can only redistribute signal between lanes. Its spectral norm is at most 1, and a product of doubly stochastic matrices is again doubly stochastic, so the constraint holds across arbitrary depth. They get there with the classic Sinkhorn-Knopp algorithm: exponentiate the raw matrix, then alternately normalize columns and rows (20 iterations in the paper). \(H^{\mathrm{pre}}\) and \(H^{\mathrm{post}}\) are kept non-negative with sigmoids to prevent signals from cancelling each other.

Figure 6 · Sinkhorn-Knopp and why the constraint matters

Left: a random positive 4×4 matrix. Each Sinkhorn step normalizes the columns, then the rows. Sums that are not yet 1 are highlighted. Right: a toy version of the depth problem. The gain (max absolute row sum) of a product of 60 random near-identity 4×4 matrices, unconstrained versus Sinkhorn-projected. The projected product stays at 1 (up to Sinkhorn's finite-iteration error), while the unconstrained one drifts by orders of magnitude. In the real 27B model, mHC brings the composite gain down from about 3000 to about 1.6.

With \(n = 4\) lanes, mHC adds about 6.7% training time. On their 27B model it beats both the baseline and HC on most benchmarks. BBH, for example, goes from 43.8 (baseline) and 48.9 (HC) to 51.0, and MMLU from 59.0 and 63.0 to 63.4.

Attention Residuals: let each layer choose what to read

Kimi’s Attention Residuals (March 2026) attacks a different part of the problem. Their observation is that the residual recurrence over depth looks a lot like an RNN over time: all prior information gets compressed into a single state \(h_l\), combined with fixed weights. Transformers fixed this problem for the time dimension by replacing the recurrence with attention. AttnRes does the same for depth:

\[h_l = \sum_{i=0}^{l-1} \alpha_{i \to l} \, v_i, \qquad v_i = \begin{cases} h_1 & i = 0 \\ f_i(h_i) & i \geq 1 \end{cases}, \qquad \alpha_{i \to l} = \frac{\exp\!\big(w_l^{\top} \mathrm{RMSNorm}(v_i)\big)}{\sum_{j=0}^{l-1} \exp\!\big(w_l^{\top} \mathrm{RMSNorm}(v_j)\big)}\]

Instead of receiving the sum of everything, each layer attends over the individual outputs of all previous layers (and the embedding). The query \(w_l\) is a single learned vector per layer, so the extra parameters are tiny. The RMSNorm on the keys stops layers with large outputs from dominating the weights, which directly targets the dilution problem from Chapter 3. A nice detail: the \(w_l\) are initialized to zero, so at the start of training every layer averages its sources uniformly, and the model learns to become selective from there.

Keeping every layer output around costs \(O(Ld)\) memory per token, which becomes a problem with pipeline parallelism at scale. Block AttnRes groups the layers into \(N\) blocks, sums outputs within a block as usual, and only attends across block summaries, which brings memory down to \(O(Nd)\). With \(N = L\) you get full AttnRes back. With \(N = 1\) you’re back to a standard residual. About 8 blocks recover most of the gains.

In their scaling experiments, Block AttnRes matches the loss of a baseline trained with 1.25× more compute, and they integrate it into Kimi Linear (48B total, 3B active parameters, 1.4T tokens) with improvements on all evaluated benchmarks. Their comparison table also includes mHC, and it lands at almost the same loss as AttnRes at every model size, which I find interesting given how different the two ideas are.

Looping: write into the stream more often

If the layers are refinement steps on a shared state, why use each set of weights only once? Looped (or recurrent-depth) models apply the same block several times, so every iteration reads the stream and writes another refinement into it. Depth becomes something you can choose at inference time instead of a fixed property of the checkpoint.

The idea is old (Universal Transformers, Dehghani et al., 2019), but it has recently been scaled to LLMs:

  • Recurrent Depth (Geiping et al., 2025) splits the model into a prelude, a recurrent core, and a coda. The core is iterated a randomly sampled number of times during training and re-receives the input embedding at every step, so at test time you can run more iterations on harder problems and scale compute without generating more tokens.
  • Ouro (Zhu et al., ByteDance, 2025) loops a weight-tied stack (Ouro-1.4B runs its 24 layers 4 times) and learns an early-exit gate so easy tokens can stop sooner. The 1.4B and 2.6B models are reported to match much larger non-looped models, up to 12B, on a wide range of benchmarks. Their analysis fits the “enricher” view nicely: looping leaves the amount of knowledge the model can store unchanged (about 2 bits per parameter either way) and substantially improves how well the model can manipulate the knowledge it has.

Looping makes far more sense in the residual-stream picture than in the call-chain one. Feeding a function its own output again is a strange thing to do, but applying another edit to a shared state is natural. It’s the model’s version of think about this a bit longer.

Chapter 5

The backbone

Here is how I think about an LLM now. There is a stream, one vector per token, that starts as an embedding and ends as a prediction. Layers sit on top of it. They read from it, compute something, and leave a note in it. Attention layers can read other tokens’ streams, MLPs only their own. Nobody ever erases anything.

Seen this way, the results from the start of the post stop being surprising. Removing a middle layer removes a few notes from a long document that many other layers have written into. The order of the notes matters less than you’d think. And reading the document halfway through already gives you a decent idea of where it is going.

The four directions in Chapter 4 fit into the same picture:

  What it changes about the stream Main idea
Hyper-Connections width \(n\) lanes with learned mixing
mHC width, kept stable mixing restricted to doubly stochastic matrices
AttnRes how layers read softmax attention over all previous layer outputs
Looping how often layers write reuse the same weights for more refinement steps

The transformer gets most of the credit for modern LLMs, and attention gets most of the credit inside the transformer. The part that holds everything together and lets us stack a hundred layers, cut out a dozen, swap a few, peek in halfway, or loop the whole thing, is a humble x + f(x) from a 2015 image classification paper. It’s nice to see it finally getting some attention of its own.


References