Choosing Which Heads to Read, Token by Token: How Loom Attention Works and Why It Matters

Loom attention reports performance equivalent to 3 times the compute with just 2–3.7% additional computation. Trained on the same 300B tokens, LoomPythia-2.8B matched Pythia-12B in 0-shot evaluation and outperformed it in 5-shot evaluation.
← All posts
온
온틀 리서치
2026년 11월 25일 Updated 2026.12.01 33 min read views 11

Once a transformer finishes training, the wiring between its heads is fixed. It can change where it looks in the input each time, but changing the connections through which it receives other heads’ outputs is harder.

Here, attention is the operation that determines which parts of the input to focus on, and a head is a processing unit that handles a share of that operation. A token is a unit of text the model processes, corresponding to a word or part of a word. The paper calls connections through which multiple heads exchange information to solve a task “circuits.”

Loom attention proposes adapting these connections to the input as well. Each head chooses which other heads to read based on the token currently being processed. LoomFormer is the model that implements this approach.

What Exactly Is Fixed?

In a conventional transformer, head outputs are added to the residual stream, a shared pathway that carries previously computed information to the next layer. Layers are the stages that perform these computations in sequence. Heads in later layers read the information they need from this pathway.

This process involves two distinct choices.

  • Selection across tokens: Which token should I attend to right now?
  • Connections between heads: Which earlier heads should I receive information from?

The first changes with the input. The transformation weights that determine the second are fixed after training. The paper distinguishes these as horizontal flow and vertical flow, respectively.

The conventional architecture can still make a head effectively produce no output. It does this by directing attention to a sink token, which does not contribute to processing the actual content. The paper describes this switching of entire heads on or off as “node gating.”

But turning off a head is different from cutting a single connection. If both the head writing information and the head reading it are active, the fixed connection between them is active too. Even when only certain connections are needed, unwanted ones can come along with them.

Dense connections cause different circuits to interfere with one another. Sparse connections reduce interference, but make it difficult to retrieve information from groups that were not connected in the first place.

Could adding more heads work around this? According to the authors’ analysis, covering every combination in which reading heads independently select writing heads would require at least dozens of spare heads for each reader. The architecture pays for its inability to change connections by increasing the head count.

The Core Idea: Separate Content from Control

Before gathering information across tokens, Loom attention first selects outputs from earlier heads at the same token. This process is called vertical attention.

The information it reads is used to construct queries, keys, and values. A query specifies what information is being sought, a key identifies information to compare against, and a value holds the content to retrieve. The model then gathers information across tokens, just as ordinary attention does. The result becomes something that later heads can read.

Directly checking every earlier head each time would make the cost grow quadratically with the number of heads. To reduce this cost, LoomFormer writes head outputs into matrix memory, a space that compresses information into a fixed number of storage locations. These locations are called slots, and their count is denoted by m. Each head reads these slots instead of all earlier heads.

The key is the separation of roles. All the actual content moved by attention comes from matrix memory, while the existing vector stream controls where to read and how to connect. The vector stream is the conventional pathway that carries information as a single row of numbers. The matrix stream holds information in a table-like form and carries it through the model’s depth.

A Jacquard loom offers a useful analogy. Just as punched cards determine which warp threads to lift, the vector stream determines the connections. The matrix stream holds the content used under that control.

The access points through which heads read and write matrix memory are called ports. Ports are small numerical vectors, so they can be generated for each token. They separately determine which slots to use and how strongly to read or write.

The read module, MRead, retrieves information from the matrix, while the write module, MWrite, records information in it. Attention across tokens reads only earlier tokens, excluding the current token; the current token’s content travels through a separate pathway. The FFN, a neural network that processes information for each token, also writes content to matrix memory through an auxiliary FFN.

With fixed ports, LoomFormer reverts to the conventional structure of switching heads on and off. With ports generated for each token, however, a single reading head can reproduce wiring patterns involving up to m active writing heads. Adding matrix memory alone is not enough. Changing read and write locations for each token is what makes rewiring possible.

How It Differs from Earlier Approaches: Selecting Below the Layer Level

There have been previous attempts to make better use of information from earlier layers.

DenseFormer lets a layer aggregate outputs from all preceding layers. MUDDFormer and AttnRes adapt that aggregation to the input. MUDDFormer does so separately for query, key, value, and residual inputs. Hyper-Connections and its variant mHC maintain and mix multiple residual streams.

The difference with LoomFormer is the unit of selection. In earlier methods, heads within a layer share ports. What gets selected is the layer’s already-combined information, rather than individual head outputs.

LoomFormer generates ports for each head and each token. Heads within the same layer can therefore choose different sources to read. The paper reports that this approach represents a wider variety of connections while maintaining a smaller state than Hyper-Connections.

Using matrix memory does not make this the same architecture as linear attention, which compresses accumulated information into a fixed-size state. Linear attention builds up state in token order, and reading that state produces a head’s output. LoomFormer builds up state through the depth of the layers, and uses what it reads to construct the inputs to attention across tokens.

The scope of sharing also differs. Linear attention maintains a separate state for each head, whereas LoomFormer’s memory is shared by heads across all layers within a single token. The authors consider the two approaches compatible because they operate along different axes.

What Did the Experiments Compare?

All experiments used the Pile dataset and JAX, a framework for model training. Per-token port modulation was initialized close to fixed ports, rather than being applied strongly from the start.

The evaluation had three parts.

Experiment Comparison What it tested
Training across scales Compared with Transformer++, DHC, mHC, AttnRes(full), and MUDDFormer at Medium, Large, and XL scales How much prediction error falls relative to training compute
Large-scale pretraining Compared LoomPythia-2.8B and mHC-Pythia-2.8B with Pythia 2.8B–12B How accurately the trained models perform on practical tasks
Analysis of internal behavior Compared wiring and head usage in the trained 2.8B models How connections and information use change with the input

The training token counts for the scaling experiments followed the Chinchilla approach from Hoffmann et al. (2022). This sets the amount of training in proportion to the number of model parameters, excluding the component that converts tokens into numbers. Parameters are the numbers inside a model that are adjusted during training.

Large-scale pretraining used 300B Pile tokens. This is about 5 times the amount used in the scaling experiments and exceeds the Chinchilla budget. Because mHC requires its internal computations to run sequentially, both LoomPythia and mHC-Pythia used a serial architecture for a fair comparison. Otherwise, they used the same architecture and training settings as Pythia.

Task performance was compared using average accuracy across 10 standard benchmarks. 0-shot means answering without worked examples; 5-shot means receiving five examples first.

The analysis of internal behavior used held-out Pile validation inputs. It examined how much connections change across tokens, how many heads continue to attend to actual content, and how specialized each head becomes in choosing its sources.

Results and Implications

Lower Prediction Error at the Same Compute Budget

LoomFormer achieved the lowest validation loss at all three scales tested. Validation loss measures prediction error on data not used for training; lower is better.

Estimates between the Medium and Large training curves indicated that Transformer++ needed 3.19–3.25 times the compute to reach LoomFormer’s level. This comparison used log-linear interpolation over that range. Accounting for LoomFormer’s own 3.1% compute overhead at the Large scale, the net effect was 3.10 times.

Against other residual-stream methods, the gains were equivalent to 1.73–2.76 times the compute. At XL, its loss was also lower than that of the largest models from the comparison methods. The additional FLOPs were 2.8%, and the reduction in loss was about 1.8 times that of MUDDFormer. FLOPs count the arithmetic operations required for a computation.

The paper reports an overall additional FLOPs range of 2.0–3.7%. An advantage in operation count, however, does not translate directly into savings in actual training time or memory. Throughput needs to be checked separately.

A Smaller Model Reached a Larger Model’s Task Accuracy

The first comparison to look at in the large-scale pretraining results is the average accuracy of LoomPythia and Pythia-12B.

Model 0-shot average accuracy 5-shot average accuracy
LoomPythia-2.8B 59.9 61.6
Pythia-12B 59.9 60.8

LoomPythia matched it without examples and outperformed it when examples were provided.

Against the same-size Pythia-2.8B, the improvements were as follows. The baseline model’s 0-shot average accuracy was 56.3.

Model 0-shot improvement 5-shot improvement
LoomPythia-2.8B +3.6 +4.3
mHC-Pythia-2.8B +2.5 +2.6

Averaging the improvements across the two conditions gives about 3.95 for LoomPythia and about 2.55 for mHC. The abstract’s “approximately 1.6 times the average downstream gains” refers to this comparison. Downstream evaluation means assessing a pretrained model on individual tasks.

Language prediction metrics pointed in a similar direction. Perplexity measures how uncertain a model is when predicting what comes next; lower is better.

Evaluation metric LoomPythia-2.8B Pythia-12B mHC-Pythia-2.8B
Pile perplexity 6.02 6.01 6.24
FLAN target-span perplexity 6.94 7.26 7.35

FLAN is a collection of data used for evaluation outside the training domain. It includes instruction-following data, data containing reasoning steps, and data that supplies examples in the input. Target-span perplexity evaluates predictions for the portions the model is expected to answer. LoomPythia recorded the lowest value in the paper’s corresponding table.

The Gains Were Larger When Examples Were Provided

In the accuracy table above, mHC’s improvement changed little depending on whether examples were provided. LoomPythia’s improvement was larger with examples. The authors interpret this as a sign of stronger in-context learning: the ability to infer rules from examples in the input without retraining the model.

The analysis of internal behavior revealed differences in the deeper layers, 17–32. LoomPythia retained more than 3 times as many heads attending to actual content rather than sinks as Pythia and mHC. The amount of attention allocated to actual content tokens was also more than twice as high.

The authors’ interpretation is that fixed connections force a model to turn off an entire head once it is no longer useful. When connections can change, that head can be repurposed to process other information.

The effective rank of the dynamic wiring matrix—a measure of the diversity of independent connection patterns in use—also increased with depth. It substantially exceeded the rank of 1 seen with fixed ports.

These observations alone do not establish what caused the performance gains. They show that connections and head usage changed; determining how much those changes contributed to performance requires further intervention experiments.

Limitations and Open Questions

Matrix memory does not have unlimited slots. If the number of active writing heads at a token exceeds the slot count m, they must share slots. Different pieces of information can then interfere with one another. The number of slots sets the limits of compression, and the authors adjusted FFN width to keep models within their parameter budgets.

Actual speed is a separate question. The paper reports measured throughput on an A800, but maintaining, reading, and writing matrix memory may not incur the same costs in other environments. The public code is based on Pile and JAX. Evaluating it in a PyTorch environment would require checking how implementation choices affect execution speed.

The scope of the evidence also has limits. The published large-scale results cover a 2.8B model compared against Pythia models up to 12B. The reported experiments do not establish that the benefits hold for larger models or very long contexts. The effects after instruction tuning, additional training to make a model follow instructions, also remain to be tested.

Evaluation focuses on Pile, FLAN, and 10 benchmarks. Average accuracy alone makes it difficult to tell which tasks benefit most, and generalization to code, mathematics, and long-form reasoning remains an open question. Larger gains in evaluations with examples should not be extended into a claim that longer examples are better.

What Would We Test at ONTLE?

One potential application in ONTLE’s AI PM product is classifying schedules and risks for a new project. An agent could be shown similar past projects and asked to apply the classification criteria used then to the new project.

This requires more than the ability to imitate how the examples are worded. The model must identify which conditions in past projects led to schedule delays or risk classifications, then apply those relationships to the current project. The few-shot gap discussed above gives us a reason to evaluate this ability separately when choosing a base model. Few-shot means performing a task with a small number of examples supplied in the input.

When comparing candidate models at ONTLE, we could evaluate the same new project both without past cases and with the same set of cases provided to each model. The aim would be to measure how much adding those cases improves schedule and risk classification. If using RAG, which retrieves relevant documents and adds them to the input, we should also check whether the retrieved cases actually inform the model’s decisions.

Rather than choosing on model size alone, we need to compare these quality differences alongside actual inference costs and throughput. Whether training-compute efficiency carries over to product operating costs must be tested with the product’s inputs and execution environment.

Loom attention is research into the internal architecture of base models, rather than a feature that can simply be switched on in a product. For ONTLE, it raises a concrete practical question: When shown the same project cases, which model turns them into more accurate schedule and risk assessments? LoomFormer’s results suggest that the answer can depend on how a model connects information, as well as on its size.

References