↓ Skip to main content
Rewirable Circuits in Transformers with Loom Attention
  1. Archive/
  2. Weekly CS Paper Digest — 21 – 27 November 2026/

Rewirable Circuits in Transformers with Loom Attention

Author
AI Assistant
Curated for Pradithya Aria Pura · AI-written summary of the source material

Weekly Paper Notes — one of the top picks from the 2026-11-28 CS paper digest. Area: AI / ML.

Authors: Da Xiao (Beijing University of Posts and Telecommunications), Qingye Meng, Shengping Li, Xingyuan Yuan (ColorfulClouds Technology) arXiv: 2611.30634 · PDF · Code

TL;DR
#

Mechanistic interpretability describes a Transformer as circuits. One head writes a feature into a subspace of the residual stream, and a later head reads it into its query, key or value. Attention lets a head choose which tokens to read from on every input. Which earlier heads it reads from is set by the product of two trained projection matrices, so it’s fixed after training. The only per-token control a model has is to switch a head off by pointing its attention at a sink token.

This paper formalizes that limitation and removes it. It defines a per-token wiring matrix between earlier head outputs (writers) and later head inputs (readers), proves that a pre-LN Transformer’s wiring matrix is always rank one, and shows that realizing arbitrary writer-to-reader patterns that way would need on the order of one head per earlier writer for every reader. Loom attention lets each head attend over earlier heads’ outputs at the same token, through a small per-token matrix memory M that heads write to and read from with generated keys and queries. M becomes a second residual stream, and the wiring can reach rank 2n.

The resulting LoomFormer costs 2.0–3.7% extra FLOPs. In scaling runs it matches a Transformer++ trained with about 3.2× the compute and the best recent residual-stream variants (mHC, AttnRes, MUDDFormer, DHC) trained with 1.7–2.8×. LoomPythia-2.8B, trained on the same 300B Pile tokens as Pythia, matches Pythia-12B zero-shot and beats it five-shot.

What problem is the paper actually attacking?
#

The first author’s earlier work is the lineage here. DCFormer (ICML 2024) composed attention heads dynamically, and MUDDFormer (2025) replaced the residual connection with input-dependent, depth-wise attention over all earlier layers, separately for the query, key, value and residual inputs. They belong to a broader 2025–26 push to enrich the vertical path through a Transformer. DenseFormer averages earlier layers’ outputs. Hyper-Connections (HC) keep several residual streams with learned mixing. DeepSeek’s manifold-constrained HC (mHC) projects that mixing onto doubly stochastic matrices to keep training stable at scale, and Kimi’s Attention Residuals (AttnRes) attend over previous layers.

The paper’s complaint is that all of these act at layer granularity. By the time a layer’s output reaches the vertical channel, every head’s output has already been summed into one hidden vector. A later head can’t single out one earlier head, and the vertical and horizontal flows “run side by side, never woven together.”

To make that precise, the paper calls a head’s output a writer and its Q, K and V inputs readers. Writer i reaches reader j through the fixed virtual weight C̄_ij = W_i^O W_j^s, the product of the output projection and the input projection. At a given token, reader j receives

u_j = Σ_i  o_i · c_ij · C̄_ij

where the scalars c_ij form a per-token wiring matrix C. In a pre-LN Transformer the only per-token control is gating whole heads, so C = g g′ᵀ, an outer product of two gate vectors. Rank one. The paper calls this node-gated: you can turn writers and readers on or off, which connects a rectangle of pairs, but you can’t connect W1→R1 and W3→R3 without also connecting W1→R3 and W3→R1.

Effective wiring for three patterns. A dense-weight Transformer connects only rectangles and its circuits interfere; a sparse-weight one leaves some pairs unreachable; LoomFormer connects exactly the requested pairs.
The paper’s Figure 3. Node gating either leaks into unwanted pairs (dense virtual weights) or can’t reach some pairs at all (sparse ones). Source: Xiao, Meng, Li, Yuan — arXiv:2611.30634.

Theorem 2.4 then asks what it costs to work around this by adding heads. If each of r readers must pick one of w writers independently at every token, a node-gated architecture needs at least N(w, r−1) heads per reader. That’s the minimum ground-set size of a cover-free family (Kautz and Singleton, 1964), which is Θ(w) at practical model sizes. Spending heads doesn’t solve the problem cheaply.

The mechanism: a matrix stream along depth
#

The direct fix is naive loom attention. Every reader attends over the outputs of all earlier heads at the same token, with weights generated from the token. That gives full-rank wiring, but generating those weights costs about (3/2)·n²·L²·D parameters and multiply-adds per token, which rivals the whole model.

LoomFormer borrows linear attention’s trick, applied along depth instead of along the sequence. Each token carries a matrix memory M ∈ R^(d_k × d) of d_k slots, each one head wide. Writer i writes its output with a generated key, and reader j reads with a generated query:

vector stream:  u_j = x W_j^s        Δx = o_i W_i^O
matrix stream:  u_j = q_j^m M        ΔM = k_i^m ⊗ o_i

A read now costs d_k slots regardless of depth, and because M accumulates layer by layer it acts as a second residual stream. The ports also swap shape. A vector-stream port is a D × d projection matrix, fixed after training. A matrix-stream port is a length-d_k vector, small enough to generate per token from the vector stream. So the vector stream carries control (which slots to write and read, and which tokens to attend to), and the matrix stream carries the content that attention moves.

LoomFormer architecture: the model with vector and matrix residual streams, the LoomMHA and FFN sub-layers, and the MRead and MWrite modules.
The paper’s Figure 4. Reads from M are red, writes blue. The value fed to horizontal attention comes from M only. Source: Xiao, Meng, Li, Yuan — arXiv:2611.30634.

The read and write modules generate their ports from a shared low-rank GELU feature of x. Each port is RMS-normalized and then scaled by a sigmoid gate, so the normalized vector picks which slots and the gate alone sets how much. A static learned query is added alongside the dynamic one.

Inside the attention sub-layer (LoomMHA), each head reads four vectors from M: a query, a key, a value and an output bypass. The query and key are concatenated with small RoPE’d projections from the vector stream (d/4 wide), which handle position. Horizontal attention is strictly causal and excludes the current token, whose own content reaches the output through the bypass instead. Every head’s output is then written back to M for later layers.

The FFN sub-layer gets a second, smaller FFN whose output is split into head-sized vectors and written into M. After the embedding, this is the only path from the vector stream into M, since attention only moves content it read from M. A last piece, MShift, mixes in the previous token’s M through a per-slot gate, so a head can reach the previous token without attending to it.

Defaults are d_k = 2n slots, so M is the size of two hidden vectors, with FFN widths adjusted so parameter count matches a Transformer.

Proposition 3.1 is the cleanest statement of what the design buys. With ports frozen, LoomFormer is a standard Transformer with a bigger residual stream, and so still node-gated. With ports generated per token, it’s rewirable at one head per reader for any pattern that uses at most d_k writers. The capacity comes from generating ports per token, not from the memory itself. The paper’s analogy is a mixture of experts whose “experts” are wirings that share every other weight and cost d_k numbers each to select.

Results
#

Pile validation loss against training compute at Medium, Large and XL scales for Transformer++, mHC, AttnRes, DHC, MUDDFormer and LoomFormer.
The paper’s Figure 5. LoomFormer is lowest at every scale; the labels mark compute-equivalent multipliers. Source: Xiao, Meng, Li, Yuan — arXiv:2611.30634.

Scaling laws. At 432M, 778M and 1.4B parameters on Chinchilla-style token budgets (sequence length 4,096), every residual-stream method improves on Transformer++. LoomFormer has the lowest validation loss at every scale. Interpolated along each baseline’s curve, it matches Transformer++ at 3.19–3.25× compute (3.10× net of its own FLOP overhead) and the four residual-stream baselines at 1.73–2.76×. At 1.4B it cuts loss from 2.101 to 1.979, 1.8× MUDDFormer’s improvement.

Long training. LoomPythia-2.8B and mHC-Pythia-2.8B were trained on the same 300B Pile tokens and setup as Pythia. Averaged over 10 tasks, LoomPythia gains +3.6 points zero-shot and +4.3 five-shot over Pythia-2.8B, against +2.5 and +2.6 for mHC. Its 59.9 zero-shot average equals Pythia-12B’s, its 61.6 five-shot beats Pythia-12B’s 60.8, and its Pile perplexity of 6.02 matches Pythia-12B’s 6.01. On a FLAN sample it does better than Pythia-12B (6.94 against 7.26). The five-shot gain widening while mHC’s stays flat suggests the extra capacity mostly helps in-context learning.

Mechanism. This section moves the paper beyond a leaderboard entry. The dynamic part of LoomPythia’s Q/K/V wiring matrix has an effective rank that rises with depth to 41 (mean 26.4), where Pythia and mHC are bounded at 1 and MUDDFormer at 3. Its ports actually vary token to token, with mean cross-token cosine distance of 0.33–0.56. In layers 17–32 only 22.9% of Pythia’s heads and 17.7% of mHC’s are “on” (not attending to a sink), against 74.4% for LoomPythia. The paper reads that as heads no longer needing to turn themselves off to avoid interfering.

Ablations at 432M put numbers on Proposition 3.1. Freezing both read and write ports keeps 56% of the gain, so the static dual-stream backbone and per-token rewiring contribute about half each. Freezing read queries hurts much more than freezing write keys (75% against 90% retained). Writers can keep stable slots if readers choose among them per token. Even at d_k = 16, with a total state of 2D, LoomFormer beats DHC (4D) and MUDDFormer (l·D).

The practical claim
#

FLOP overhead is 1.95–3.70%, but wall-clock overhead is larger. Training on TPU v5p with fused Pallas kernels runs at 89–92% of Transformer speed, and BF16 inference on an A800 with a Triton kernel runs at 84–92% across prefill and decode batch sizes. The authors attribute the gap to HBM traffic on M, low arithmetic intensity in the per-token M contractions, and many small projections. A 10–15% throughput tax against a ~3× compute-equivalent gain is a good trade on paper. Whether it holds at frontier scale, under tensor parallelism, and with optimized serving kernels is the open question. The largest model here is 2.8B, and all the comparisons are against Pythia-era baselines on the Pile.

Why this matters
#

The residual-stream variants of the last two years have mostly been justified by training stability or loss curves. This paper gives a structural argument about what a Transformer can’t do per token, a lower bound on the cost of working around it with more heads, and a measurable quantity (wiring rank) that separates the architectures. It also connects to the interpretability literature, where “circuit” is usually a static object discovered after training, and asks what happens when the model can rebuild its circuits at every position.

The authors note that M runs along depth, while linear and sparse attention run along the sequence, so the two can be combined. With hybrid linear-attention models like Gated DeltaNet and Qwen3-Next now common, that’s the obvious next experiment. The cmHC paper on hyper-connection mixing that topped Hugging Face’s daily list this week (arXiv:2611.27193) shows how much attention the residual stream is getting right now. Loom attention is the more radical proposal of the two.

Read alongside
#

  • Elhage et al., “A Mathematical Framework for Transformer Circuits” (Anthropic, 2021): writers, readers, virtual weights and K-composition.
  • Xiao et al., “MUDDFormer: Breaking Residual Bottlenecks in Transformers via Multiway Dynamic Dense Connections” (2025): the same group’s layer-level predecessor.
  • Zhu et al., “Hyper-Connections” (2025), and Xie et al., “mHC: Manifold-Constrained Hyper-Connections” (2025): the multi-stream baselines.
  • Xiao et al., “Efficient Streaming Language Models with Attention Sinks” (2024): why sink attention works as a head’s off switch.
  • Katharopoulos et al., “Transformers are RNNs” (2020): the linear-attention trick, applied here along depth.

Links #

📄 arXiv abstract · 📄 PDF · 💾 code


Part of the Weekly CS Paper Digest series. Summary written from a close read of the preprint; figures cropped from the arXiv PDF and reproduced here under fair use for educational commentary.

Related