Combining Loom Attention with Sub-Quadratic Sequence Attention for Long-Context Modeling
Replace standard quadratic attention with linear or sparse sequence attention inside dual-stream depth-routing architectures to enable sub-quadratic long-context modeling.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In LoomMHA (Equations 7-8, Sections 5.1-5.2), per-token vertical routing over M feeds the queries, keys, and values of standard quadratic causal self-attention, evaluated only up to sequence lengths of 4096 (2048 at 2.8B).
“Because the matrix memory operates along depth at each token, combining loom attention with linear or sparse attention along the sequence is a natural direction for future foundation models.”
Limitation
Quadratic horizontal attention restricts long-context scalability, and LoomFormer's wider 1.25d Q/K head dimension creates an asymptotic +12.5% FLOP overhead as sequence-to-width ratio T/D grows (Equation 18), while existing sequence-axis linear attention models still suffer from static rank-1 inter-head wiring across layers (Section 4).
Proposed Solution
Integrate Gated DeltaNet or block-sparse horizontal attention into LoomMHA in place of full causal SDPA while retaining per-token vertical rewiring over M, and test whether dynamic cross-layer composition compensates for the compressed recurrent state of linear sequence models.
The paper’s authors list this direction as future work, so they may already be pursuing it.
Why This Matters
Uniting orthogonal depth-wise rewiring with sub-quadratic sequence mixing could yield strong long-context efficiency and recall without sacrificing the expressivity lost in standard linear-attention Transformers.
How to Get Started
How to test it: Test the hypothesis that Loom-GatedDeltaNet outperforms standalone Gated DeltaNet and matches Transformer++ on Pile validation loss at 432M-1.4B while surpassing both on 32K-context RULER recall and throughput; stop if hybrid models fail to beat standalone Gated DeltaNet on perplexity or needle retrieval.
- Reproduce both LoomFormer-Medium (432M) and a parameter-matched Gated DeltaNet baseline on The Pile at T = 4096 using the released LoomFormer repository.
- Replace the causal MHA call in loom_mha with a Gated DeltaNet or sliding-window/block-sparse attention module driven by the MRead outputs q, k, v.
- Train both architectures on extended 16K-32K context sequences (e.g., Pile + long-document upsampling) and benchmark wall-clock prefill/decode latency on an A800/H100 GPU.
- Evaluate long-context associative recall and retrieval on RULER and Needle-in-a-Haystack benchmarks to measure whether depth-wise rewiring mitigates state-capacity bottlenecks.
Code linked to this paper on Hugging Face: github.com/Caiyun-AI/LoomFormer
Suggested by AI. Adapt it to your setup.
Has This Been Done?
The listed papers explore sparse attention mechanisms, routing, and linear attention variants like Gated Attention for Large Language Models and MInference 1.0, but none specifically evaluate the integration of sub-quadratic sequence attention into Loom-style cross-layer architectures.
- You Only Index Once: Cross-Layer Sparse Attention with Shared Routing · 2026 · 4 citations
- Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free · 2025 · 476 citations
- MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention · 2024 · 552 citations
We searched OpenAlex and arXiv for “linear attention sparse attention cross-layer routing long context” and “Combining Loom Attention with Sub-Quadratic Sequence Attention for Long-Context Modeling” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
Rewirable Circuits in Transformers with Loom AttentionDa Xiao, Qingye Meng, Shengping Li +1 more · 2026
The paper introduces loom attention and LoomFormer, a dual-stream Transformer architecture that makes inter-head circuits dynamically rewirable at every token rather than fixed by static virtual weights. By routing head outputs and inputs vertically through a shared per-token matrix memory alongside standard horizontal token attention, LoomFormer achieves the language modeling and downstream accuracy of Transformers trained with over 3x compute and recent residual-stream baselines trained with 1.7-2.8x compute at only 2.0-3.7% extra forward FLOPs.
Related Ideas
- Integration of Sequence Parallelism for Long-Context TrainingLlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models🔴Hard
- Controlled Block-Level Comparison of Content-Gated Recurrent Depth ReadersLoopback Transformer: Towards a Unified View of Residual Looped Transformers🟡Fairly easy
- Linear-Complexity Depth-Wise Attention for Scalable Full Attention ResidualsAttention Residuals🔴Hard
- Strictly Causal Decoupled Readout for Hybrid Recurrent State-Space and Attention BackbonesMixture-of-Loops Transformer🟠Medium
- Efficient Input-Dependent Queries for Attention ResidualsAttention Residuals🟠Medium