TL;DR
Linear attention models like Gated DeltaNet promise to process million-token sequences without the crushing quadratic cost of standard Transformers, but they hide a frustrating secret: their step-by-step memory updates refuse to parallelize easily across GPUs. FlashQLA breaks this sequential bottleneck by realizing that most attention heads "forget" old context rapidly, allowing GPUs to chop up long sequences, skip redundant memory prep work, and process million-token contexts up to 4.8× faster.
What Problem Does This Paper Address?
Standard softmax attention compares every token to every other token—great for parallelizing on GPUs, terrible for scaling to long contexts. Gated DeltaNet (GDN) replaces this with linear attention, compressing past tokens into a fixed-size recurrent state (a running memory matrix) updated as the model reads.
To make GDN fast on GPUs, tokens are grouped into small chunks. Within a chunk, math happens in parallel. Between chunks, however, we hit a sequential wall: Chunk 2 needs the final memory state of Chunk 1. When processing a 1-million-token sequence with a small batch size, GPU cores sit idle waiting on this long chain of dependencies.
Context Parallelism (CP) tries to fix this by slicing the sequence into partitions and processing them simultaneously. Because each partition starts "blind" (without the true incoming state from earlier tokens), standard methods like Kimi Context Parallel (KCP) run a two-step boundary-state preprocessing phase: each partition computes a local state summary assuming a blank-slate start, and then a quick sequential pass stitches them together. The catch? Computing those local summaries requires scanning every chunk in the partition—eating up 50.8% of total forward execution time and neutralizing half the gains of parallelization!
Methods
FlashQLA attacks both the preprocessing tax and hardware underutilization through four main innovations:
- Decay-Aware Preparation: GDN uses a data-dependent "decay gate" ($\alpha \in (0,1)$) to forget old information. Instead of scanning an entire partition to prepare boundary states, FlashQLA checks each head's cumulative decay online. If a head forgets rapidly, FlashQLA truncates the prep rollout to just the tail end of the partition where history still matters mathematically, retaining full-history rollouts only for long-memory heads.
- Auto CP: Finer sequence slicing creates more parallelism, but adds scheduling and stitching overhead. Auto CP uses a lightweight offline-calibrated latency proxy model and searches around GPU execution-wave boundaries to dynamically decide if intra-GPU slicing helps a given workload, and picks the optimal partition size.
- Dual CP: When scaling across multiple GPUs (inter-card) and slicing sequences within each GPU (intra-card), naively combining them duplicates the state-summary prep work. Dual CP computes summaries once at the fine-grained intra-card level, algebraically aggregates them into inter-card summaries, exchanges them across GPUs, and corrects states hierarchically.
- Kernel Co-Design: Using TileLang, the authors factor cumulative decay gates out of matrix inverses (preventing low-precision rounding errors while keeping accumulators in FP32), fuse compatible kernel stages, and use manual warp specialization to overlap memory transfers with matrix math.
Datasets
Because FlashQLA is an execution framework rather than a newly trained model, no training datasets are used. Evaluation relies on two sources:
- Synthetic Benchmarks: Randomly generated BFloat16 inputs across sequence lengths from 8K to 1M tokens. Reflecting real-world observations, 75% of heads are configured with strong decay and 25% with weak decay.
- Real-Model Activations: Actual activations and gate values collected from Qwen3.8-27B and Qwen3.8-2.4T-A95B (Max) executions (24 sequences of 32K tokens for decay profiling, plus 32K and 64K contexts for operator benchmarking). No new public dataset benchmarks are introduced.
Key Insights and Ideas
- Most linear attention heads have surprisingly short memories: When measuring how quickly historical state decays below $e^{-10}$, the authors found that 66.9% of heads in Qwen3.8-27B and 80.7% in Qwen3.8-Max have effective memory windows shorter than 8K tokens. We don't need to summarize 100K tokens of history for a head that forgets everything past 2K tokens.
- Head decay is a personality trait with situational moods: Individual heads consistently favor short or long windows, yet exact window sizes shift depending on the input text—justifying FlashQLA's choice to estimate truncation windows dynamically online rather than hardcoding them.
- Affine math makes hierarchy cheap: Because GDN's state update is affine ($S_{new} = M \cdot S_{old} + E$), local chunk transitions compose cleanly via matrix multiplication. That algebraic property is what lets Dual CP build multi-GPU summaries directly out of single-GPU sub-summaries—slashing preprocessing latency by 4.52×.
Key Results
Compared against Flash Linear Attention (FLA) and FLA's KCP implementation:
- Single-GPU Speedups: Achieves 1.7×–3.1× forward speedup (8K–32K tokens) and up to 4.4× backward speedup. On real Qwen3.8-2.4T-A95B activations under TP8, GDN operator forward latency drops by 3.25× (32K) and 3.56× (64K).
- Multi-GPU Scaling (8 GPUs, up to 1M tokens): Dual CP delivers up to 4.8× forward speedup and 4.4× combined forward-and-backward speedup over FLA KCP.
- Auto CP Precision: Picks the true optimal configuration 94.4% of the time for inference and 90.0% for training, outperforming hardware-aware static heuristics by up to 3×.
- End-to-End Impact: Reduces full-model Time-To-First-Token (TTFT) on Qwen3.8-2.4T-A95B (32K context, TP8) by ~5%.
Limitations and Future Work
- Modest End-to-End Gains at Moderate Contexts: In hybrid architectures like Qwen3.8, GDN computation only accounts for a small slice of total runtime at 32K tokens, capping end-to-end TTFT improvement at ~5%.
- Approximation Error: Truncating state preparation introduces a tiny numerical approximation controlled by the threshold $\text{TOL} = e^{-10}$ (though accurate in practice).
- Architecture Scope & Future Directions: FlashQLA specifically targets Gated DeltaNet's scalar per-head gates. However, the authors note that their affine-summary framework provides a clear foundation for extending hierarchical context parallelism to other recurrent linear-attention variants, such as Kimi Delta Attention (KDA) with channel-wise decay gates.
Summary updated