arXiv(opens in a new tab)cs.DCOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.11201

PageWeaver: KV-Guided Query Unions for Sparse Attention

Zhiyuan Li, Zihan Li, Zefang Yuan, Lei Wang, Hao Wang

ABSTRACT

Dynamic sparse attention limits the KV pages selected by each query, but a small support does not necessarily yield efficient GPU work. Query unions share page loads and populate Tensor Core tiles; their cost depends on which queries are grouped together. We present PAGEWEAVER, an execution design that uses selected-page affinity to assemble query groups while preserving each query's original support and complete output ownership. A bounded GPU search produces query IDs, and an ID-aware two-CTA kernel consumes them without materializing reordered Q tensors or cross-page partial outputs. A direct KV-page union implementation provides a complementary design study of nonlocal reuse and reduction cost. With FP8 KV throughout, the H200 Union8 implementation achieves a 1.70×1.70\times geometric-mean complete-call speedup over the measured FlashInfer path on six captures. Online regrouping further lowers latency by 3.26–7.66% on five selected 64K-context captures. Whole-model prefill throughput is 7.88–14.36% above the tested native path; the incremental regrouping benefit is smaller, with observed median gains of 0.47–0.73% at 32K/64K and regressions at 8K. A B300 comparison identifies cases where preparation cost and a stronger native kernel remove the advantage. These results separate execution-group reuse from the complete cost of exploiting it online.

1 INTRODUCTION

Sparse attention selects a limited number of KV pages for each query, reducing the number of interactions relative to dense attention. Yet equal numbers of selected edges can produce very different execution costs. GPU Tensor Cores operate on matrix tiles, while dynamic page selection produces an irregular relation between queries and pages. Filling those tiles introduces a second scheduling problem: which queries should share a page traversal?

Query union is an established answer to part of this problem. Neighboring queries traverse the union of their selected pages, and membership masks retain each query's own support (LiteTopK Contributors, 2026). Grouping query heads supplies enough rows for a matrix tile and amortizes KV loads. Increasing the group size, however, can also enlarge the union and introduce more masked work. The choice of group size and the choice of group members are distinct optimization decisions.

Reuse must respect execution ownership. When adjacent queries share few pages, a page-oriented view can reveal reuse among distant queries. MSA's KV-outer design exploits such reuse by gathering queries for a page and merging partial attention outputs (Lai et al., 2026). We extend this view to pairs of pages sharing queries. Direct

1 Fixed TopK (illustrative subset)

Figure

Same selected pages and causal positions

2 Bounded online grouping

Choose smallest ∣Si∖U∣|S_i \setminus U|

W = 64 / 128; groups of up to 8 IDs

π=\pi =

qaq_a

qcq_c

...

qbq_b

qdq_d

...

3 Query-owned Union8 execution

CTA 0: IDs[0:4]

CTA 1: IDs[4:8]

FP8 KV

Write O[πi]O[\pi_i] at original query IDs

Figure 1. PageWeaver overview. Fixed TopK pages guide bounded query regrouping. Original IDs carry support, causal positions, and output addresses through a two-CTA Union8 kernel. The illustrated page sets are a subset; measured groups use up to eight queries and Top16.

∗^{*}Equal contribution 1^{1}SenseTime.

page union can reduce partial results, but also requires incidence inversion, work lists, and a final reduction. Our measurements show that this organization can win on controlled interleaved supports while losing on the examined model captures. Shared structure alone does not determine a profitable traversal.

PAGEWEAVER instead uses the page relation to change the members of a query-owned group (Figure 1). Within a bounded window, a GPU kernel greedily collects queries whose selected sets add few new pages. An ID-aware Union8 implementation then executes every query's complete attention and writes directly to its original output row. The selector is unchanged; membership and causal masks follow original query IDs. This design trades an online grouping cost for a smaller union without introducing cross-page output reduction.

Contributions and scope. We make three contributions. (1) We connect query-group size, page-set affinity, and output ownership in a common execution model, with direct KV-page union as a measured design alternative. (2) We implement bounded GPU regrouping and an ID-aware FP8 sparse-attention path on Hopper, retaining a complete query output within one CTA. (3) We separate base-kernel gains, incremental grouping gains, and whole-model prefill effects, including numerical comparisons and an auxiliary Blackwell study. The main evidence is an H200 MiniMax-M3 case study; selected operator captures and limited service repetitions constrain the generality of its conclusions.

References (13)