Skip to content
AI-generated research idea🟡Fairly easy💡Moderate InnovationRelated work found

Graph-Compatible Dynamic Sparse Attention for End-to-End Prefix Capture

Capture variable-width sparse attention inside bucketed CUDA graphs so local inference engines avoid falling back to slow eager execution on every decoder layer.

Time

several weeks

Compute level

Single GPU or less

Resources

Single consumer desktop with a 32 GB GPU (RTX 5090), 64–128 GiB RAM, DeepSeek-V4-Flash checkpoint, and Triton/CuTe DSL toolchain.

What the paper used

A single consumer desktop with a 32-core AMD CPU, 251 GiB RAM (capped at 16–128 GiB per model), a 32 GB NVIDIA GeForce RTX 5090 over PCIe 5.0, and an 8 TB WD_BLACK SN850X NVMe SSD; evaluated on Gemma4-26B-A4B (BF16), Qwen3.6-35B-A3B (BF16), and DeepSeek-V4-Flash (FP4) across 270 static-shape configurations (4K–128K input, 128–2K output) and eight multi-turn TraceLab coding-agent traces.

Prerequisites

CUDA Graphs, sparse attention kernels in Triton or CuTe, and LLM inference runtimes.

Scope

Modify existing TIDEWAY execution engine and sparse attention kernels.

The Gap

During decode, TIDEWAY splits each decoder layer into three piecewise CUDA Graph segments to isolate host expert paging (Section 5.2 and Figure 6). However, sparse attention—used in frontier models such as DeepSeek-V4-Flash—is left outside graph capture and executed eagerly between the attention prefix graph and the router graph.

“Sparse attention stays eager. Capturing it would require padding the candidate set to a fixed width, and a different width can change the model’s behavior.”
From the paper, Section 5.2, page 6. Matched against the PDF text.

Limitation

Leaving sparse attention in eager mode forces per-layer CPU kernel dispatch and synchronization on every decode token, eroding the launch-overhead savings of piecewise CUDA Graph replay as models scale in layer count and sparse attention complexity.

Proposed Solution

Replace eager sparse attention execution with graph-compatible dynamic scheduling using power-of-two bucketed CUDA Graphs paired with GPU-side indirection buffers (similar to FlashInfer's ragged metadata planning). Before launching the layer's captured graph, compute the sparse token index list into a fixed-address GPU buffer while masking padded slots inside the attention kernel so model numerics remain identical without changing the effective candidate set.

Why This Matters

Eliminating the eager sparse-attention gap is expected to reduce per-token CPU dispatch overhead and tighten decode step latency, particularly for deep MoE models with long-context sparse attention.

How to Get Started

How to test it: Test whether masked, bucketed CUDA Graph capture of sparse attention matches eager numerical outputs (zero output divergence) while reducing decode TPOT compared to TIDEWAY's current piecewise graphs on DeepSeek-V4-Flash at 32K–128K context under 64–128 GiB RAM; stop if graph-padding compute overhead exceeds eager launch overhead across tested context lengths.

  1. Instrument TIDEWAY's decode timeline on DeepSeek-V4-Flash (32K and 128K tokens) to isolate CPU launch time and GPU idle gaps caused by the eager sparse-attention segment.
  2. Implement bitmask-aware padding in the sparse-attention Triton/CuTe kernel so padded candidate slots contribute zero attention weight and preserve exact numerical equivalence.
  3. Integrate power-of-two bucketed CUDA Graphs merging Segment 1, sparse attention, and Segment 2 in TIDEWAY's Execution Engine.
  4. Evaluate TPOT and token-level output parity against unmodified TIDEWAY across 4K–128K static shapes.

Suggested by AI. Adapt it to your setup.

Has This Been Done?

Related work found

FlashInfer and MOIRA provide efficient primitives and ragged attention indexing for serving engines. The specific design of combining power-of-two bucketed CUDA Graphs with GPU-side indirection buffers and masked padding for dynamic sparse attention remains partially distinct.

We searched OpenAlex and arXiv for “CUDA Graph dynamic sparse attention ragged metadata LLM decode” and “Graph-Compatible Dynamic Sparse Attention for End-to-End Prefix Capture” and an AI compared the idea with the top 10 results. A small search can miss relevant work.

Source Paper

Tideway: Phase-Aware Tiered Memory Management for MoE Inference on Consumer Devices

Yifei Wang, Tsun-yu Yang, Yechen Xu +7 more · 2026

This paper introduces TIDEWAY, a phase-aware tiered memory management and execution system for running frontier-scale Mixture-of-Experts (MoE) language models locally on memory-constrained consumer PCs. When model weights exceed GPU VRAM and host RAM and spill onto an NVMe SSD, TIDEWAY unites VRAM and host RAM into a unified pool with phase-specific layouts and paging-resilient CUDA Graph execution, achieving average speedups of 1.97x in end-to-end latency, 2.40x in TTFT, and 1.61x in TPOT over state-of-the-art baselines.

Related Ideas

Is this a good idea?

Share onXLinkedIn