New Loom Attention Method Enables Rewirable Transformer Circuits
Researchers have introduced Loom Attention, a method that allows Transformers to dynamically rewire their internal circuits at every token for better.
Source: Grafy Research LabResearchers have developed a new attention mechanism called loom attention that allows Transformer models to dynamically rewire their internal circuits for every individual token. This approach aims to overcome the limitation of standard Transformers, where the vertical connections between layers are fixed after training, preventing the model from choosing which specific heads to interact with based on the current input.
How does loom attention rewire Transformer circuits?
In a standard Transformer, attention heads communicate through a residual stream. While horizontal attention allows a head to choose which previous tokens to attend to, the vertical flow—how a head reads from or writes to earlier heads—is determined by static projection weights that do not change once training is complete. According to the research paper by Da Xiao, Qingye Meng, Shengping Li, and Xingyuan Yuan, this means a model must keep all possible circuits active simultaneously, which can be inefficient.
Loom attention changes this by interweaving vertical and horizontal attention. As shown in Figure 1, each head performs vertical attention over the outputs of earlier heads at the same token to derive its query, key, and value. It then uses those to perform standard horizontal attention over different tokens. This allows the model to weave a different circuit for every token, much like a loom creates different patterns by selecting specific threads.
What is the LoomFormer architecture?
To make this rewiring process computationally affordable, the authors proposed the LoomFormer architecture. A naive implementation of vertical attention over all previous heads would be too expensive for practical use. To solve this, the researchers introduced a dual-stream system: a vector stream and a matrix stream.
As illustrated in Figure 4, the architecture utilizes a per-token matrix memory that stores compressed head outputs. This matrix memory acts as a second residual stream. The model uses normalized and gated linear attention to read from and write to this matrix memory efficiently. In this setup, the vector stream manages control—deciding which memory slots to access—while the matrix stream carries the actual content across tokens.
How efficient is the new method?
One of the primary goals of the research was to improve performance without a massive increase in computational cost. The researchers found that LoomFormer is highly efficient. According to the study, the architecture adds only between 2.0% and 3.7% extra floating-point operations (FLOPs) compared to standard models.
Despite this minimal overhead, the performance gains are significant. The authors report that LoomFormer can match the performance of Transformers that were trained with over the amount of compute. For instance, a 2.8B parameter model named LoomPythia-2.8B, trained on 300B tokens, achieved approximately the average downstream gain of the mHC-Pythia-2.8B baseline. In some benchmarks, the 2.8B LoomPythia model even matched or surpassed the performance of the much larger Pythia-12B model in five-shot scenarios.
Why does rewirable circuitry matter for AI?
The ability to rewire circuits per token means the model can be more selective about the information it uses. The research indicates that by rewiring head outputs to inputs on a token-by-token basis, the model can keep significantly more deep-layer heads away from "attention sinks" (unnecessary tokens used to soak up attention) compared to previous architectures like Pythia or mHC.
By allowing heads to specifically choose which earlier heads to read from, the model can effectively specialize its internal pathways for different types of data or context. This flexibility allows a smaller model to behave with the sophistication of a much larger one, potentially leading to more efficient scaling of large language models.
How can researchers explore this topic?
While LoomFormer is a specialized architectural advancement, the underlying concepts of mechanistic interpretability and circuit analysis are central to modern AI research. For those looking to dive deeper into the technical papers or explore the mathematical foundations of transformer architectures, the Reader app provides an environment to search, question, and analyze complex research PDFs using AI. This can help researchers quickly parse the nuances of new architectures like LoomFormer and their implications for the field.
Frequently asked questions
What is the main difference between standard attention and loom attention?
Standard attention has fixed vertical connections between layers that are determined during training. Loom attention allows the model to dynamically choose which earlier heads to attend to vertically at every single token. This interweaving of vertical and horizontal attention enables the model to create unique, rewirable circuits for different inputs.
Does LoomFormer require significantly more computing power?
No, the LoomFormer architecture is designed to be highly efficient. The researchers state that it only requires an additional 2.0% to 3.7% in FLOPs. This small increase in computational cost allows the model to achieve performance levels comparable to much larger models trained with significantly more compute.
What is the purpose of the matrix memory in LoomFormer?
The matrix memory serves as a second residual stream that makes vertical attention efficient. Instead of performing expensive attention over all previous heads, the model uses the matrix memory to store compressed head outputs. This allows the heads to read and write information to a per-token memory using gated linear attention.
Source: Grafy Research Lab — Rewirable Circuits in Transformers with Loom Attention


