Skip to content
AI-generated research idea🔴Hard🔬Significant ResearchNo close match found

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

a couple of months

Compute level

Large cluster

Resources

TPU v5p-16/32 pod or multi-GPU cluster, The Pile and long-context pretraining/evaluation corpora (e.g., RULER, LongBench)

What the paper used

JAX/MaxText pretraining on TPU v5p pods (v5p-16 for 432M/7B tokens, v5p-32 for 778M/14B and 1.4B/26B tokens, v5p-128 for 2.8B/300B tokens) on The Pile, plus single NVIDIA A800-80GB inference benchmarks.

Prerequisites

Linear attention, Gated DeltaNet/SSM architectures, FlashLinearAttention/Triton kernels, long-context evaluation

Scope

new model architecture

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.”
From the paper, Section 6, page 9. Matched against the PDF text.

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.

  1. Reproduce both LoomFormer-Medium (432M) and a parameter-matched Gated DeltaNet baseline on The Pile at T = 4096 using the released LoomFormer repository.
  2. 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.
  3. 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.
  4. 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?

No close match in 10 results

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.

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 Attention

Da 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

Is this a good idea?

Share onXLinkedIn