Rewirable Circuits in Transformers with Loom Attention
Reading guide · Based on sections of the original paper
Why read this
Architecture researchers weighing residual-stream alternatives such as HC/mHC, MUDDFormer or AttnRes get a theory-motivated design, matched-parameter comparisons, ablations and measured throughput costs.
What the authors found
- The authors trained LoomPythia-2.8B on the same 300B Pile tokens and hyperparameters as Pythia, using serial sub-layers. Across 10 benchmarks it raised average accuracy over Pythia-2.8B by 3.6 points at 0-shot and 4.3 at 5-shot. They report this as about 1.6× the gain of mHC-Pythia-2.8B, which gained 2.5 and 2.6 points. 5.2 Large-Scale Pretraining and Evaluation
- The analytical overhead is 1.95–3.70% forward FLOPs, but measured wall-clock cost is larger. Training on TPU v5p with fused Pallas kernels ran at 89–92% of Transformer speed. BF16 inference on an A800 ran at 84–92% across prefill and decode batch sizes. The authors attribute the gap mainly to memory I/O on the matrix state. 5.4 Computational Complexity and Efficiency
- In a Medium-scale ablation (432M parameters, 7B tokens, matched parameters), making both read and write ports static raised Pile validation loss from 2.266 to 2.344. This retains 56.0% of the improvement over Transformer++, whose loss is 2.443. 5.5 Ablation Studies
Main limitation
By the authors' own analysis, a fully static-port variant cannot rewire per token, yet at Medium scale it still beats every layer-wise dynamic baseline. A large share of the gain may therefore come from the extra matrix stream rather than per-token rewiring. Ablations were run only at the 432M scale. Appendix G Extended Ablation Studies
Where to start
5.5 Ablation Studies · Use the ablation table to see which components carry the gain: dynamic ports, port normalization and gating, the FFN write branch, and the slot-count sweep. Then compare it with the headline compute-equivalence claims.
Abstract
We propose loom attention, which allows a Transformer to dynamically rewire its circuits at every token by interweaving a head's vertical attention over the outputs of earlier heads (to obtain its query, key and value) with its horizontal attention over tokens. We instantiate vertical attention efficiently with normalized and gated linear attention over a per-token matrix memory, which stores the compressed head outputs and serves as a second residual stream. This yields LoomFormer, a dual-stream architecture that splits control and content between the vector and matrix streams. Across model sizes and training token budgets in language modeling and downstream tasks, LoomFormer matches Transformers trained with over 3x compute and recent residual-stream baselines (HC/mHC, MUDDFormer, AttnRes) trained with ~1.7-2.8x. For example, trained on the same 300B tokens with only 2% extra FLOPs, LoomPythia-2.8B achieves ~1.6x the average downstream gain of mHC-Pythia-2.8B over Pythia-2.8B, and matches (0-shot) or surpasses (5-shot) Pythia-12B. Code is available at https://github.com/Caiyun-AI/LoomFormer