Source-linked AI summary

RouteRelay: Event-Triggered Cross-Layer Route Reuse for Efficient Dynamic Sparse Attention

Bin Li, Sisi Liu, Chenyang Hu, Chaoyang Zhang, Wei Li, Hui Song

arXiv:2609.07306v1cs.CL

TL;DR

Dynamic sparse routers rebuild chunk-score matrices layer after layer, even when routes change little. RouteRelay reuses route metadata and refreshes unstable rows; across tested routing scales it retains 100.0% recall while evaluating as little as 38.4% of full-routing score pairs.

  • Problem

    Dynamic sparse routers repeatedly rebuild chunk-score matrices even though neighboring layers often preserve broad semantic dependencies.

    Source: §1 · p. 1
  • Method

    RouteRelay stores selected chunks and sentinel candidates at anchor layers, rescores them between anchors, and fully reroutes only rows whose sentinels challenge selected chunks.

    Source: §1 · p. 1
  • Results

    Across tested routing scales, RouteRelay retains 100.0% recall while evaluating as little as 38.4% of full-routing score pairs.

    Source: §7 · p. 7
  • Takeaways & Limitations

    RouteRelay is orthogonal to approaches that summarize omitted content or vary the token budget.

    Source: §7 · p. 7

    Arithmetic savings alone are insufficient for wall-clock speedup; a fused GPU design or equivalent compiled implementation is needed to reduce memory traffic and row-management overhead.

    Source: §5.4 · p. 6

Abstract

from arXiv · show

Dynamic sparse attention reduces long-context prefill cost by routing each query chunk to a small set of key chunks at every Transformer layer. The sparse attention kernel avoids most token interactions, but the router still rebuilds a chunk--chunk score matrix layer after layer, even when the selected routes change little. We introduce RouteRelay, a router-agnostic method that reuses only route metadata across depth while continuing to compute attention with the current layer's queries, keys, and values. Anchor layers perform full routing. Intermediate layers rescore the previous top-$k$ route and a compact sentinel set of near-miss and randomly probed chunks. A query row is rerouted only when a sentinel challenges its weakest selected chunk. We give a top-$k$ stability condition, a probabilistic bound on missed challengers, and a row-selective GPU execution design. In a reproducible empirical evaluation, RouteRelay retains at least 99.99% route recall while rerouting 25.0%, 55.4%, and 78.2% of rows under low, moderate, and high cross-layer drift, respectively. Across routing scales, RouteRelay retains 100.0% recall while evaluating 38.4--51.6% of full-routing score pairs as the key-chunk count grows from 128 to 1024. Its unfused CPU execution remains slower than dense matrix multiplication, exposing row compaction and ledger updates as the main kernel-engineering targets.

1 Introduction

Dynamic sparse routers repeatedly rebuild chunk-score matrices, even though neighboring layers often preserve broad semantic dependencies. RouteRelay reuses route indices across layers and refreshes only rows whose routes become unstable.

1 Introduction

  • Dynamic sparse routing repeats across the network, although neighboring layers often preserve the same broad semantic dependencies.Reusing indices can skip rebuilding a complete score matrix without reusing attention outputs.Source: §1 · p. 1
  • RouteRelay stores selected chunks, near-miss competitors, and random sentinels at anchor layers; intermediate layers rescore these candidates and fully refresh only unstable rows.Attention at every layer still uses that layer’s own queries, keys, and values.Source: §1 · p. 1
  • The method combines a sufficient top-k margin condition with a bound on random sentinels missing multiple newly competitive chunks.Source: §1 · p. 2
  • The evaluation measures route fidelity, refreshed-row fraction, score-pair reduction, and CPU latency across drift, sentinel-ablation, and routing-scale experiments.Source: §1 · p. 2

2 Background

Chunk-based dynamic sparse routing scores query–key chunk pairs and expands selected chunks into exact token interactions. RouteRelay reuses only route IDs across layers, leaving floating-point attention quantities layer-specific.

2.1 Dynamic Sparse Routing

  • Selected chunks are expanded into token indices for sparse attention, while routing scores query–key chunk pairs and adds selection overhead.DHSA measurements show routing and chunk selection can be material components of long-context prefill time (Xiong et al.).Source: §2.1 · p. 2

2.2 Why Route Reuse Is Safer than Attention Reuse

  • Cross-layer KV sharing and attention-structure reuse reduce repeated computation, but changing KV states or attention outputs changes the model’s numerical operation.Source: §2.2 · p. 2
  • RouteRelay relays integer chunk IDs, so floating-point attention quantities remain layer-specific; only whether the selected index set matches the current route is approximate.Source: §2.2 · p. 2

3 RouteRelay

RouteRelay maintains a per-row ledger of selected routes and sentinels, then rescoring and stability tests determine whether each row can reuse its route. Random sentinels bound missed-challenger risk probabilistically, while routing-work savings depend on candidate width and the fraction of rows refreshed.

3.1 Route Ledger

  • Each row’s ledger stores selected routes and a sentinel set of near-cutoff chunks, uniformly sampled omitted chunks, and mandatory global candidates.Near-miss sentinels target local rank swaps; random sentinels hedge against low-ranked chunks becoming important after representation shifts.Source: §3.1 · p. 2

3.2 Candidate Rescoring

  • Rows reuse routes when selected candidates remain above sentinels; failed tests trigger full rescoring only for unstable rows.Forced anchors can bound the lifetime of stale random sentinels, and Figure 1 distinguishes route-index reuse from layer-specific attention computation.Source: §3.2 · p. 2, Figure 1 · p. 3

3.3 Top-k Stability

  • A selected–omitted margin greater than twice the maximum score perturbation preserves every selected–omitted ordering.The exact maximum perturbation requires the full score row, so the lemma is primarily an analysis tool; the sentinel trigger cheaply tests for violations near the decision boundary.Source: §3.3 · p. 3

3.4 Random-Sentinel Miss Probability

  • Random sentinels are most effective when route change is broad, while near-miss sentinels target isolated rank swaps; the miss bound does not guarantee perfect recall.Source: §3.4 · p. 3

3.5 Complexity

  • Routing work falls substantially when candidate width is much smaller than the key-chunk count and the refreshed-row fraction is small; sparse-attention cost is unchanged.Source: §3.5 · p. 3

4 System Design

RouteRelay maintains route metadata across layers, rescoring a fixed candidate set and fully rerouting only unstable rows while leaving the underlying router and sparse-attention backend unchanged.

4.1 Route-Maintenance Dataflow

  • Anchor layers initialize selected routes, sentinels, and anchor ages; intermediate layers refresh routes and sentinel sets only for rows that fail the stability test.Stable rows keep their routes and advance their ledger ages.Source: §4.1 · p. 3

4.2 Row-Selective Routing Kernel

  • A fixed-width batched dot product rescores candidates, while a prefix sum compacts unstable rows for complete score-row computation and ledger updates.If no rows are unstable, the full router is skipped.Source: §4.2 · p. 3

4.3 Interaction with Existing Routers

  • RouteRelay leaves boundary construction, chunk representations, token expansion, causal masking, and the sparse-attention backend unchanged, and supports route widths chosen by the underlying policy.It can be inserted between route scoring and token expansion.Source: §4.3 · p. 4

4.4 Batching and Memory

  • Ledger storage is O(nq c) indices per layer group, where c = k + m + r; with nq = 1024 and c = 64, 32-bit indices occupy 256 KB.Ledgers are bucketed by route width so compatible rows can share kernels.Source: §4.4 · p. 4

5 Evaluation

The evaluation tests route reuse under layer drift, sentinel ablations, routing scales, and CPU wall-clock cost, using top-12 routes and 12 near-miss plus 12 random sentinels by default.

5.1 Cross-Layer Route Stability

  • At drift 0.03 and 0.06, RouteRelay rerouted 55.4% and 78.2% of rows with more than 99.99% recall, versus fixed-stride recall of 94.9% and 91.2%.At drift 0.01, it rerouted 25.0% of rows with 100.0% recall; its refresh work rises with evidence of instability rather than following a fixed global stride.Source: §5.1 · pp. 4–5

5.2 Sentinel Ablation

  • Twelve near-miss sentinels recovered 100.0% recall while evaluating 50.8% of full-routing score pairs; random sentinels alone reached 92.32% recall at 14.2%.Increasing near-miss width to 24 and 48 preserved 100.0% recall but raised score-pair fractions to 55.3% and 64.2%, respectively.Source: §5.2 · p. 5

5.3 Routing-Scale Study

  • RouteRelay retained 100.0% route recall at every tested size while evaluated score pairs fell from 51.6% at 128 chunks to 38.5% at 1024.The fraction was 38.4% at 512 chunks and 38.5% at 1024; the plateau reflects full refreshes becoming a larger share of remaining work.Source: §5.3 · pp. 5–6

5.4 Wall-Clock Routing Cost

  • Across tested CPU settings, unfused RouteRelay is 1.6–3.7× slower than full routing despite evaluating fewer score pairs.Irregular gathers, row compaction, conditional full-row routing, and ledger reconstruction add overhead; the authors identify fused GPU or equivalent compiled execution as a practical implementation need.Source: §5.4 · p. 6

6 Related Work

Related work reduces attention cost by changing attention operators or sparsity patterns, sharing cache state, or optimizing inference. RouteRelay instead amortizes construction of an existing dynamic sparse route while preserving each layer’s computation.

  • Reformer, Linformer, and Performer alter the attention operator, while Routing Transformer learns content-dependent sparse neighborhoods; RouteRelay instead amortizes route construction for an existing dynamic sparse operator.Source: §6 · p. 6
  • Static-pattern methods, online structured routing, content-aware chunk routing, and query-dependent retrieval offer different sparse-attention designs; RouteRelay reduces how often an existing dynamic pattern is recomputed.Source: §6 · p. 6
  • KV-cache methods select or share retained states, whereas RouteRelay preserves each layer’s Q, K, V, softmax, and output, reusing only discrete route metadata and refreshing unstable query rows.Source: §6 · pp. 6–7
  • PagedAttention manages non-contiguous KV caches and FlashAttention reduces exact-attention memory traffic; both are complementary to reducing score pairs evaluated by a dynamic router.Source: §6 · p. 7
  • Unlike early-exit and layer-skipping methods, RouteRelay executes every Transformer layer and adapts sparse-router cost without changing the architecture or backbone weights.Source: §6 · p. 7

7 Conclusion

RouteRelay reduces repeated routing work across depth by selectively refreshing unstable rows while preserving exact sparse attention within each selected set. It maintains high route recall with fewer score evaluations, though unfused CPU execution does not turn those savings into latency gains.

  • 100.0% recall while evaluating as little as 38.4% of full-routing score pairs across the tested routing scales.Source: §7 · p. 7
  • Anchor layers compute complete routes, while intermediate layers rescore selected chunks and compact sentinels, rerouting unstable rows on demand.Source: §7 · p. 7
  • RouteRelay preserves exact sparse attention within each selected set and is orthogonal to approaches that summarize omitted content or vary token budgets.Source: §7 · p. 7
  • The slower unfused CPU path shows that arithmetic savings require a fused kernel to translate into latency gains.Source: §7 · p. 7
Loading 2609.07306v1…