Scale contexts beyond millions of tokens with Ring Attention and Native Sparse Attention (NSA), prove the State Space Duality (SSD) in Mamba-2, design Agent-Computer Interfaces (SWE-agent), and bridge VLMs to 50Hz continuous robot control (Pi-Zero).
1.Breaking the million-token context wall: Ring Attention and NSA#
Even when FlashAttention-2 eliminates quadratic HBM intermediate storage, two fundamental walls remain as sequence length scales from to tokens:
- Single-GPU Activation & KV Capacity Wall: The linear activations and KV cache eventually exceed a single GPU's 80 GB HBM.
- Quadratic Compute Wall: At , full causal attention requires the FLOPs of , dominating pretraining and prefill latency.
1.1Ring Attention: Overlapping P2P communication with blockwise attention#
Liu et al. (Ring Attention, arXiv:2310.01889[3]Ring Attention with Blockwise Transformers for Near-Infinite ContextOpen arXiv:2310.01889 ↗) solved the single-GPU capacity wall by partitioning a long sequence of length across devices connected in a logical ring, where device holds a local chunk of length .
Using the exact same Online Softmax rescaling identity as FlashAttention, each device computes blockwise attention between its stationary local and the currently resident chunk while asynchronously sending to neighbor and receiving the next chunk from . As long as the per-block compute time exceeds the peer-to-peer transfer time:
inter-device communication is hidden behind attention compute, scaling context length linearly with cluster size!
1.2Native Sparse Attention (NSA): Hardware-aligned trainable sparsity#
Ring Attention distributes the work, but still pays total FLOPs. Traditional sparse attention heuristics fail on modern GPUs because scattered token lookups destroy Tensor Core block-loads and non-differentiable pruning breaks pretraining.
Yuan et al. (Native Sparse Attention / NSA, arXiv:2502.11089[9]Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse AttentionOpen arXiv:2502.11089 ↗) introduced an end-to-end trainable, hardware-aligned architecture that replaces full keys and values with three parallel branches gated by learned per-branch weights :
- Token Compression (): An MLP with intra-block positional encoding compresses contiguous blocks of length (stride ) into coarse summary tokens, capturing global context.
- Blockwise Token Selection (): Using the importance scores already computed during compression Attention, NSA selects the top- most relevant contiguous blocks of length . Crucially, all query heads within a GQA group share the exact same selected KV blocks, enabling contiguous HBM-to-SRAM block loads that keep Tensor Core arithmetic intensity balanced!
- Sliding Window (): A local window of recent tokens preserves fine-grained nearby syntax without dominating global selection.
At , NSA matches or outperforms Full Attention across reasoning benchmarks while achieving faster forward propagation, faster backward propagation, and faster decoding.
2.Mamba-2 and Structured State Space Duality (SSD)#
Can we eliminate the growing KV cache altogether and achieve strictly linear training and -memory decoding? Dao and Gu (Mamba-2, arXiv:2405.21060[5]Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space DualityOpen arXiv:2405.21060 ↗) proved a deep mathematical equivalence—Structured State Space Duality (SSD)—showing that Selective State Space Models (SSMs) and Linear Attention are two dual views of the exact same semiseparable matrix multiplication.
Consider the discrete recurrence of a selective SSM with scalar decay (diagonal ):
Unrolling the recurrence from to yields:
Define the lower-triangular 1-semiseparable mask matrix with entries for and for . Stacking along the sequence dimension reveals that the entire sequence transformation is simultaneously:
- Linear Recurrent Form ( sequential/scan): State-space recurrence over .
- Quadratic Attention Form ( matmul): Causal linear attention with query , key , value , and multiplicative decay mask :
By partitioning the sequence into chunks of length , Mamba-2's SSD algorithm evaluates intra-chunk tokens via parallel Tensor Core GEMMs (the quadratic view) and passes inter-chunk state via linear SSM recurrence—running faster than Mamba-1 while utilizing hardware Tensor Cores at full efficiency!
3.Agent-Computer Interfaces (ReAct & SWE-agent) and Formal Reasoning#
When LLMs step outside static text completion to act in external environments, system reliability shifts from tensor kernels to the interaction loop and interface contract:
- ReAct (Yao et al., arXiv:2210.03629[1]ReAct: Synergizing Reasoning and Acting in Language ModelsOpen arXiv:2210.03629 ↗) interleaved explicit
Thoughttraces with externalActioncalls andObservationfeedback. Reasoning traces maintain working-memory plans, while observations ground the model against external truth and halt hallucination cascades. - SWE-agent and the Agent-Computer Interface (ACI) (Yang et al., arXiv:2405.15793[4]SWE-agent: Agent-Computer Interfaces Enable Automated Software EngineeringOpen arXiv:2405.15793 ↗) proved that giving an LLM a raw Linux bash shell is like forcing a human developer to code without an IDE:
grepdumps thousands of lines that pollute the context window, andsededits silently corrupt syntax. SWE-agent designed a dedicated ACI:- A 100-line windowed file viewer with explicit line numbers and navigation commands (
scroll_down,goto). - A lint-guarded
editcommand that automatically runs a syntax/flake8 checker before applying any patch—rejecting syntactically broken edits immediately so the agent never wastes 10 turns debugging a missing parenthesis. - Context-compressed search and observation folding that collapses stale terminal outputs to preserve effective context capacity.
- A 100-line windowed file viewer with explicit line numbers and navigation commands (
- DeepSeek-Prover-V1.5 (Xin et al., arXiv:2408.08435[7]DeepSeek-Prover-V1.5: Harnessing Proof Assistant Feedback for Reinforcement Learning and Monte-Carlo Tree SearchOpen arXiv:2408.08435 ↗) applied this closed-loop interaction paradigm to formal mathematics in Lean 4. By combining GRPO reinforcement learning on compiler verification feedback (RLPAF) with RMaxTS (a Monte-Carlo Tree Search variant driven by intrinsic exploration rewards and Lean 4 tactic state truncation), it unified continuous LLM intuition with deterministic formal proof checking.
4.Embodied AI and Vision-Language-Action Models: RT-2, OpenVLA, and #
The final frontier extends multimodal foundation models into the physical world via Vision-Language-Action (VLA) architectures:
| VLA Architecture | Backbone Scale | Action Representation & Decoding | Effective Control Rate | Key Engineering Tradeoff |
|---|---|---|---|---|
| RT-2 (arXiv:2307.15818[2]RT-2: Vision-Language-Action Models Transfer Web Knowledge to Robotic ControlOpen arXiv:2307.15818 ↗) | (PaLI-X) | 256 discrete text bins per DoF (), autoregressive tokens | Transfers web VQA semantics directly into robotic control, but limited by slow autoregressive token quantization | |
| OpenVLA (arXiv:2406.09246[6]OpenVLA: An Open-Source Vision-Language-Action ModelOpen arXiv:2406.09246 ↗) | (Llama-2 + DINOv2 + SigLIP) | 256 discrete action tokens in vocabulary; supports LoRA & 4-bit quantization | Dual vision encoders fuse spatial geometry (DINOv2) + semantics (SigLIP); beats 55B RT-2 with fewer parameters | |
| (Pi-Zero) (arXiv:2410.24164[8]pi_0: A Vision-Language-Action Flow Model for General Robot ControlOpen arXiv:2410.24164 ↗) | VLM + Action Expert | Conditional Flow Matching over continuous action chunks ( steps) | Replaces discrete token quantization with an ODE flow vector field , unlocking dexterous laundry folding and bimanual assembly |
Why did (Pi-Zero) abandon RT-2 and OpenVLA's discrete 256-bin tokenization? Because high-frequency dexterous manipulation ( bimanual control) cannot tolerate quantization jitter or slow token-by-token decoding. By coupling a pretrained VLM backbone with a dedicated Flow Matching Action Expert via blockwise causal attention, learns a continuous vector field that transports Gaussian noise to a smooth -step continuous motor trajectory in just lightweight Euler integration steps:
5.Series synthesis#
Across the first six chapters of this monograph, a single engineering principle recurs: breakthroughs in modern AI happen at the boundary where mathematical formulation meets hardware reality—whether rotating queries in the complex plane (RoPE), tiling Online Softmax into SRAM (FlashAttention-2), absorbing low-rank decompression matrices into queries (DeepSeek MLA), normalizing group rewards to drop the Critic (GRPO), or integrating flow-matching ODEs for 50Hz physical control ().
6.References#
- Liu et al., Ring Attention with Blockwise Transformers for Near-Infinite Context (2023).
- Yuan et al., Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention (2025).
- Dao & Gu, Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality (2024).
- Yang et al., SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering (2024).
- Black et al., : A Vision-Language-Action Flow Model for General Robot Control (2024).
- Continue to Chapter 7: 2026 Flagship Co-Design: Sub-Kilobyte CED KV Cache, Depth-Wise Attention Residuals, and Muon.
References
- [1]
- [2]
- [3]
- [4]
- [5]
- [6]
- [7]
- [8]
- [9]