Introduction
This paper introduces Sliding Window Recurrences (SWR) and the Phalanx layer, a hardware-aware approach to sequence modeling. By truncating linear recurrences into "jagged" windows that align perfectly with GPU warp structures, the authors achieve a 10–40% speedup over optimized Transformers while maintaining matching language modeling performance.
The Challenge of Data Movement
Modern language modeling is shifting toward "hybrid" architectures that combine the global reach of Attention with the efficiency of sub-quadratic primitives like linear recurrences or convolutions. However, a major bottleneck remains: data movement.
Standard linear recurrences are theoretically efficient but often struggle on GPUs because they require "carry chains"—sequential dependencies where each step waits for the previous one. While parallel scan algorithms help, they often involve global communication across the entire GPU memory hierarchy, which is slow. Existing "sliding window" solutions mostly focus on Attention (SWA), leaving a gap for a truly hardware-aligned recurrence operator that exploits local data proximity to maximize throughput.
Proposed Method: Sliding Window Recurrences (SWR)
The authors propose a hierarchical decomposition framework that treats recurrences as matrix factorizations. Their key innovations include:
- Sliding Window Recurrences (SWR): Instead of computing a full global recurrence, SWR truncates the "influence" of past tokens to a local window.
- Jagged Windows: Unlike traditional uniform sliding windows, SWR uses "jagged" boundaries. These boundaries are strategically aligned with GPU warps (groups of 32 threads). By making the window jagged, the model limits costly inter-warp communication, allowing most work to stay within fast, on-chip registers and shared memory.
- Block Two-Pass (B2P) Algorithm: To implement SWR efficiently, the authors developed B2P. Pass 1 computes local recurrences within blocks using high-throughput matrix multiplications (GEMMs) on Tensor Cores. Pass 2 uses a single, parallel rank-1 update to broadcast the "residual" state to the next block, resolving dependencies with minimal synchronization.
- Phalanx Layer: A drop-in neural network layer utilizing SWR with a minimalist parameterization (linear projections and sigmoid gating) designed for maximum hardware utility.
Theoretical Insights: Recurrences as Matrices
By viewing a recurrence as a unit lower-triangular matrix, the authors show that classic algorithms (like Kogge-Stone) are actually just specific matrix factorizations. This allows them to design new "hierarchical" factorizations that map one-to-one onto GPU hardware.
Because stable recurrences exhibit exponential decay, distant tokens have a negligible effect on the current state. The authors found they could truncate the window to a block size of just 16 tokens—matching the hardware's native tile size—without losing model quality. This hardware-software co-design is built specifically for the Hopper GPU architecture, using Distributed Shared Memory (DSEM) to pass "carrier" signals between blocks at lightning speed, bypassing slower global memory.
Results and Efficiency
The models were trained and evaluated on FineWeb-Edu, training 1.3B parameter models for 100B tokens. Performance was measured using perplexity and training throughput across context lengths ranging from 4K to 32K.
- Speed and Throughput: Phalanx-Attention hybrids trained 28% faster than standard Transformer++ models at an 8K context length. Across 4K to 32K context lengths, the Phalanx layer achieved 10–40% higher throughput than optimized Transformers.
- Hardware Efficiency: On NVIDIA Hopper GPUs, the Phalanx hybrid improved end-to-end training throughput by 10% over pure Attention models, even at shorter sequence lengths.
- Quality: Despite the aggressive truncation of the recurrence window, Phalanx models matched or slightly exceeded the perplexity of Transformers and Sliding Window Attention (SWA) baselines.
Conclusion
While the results at 1.3B parameters are promising, further testing is needed to see if these hardware-aligned efficiencies hold at the 70B+ parameter scale. The current Phalanx layer uses a very simple gating mechanism to prioritize speed; future work may explore more sophisticated "multi-hybrid" stacks to further push the Pareto frontier of quality vs. cost. Enforcing large decay values could also enable better "recurrence mode" decoding for inference.
Summary updated