typebraintank dispatch
headlineLoom attention lets each Transformer head pick, token by token, which earlier heads to read
dekA per-token matrix memory lets attention heads rewire their connections across layers. The authors report gains equivalent to over 3x compute, at a real cost in speed.
date2026-12-01
sectionLatent · Transformer architecture
datelineBeijing · Beijing University of Posts and Telecommunications
paperRewirable Circuits in Transformers with Loom Attention
statuspreprint, not peer reviewed
originalhttps://braintank.ai/a/arxiv-2611.30634.html
cite
text

Inside a Transformer, the design behind most large language models, attention lets each token decide which other tokens to look at. How attention heads in one layer feed heads in later layers is a different matter: that wiring is fixed once training ends. A 2026 preprint by Da Xiao, Qingye Meng, Shengping Li and Xingyuan Yuan, which has not yet been peer reviewed, proposes 'loom attention'. It lets each head choose afresh at every token which earlier heads' outputs it draws on.

The authors frame the problem in terms of circuits, chains of heads in which one head's output feeds a later head's inputs. In a standard model, the link between two heads is a 'virtual weight', a fixed product of their projection matrices. The authors prove that such a model is 'node-gated'. At any token it can only switch whole heads on or off, often by having them attend to an 'attention sink', a token heads look at when they effectively want to do nothing. It cannot choose which specific pairs of heads connect. Earlier fixes are Hyper-Connections and its variant mHC, MUDDFormer and Attention Residuals. According to the paper, they only mix information layer by layer, after each layer's heads have been summed. Their 'wiring rank', a measure of how freely connections can be rearranged rather than merely toggled, therefore stays at 1, or 3 for MUDDFormer.

Letting every head attend directly over all earlier heads' outputs would be unaffordably expensive. Instead, the resulting architecture, LoomFormer, gives each token a small matrix memory with a fixed number of slots. It works as a second residual stream alongside the usual running vector. Each head writes its output into this memory, using a small per-token 'port' that selects which slots it writes to. Each head's query, key and value then read from the memory through their own ports. The ports are generated from the ordinary vector stream, normalised to pick slots and gated to set strength. The mechanism resembles linear attention, a compressed form of attention, but it runs down through the layers at one token rather than across tokens. By default the memory has twice as many slots as there are heads per layer.

All models were trained on the Pile, a large text dataset. The authors trained models at 432 million, 778 million and 1.4 billion parameters. Interpolating across the two smaller sizes, they report that LoomFormer matched a baseline Transformer that was given 3.19 to 3.25 times the training compute. It matched DHC, mHC, Attention Residuals and MUDDFormer at 1.73 to 2.76 times. At 1.4 billion parameters, validation loss fell from 2.101 to 1.979, against a reduction of 0.068 for MUDDFormer. The authors also trained a 2.8-billion-parameter model on 300 billion tokens using the settings of the public Pythia models, plus an mHC version for comparison. Across ten benchmarks, including LAMBADA, ARC, BoolQ and HellaSwag, average accuracy rose from 56.3 to 59.9 with no examples in the prompt and from 57.3 to 61.6 with five. Pythia-12B scores 59.9 and 60.8 respectively.

The trained model appears to use its freedom. In layers 17 to 32, 74.4% of heads stayed active rather than parked on attention sinks. The figures were 22.9% for Pythia-2.8B and 17.7% for the mHC version. In ablations at 432 million parameters, fixing the ports so they no longer vary by token kept 56.0% of the gain. By the authors' reading, per-token rewiring and the two-stream backbone each contribute roughly half.

The costs are stated plainly. Extra arithmetic is small, between 1.95% and 3.70% depending on size. Measured training speed, however, was 89–92% of a standard Transformer's, and inference speed was roughly 84–92%. The authors attribute the gap mainly to memory traffic on the matrix memory and to less efficient small operations. Their compute-equivalence figures rest on log-linear interpolation between two model sizes. At 2.8 billion parameters, mHC is the only rival of its kind. Everything was trained on one dataset, and no variation across random seeds is reported. Results per task are mixed: on zero-shot BoolQ, the 2.8-billion-parameter model scored 65.8 against 67.4 for Pythia-12B. Exact rewiring holds only when no more writers are active than there are slots. The paper ties freed sink heads to better in-context learning but does not test that link directly.

The borrowed machinery connects to earlier braintankAI coverage of linear attention. That work found that the matrix memory in Gated DeltaNet-2 could grow out of control and redesigned its erase step to prevent it. LoomFormer uses a similar read-and-write matrix memory, but down through the layers rather than across the sequence. The authors regard the two uses as combinable and leave that for future work. The finding that many deep heads in a standard model sit idle on sinks also echoes a study of the Qwen-Image diffusion transformer, which turned its analysis into a rule for skipping attention heads.