Rewirable Circuits in Transformers with Loom Attention
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
Create a lesson
Related papers
Toward a Theoretical Understanding of Transformer Attention: Bayesian Estimation and Predictive Sufficiency
Shared title terminologycs.LGFouad B. Chedid
Attention Temperature Confounds Zero-Shot Context Extension
Shared title terminologycs.LGRuben Navasardyan
Beyond Patching: Consistent Circuit Discovery via Gradient Spectral Analysis
Shared title terminologycs.LGYujie Zhang, Tianyi Zhao, Guanghui Min et al.
PVFormer: Proper Velocity Transformer for Stable and Scalable Hyperbolic Representation Learning
Shared title terminologycs.LGXianglong Shi, Nicu Sebe, Bernhard Schölkopf et al.
Near-Far Attention: Region-Aware Sparse Retrieval for Long-Context LLM Decoding
Shared title terminologycs.LGYuanShuo Wang, Jianchao Tan, Lei Gong et al.
HEART: Hierarchical Expert Adaptive Refinement Transformer for ECG Representation Learning
Shared title terminologycs.LGJunho Song, Jong-Hwan Jang, Joon-Myoung Kwon et al.