Manuscript Offprint

arXiv:2610.34056

INTRA: Interleaved Non-contiguous Token spaRse Attention

Yuxuan Xia, Wenbo Lu, Shaoyi Zheng, Shengjie Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Transformers achieve strong performance across modalities but are bottlenecked by the quadratic cost of attention. Sparse attention can reduce this cost, but effective sparsity must preserve useful long-range communication and map well to GPU hardware. We introduce INTRA–Interleaved Non-contiguous Token spaRse Attention—a hardware-aware static sparse attention design based on a relay-communication view under Computational Query Set (CQS) constraints. Rather than directly covering all token-to-token interactions within each sparse layer, INTRA uses complementary sparse groups to provide short mediated communication paths across layers. Scatter forms relay groups that sample broadly across local neighborhoods, while Gather reconnects these groups in subsequent layers. Under a partition model, this structure guides CQS-compatible sparse patterns with global reachability. Our CQS-aware FlashAttention-style kernel computes structured indices at runtime, loads selected non-contiguous tokens, and packs them densely for computation. On an A100, INTRA achieves a 1.53×1.53\times speedup in 2K FLUX. 1-dev generation, with better measured image quality than evaluated CLEAR configurations after LoRA self-distillation. On LLaMA-3.1-8B, it improves long-context prefill efficiency with strong teacher-forced retrieval performance under matched LoRA adaptation. Attention-only benchmarks further show up to 8.4×8.4\times and 10.4×10.4\times speedups over MoBA and density-constrained NSA, respectively.

1 INTRODUCTION

Transformers excel across domains such as NLP and image generation, but their attention cost scales quadratically with sequence length, creating a bottleneck for long contexts and high-resolution generation. For instance, FLUX.1-dev (Black Forest Labs, 2024) requires nearly a minute to produce a 2048×20482048 \times 2048 image on a single A100, precluding real-time generation.

Sparse attention reduces full-attention overhead (Liu et al., 2025; Jiang et al., 2024). We distinguish input-dependent (dynamic) from input-independent (static) connectivity separately from whether a method requires training or adaptation. INTRA uses static connectivity to avoid runtime pattern selection and evaluates adaptation of pretrained models to GPU-friendly sparse patterns.

Sparsity changes communication as well as FLOPs. Many modalities have coherent local neighborhoods, such as image patches, spatial regions, or short contiguous token segments. Local attention can mix nearby information within these neighborhoods; the remaining challenge is communication between neighborhoods under hardware constraints. A partition-based sparse layer permits interactions only within groups. Covering all dense edges would require many such layers, motivating relay paths that connect neighborhoods through successive groups.

Efficient execution constrains this design space. CLEAR (Liu et al., 2025) uses circular local sparsity, and NATTEN (Hassani et al., 2023) uses sliding windows. Fine-grained masks can leave partially used computational blocks (Figure 2). Computing whole blocks before masking unused scores diminishes realized speedups relative to nominal FLOP reductions. We formalize a hardware-oriented design class through Computational Query Sets (CQSs): query groups with structured key sets and local-to-global index mappings aligned with FlashAttention-style query blocks.

Figure

Figure 1: The figure reports the relative speedup achieved by INTRA compared to CLEAR and FlashAttention 2 on 4K and 16K input lengths, evaluated on an A100 GPU. Note that the axis density differs between the left and right sides of the figure to accommodate varying inference times.

INTRA combines two CQS-compatible patterns. Under equal-size partitions, Scatter groups same-position tokens across neighborhoods, giving each group one representative per neighborhood. Gather reconnects these channels. If every Scatter group intersects every Gather group, two layers permit graph-theoretic reachability between any source and target. This motivates complementary patterns for efficient sparse communication.

Our contribution is the joint study of structured static attention, GPU execution, and pretrained-model adaptation. Building on factorized and local–global attention (Child et al., 2019; Tu et al., 2022), we (1) formulate coverage and overlap objectives within the Intra Sparse Pattern Design (ISPD) Principle and its CQS constraints; (2) implement selected Scatter/Gather patterns using runtime indexing, dense shared-memory packing, and scatter-back; and (3) evaluate their quality–latency trade-offs after adaptation.

Figure

Figure 2: Low-level implementation of blockwise sparsity for handling mixed blocks. A mix block is the block that partially preserves attention scores, as shown on the left side of the figure.

INTRA delivers 1.53×1.53 \times faster 2K FLUX. 1-dev generation after LoRA self-distillation with better measured image metrics than evaluated CLEAR configurations. Wan2.2-TI2V-5B generation is 1.43×1.43 \times faster end to end at 704×1280704 \times 1280 with 121 frames (Table 19). On LLaMA-3.1-8B, INTRA accelerates SCROLLS (Shaham et al., 2022) prefill relative to MInference (Jiang et al., 2024) and XAttention (Xu et al., 2025). Separate 32-layer attention timings at 4K–64K show 3.6–8.4×3.6–8.4 \times speedups over MoBA and 7.3–10.4×7.3–10.4 \times over density-constrained NSA (Table 4b).

References (67)