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

Manuscript Offprint

arXiv:2610.01763

TopK-Guided: Adaptive, Budget-Aware Activation Sparsity for Efficient LLM Inference

Mukund Agarwalla, Chih-Jen Lin

Abstract

Activation sparsity speeds up large language model (LLM) inference by setting unimportant activations to zero so that the corresponding computations can be skipped. Existing training-free methods, however, make different trade-offs: threshold-based methods such as TEAL adapt the sparsity level to each token but do not tightly control the realised sparsity, while TopK-based methods such as WINA enforce a fixed sparsity level but use the same sparsity budget for every token. Both also apply the same budget across transformer blocks, despite large differences in block sensitivity. We introduce TopK-Guided, a training-free method that addresses both limitations by combining bounded token-level sparsity adaptation with sensitivity-aware block-level budget allocation. Across Llama-2 and Llama-3 models, TopK-Guided consistently improves perplexity and downstream accuracy over TEAL and WINA while preserving essentially the same sparsity-dependent projection compute as WINA, with the largest gains at high sparsity. Ablations show that both components provide complementary improvements.

1 Introduction

Every token generated by a large language model (LLM) requires a full forward pass through the network, and within each transformer block most of this cost comes from a few large linear projections (Wq,Wk,Wv,WoW_q, W_k, W_v, W_o in attention and Wgate,Wup,WdownW_{\mathrm{gate}}, W_{\mathrm{up}}, W_{\mathrm{down}} in the MLP), each multiplying a weight matrix by an activation vector [14]. A well-documented property of trained LLMs is that many of the activation entries feeding these projections are already close to zero at inference time [12] and contribute negligibly to the output [14, 15].

Activation sparsity exploits this. Before a projection Wh, it sets the smallest-magnitude entries of the activation vector h to zero; whenever an entry hjh_j is zeroed, the corresponding column W:,jW_{:,j} can be skipped, since it only ever multiplies hjh_j. Zeroing a fraction s of the entries thus skips a fraction s of the projection's work. Unlike weight pruning [19, 7], which permanently removes the same parameters for every input, activation sparsity leaves the model untouched and chooses its sparsity pattern afresh for each token [14].

Given a target sparsity s, a method must decide, for each token, which entries of h to zero. Two recent methods define the state of the art and adopt opposite strategies. TEAL [13] calibrates, per projection, a single threshold τ\tau offline so that on average a fraction s of activation magnitudes fall below it, and at inference retains every entry above the threshold:

h~j={hj,∣hj∣≥τ,0,∣hj∣<τ.(1)\tilde{h}_{j}=\begin{cases}h_{j},&|h_{j}|\geq\tau,\\0,&|h_{j}|<\tau.\end{cases} \tag{1}

40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: AXIOM 2026: Foundations of Efficient Deep Learning — Towards predictive principles for efficient AI connecting deep learning theory, scaling laws, and efficiency.

Figure

Figure 1: Per-block sensitivity eie_i (Eq. 4) on Llama-2-7B and Llama-3-8B, shown at four probe levels sˉ∈{0.2,0.4,0.6,0.8}\bar{s} \in \{0.2, 0.4, 0.6, 0.8\}.

At inference time, the same threshold τ\tau affects each token differently: a token whose activations are mostly small loses many entries, giving it higher sparsity, while a token with larger activations keeps more, giving it a lower sparsity. The mask therefore adjusts itself to each token, a property we call token adaptivity. This adaptivity comes at a cost: since τ\tau is fixed after calibration but activation distributions vary across tokens, the realised sparsity drifts from the target ss (Appendix B), and the resulting speedup becomes unpredictable. WINA [3] takes the opposite strategy: rather than fixing a threshold and letting the number of kept entries vary, it fixes that number directly through TopK selection. For each token it keeps the k=⌊d(1−s)⌋k = \lfloor d(1 - s) \rfloor entries with the largest weight-informed score ∣hj∣⋅∥W:,j∥2|h_j| \cdot \|W_{:,j}\|_2, which ranks entries by how much each one moves the output, and zeroes the rest ( dd is the number of entries in hh). Since kk is the same for every token, exactly a fraction ss is zeroed each time, so the realised sparsity always matches the target. But fixing kk removes the token adaptivity that TEAL had for free. The two methods therefore sit at opposite ends of a single trade-off. TEAL adapts to each token but cannot control the realised sparsity, while WINA controls the sparsity exactly but cannot adapt to the token. Ideally we would want both: a mask that adjusts to each token while keeping the realised sparsity close to the target.

Both TEAL and WINA share a further limitation: they assign the same budget s to every transformer block. Blocks, however, are not equally tolerant of sparsification: sparsifying each block on its own and measuring how much its output changes shows that early blocks are far more sensitive than later ones (Figure 1). A uniform budget therefore over-sparsifies the fragile early blocks and under-uses the robust later ones.

We propose TopK-Guided, two complementary training-free modifications to WINA, one for each issue: 1) TopK-Guided masking (Section 2.1) recovers the per-token adaptivity that WINA gives up while keeping the realised sparsity within a bounded ±δ\pm\delta of the target. We reuse TEAL's calibrated threshold τ\tau to estimate how sparse each token naturally is, then clip that estimate to a narrow band ±δ\pm\delta around s, before applying TopK. 2) Sensitivity-aware block sparsity (Section 2.2) replaces the uniform budget with one matched to each block's sensitivity: a single calibration pass measures it, and sensitive blocks then get less, robust ones more. Like OWL[22], we allocate sparsity non-uniformly across blocks, but base it on a direct sensitivity measurement rather than a weight-outlier signal.

Across Llama-2-7B [20] and Llama-3-8B [9], TopK-Guided beats both TEAL and WINA on perplexity and downstream tasks at matched compute, with the largest gains at high sparsity.

References (22)