---
title: Post-Training N:M Activation Pruning
url: https://www.emergentmind.com/topics/post-training-n-m-activation-pruning
type: topic
---

# Post-Training N:M Activation Pruning

Post-training \(N\!:\!M\) activation pruning is an inference-time sparsification regime in which a pretrained model is used without retraining or fine-tuning, while the input activation tensor \(X\) of selected linear layers is pruned so that in every contiguous group of \(M\) elements only \(N\) are kept and the remaining \(M-N\) are set to zero. In large language models (LLMs), the resulting sparse activation is then multiplied by the original dense weight matrix, yielding a sparse-dense matrix multiplication; the intended benefits are dynamic, input-adaptive compression, reductions in I/O overhead, and compatibility with hardware-friendly semi-structured sparsity patterns such as \(2\!:\!4\), \(4\!:\!8\), and \(8\!:\!16\) [2508.02128][2509.22166].

## 1. Definition and mathematical setting

A generic starting point is the fully connected layer
\[
Y = XW + b,
\]
with \(X\in\mathbb{R}^{N\times IC}\), \(W\in\mathbb{R}^{IC\times OC}\), \(b\in\mathbb{R}^{OC}\), and \(Y\in\mathbb{R}^{N\times OC}\). In post-training activation pruning, the pruning target is the input activation tensor \(X\), not the weight matrix \(W\). This framing is explicit in "Post-Training Statistical Calibration for Higher Activation Sparsity" [2412.07174].

Within this setting, unstructured post-training activation pruning is typically written as elementwise thresholding:
\[
Pruner(X) = \begin{cases} X_{ij}, & \text{if } |X_{ij}| > \tau \\ 0, & \text{otherwise } \end{cases}
\text{  , where  }\tau = \text{Quantile}(|X_{calib}|, s).
\]
This rule produces dynamic, input-dependent sparsity, but it does not enforce exact local structure. By contrast, "Amber Pruner: Leveraging N:M Activation Sparsity for Efficient Prefill in Large Language Models" [2508.02128] studies strict structured masking of the input activations to linear projections during inference, under the standard semi-structured definition that within every \(M\) consecutive elements, at most \(N\) are nonzero.

The same topic is framed at a broader level in "Lightweight error mitigation strategies for post-training N:M activation sparsity in LLMs," whose abstract describes post-training \(N\!:\!M\) activation pruning as a hardware-friendly, minimally calibrated alternative that can preserve generative behavior better than weight pruning at equivalent sparsity levels [2509.22166]. This places \(N\!:\!M\) activation pruning at the intersection of structured compression, dynamic sparsity, and deployment-oriented LLM inference.

## 2. Distinction from adjacent pruning paradigms

A central conceptual distinction is between pruning activations and using activations only to score weights. "EGGS-PTP: An Expander-Graph Guided Structured Post-training Pruning Method for Large Language Models" prunes weights in linear layers under an \(N\!:\!M\) semi-structured pattern, while input activation norms appear only in the RIA importance metric used to decide which weights to keep [2508.09471]. The pruned object is therefore \(\tilde W^\ell = W^\ell \odot M\), not a runtime-sparse activation tensor.

"Symmetric Pruning of Large Language Models" is similar in this respect. Its theoretical contribution is a saliency analysis for weight pruning, with activations \(\mathbf{X}\) serving as calibration signals in formulas such as
\[
S_{jk}=|W_{jk}| \left( \|\mathbf{X}_{:j}\|_2 + \|\mathbf{Y}_{k:}\|_2 \right),
\]
and, as a special case, the Wanda score
\[
S_{jk}=|W_{jk}|\|\mathbf{X}_{:j}\|_2.
\]
These are activation-aware weight-pruning criteria, not activation-pruning rules [2501.18980].

By contrast, SCAP and Amber Pruner both sparsify the activation tensor itself at inference time. SCAP does so through dynamic magnitude thresholding of FC inputs, while Amber Pruner performs structured top-\(N\)-within-\(M\) pruning on the input activations of selected linear layers [2412.07174][2508.02128]. A recurrent misconception is therefore to treat all activation-aware pruning methods as activation pruning methods; the recent literature sharply separates activation-aware weight scoring from direct activation masking.

## 3. Mask construction, scoring, and calibration

SCAP is the clearest example of post-training activation pruning without exact \(N\!:\!M\) structure. Its runtime criterion is elementwise \(L_1\) magnitude thresholding, with thresholds calibrated from a small calibration set. The framework also introduces Mode-Centering, which shifts activations by a scalar \(\eta\) before thresholding:
\[
Y = (X-\eta+\eta)W + b,
\]
\[
Y = (X-\eta)W + \eta W + b,
\]
and then fuses \(\eta W\) into the bias:
\[
Y = (X-\eta)W + b_{fused}.
\]
The stated purpose is to pre-calibrate activation distributions for maximizing post-training sparsity when the activation distribution is not already centered near zero [2412.07174].

Amber Pruner implements exact structured activation sparsity. It begins from naïve top-\(k\) magnitude selection within each \(M\)-sized group, then replaces raw magnitude ranking with a weight-aware activation score
\[
S_{ij} = |X_{ij}| \cdot f(W_{:,j}) = |X_{ij}| \cdot \left(\frac{\|W_{:,j}\|_2}{\min_k \|W_{:,k}\|_2}\right).
\]
To make the channel multipliers more discriminative, it introduces Robust-Norm Scoring: first discard weight values outside the global \(0.5\)th–\(99.5\)th percentile range,
\[
W=\left\{\omega_k \mid Q_{0.005}(W)\le \omega_k \le Q_{0.995}(W)\right\},
\]
then standardize,
\[
\hat{W}_{ij} = \frac{W_{ij} - \mathbb{E}[W]}{\sqrt{\mathrm{Var}[W]}},
\]
and finally score activations as
\[
S^*_{ij} = |X_{ij}| \cdot f(\hat W_{:,j}).
\]
The weight-side channel multipliers are fixed per layer and can be precomputed offline, so the runtime procedure reduces to elementwise scoring followed by top-\(N\)-within-\(M\) selection [2508.02128].

The abstract of [2509.22166] places additional emphasis on lightweight, plug-and-play error mitigation techniques and pruning criteria, and states that these can establish strong hardware-friendly baselines that require minimal calibration. This suggests that post-training \(N\!:\!M\) activation pruning is not only a masking problem but also an error-control problem, especially when local structural constraints are imposed without retraining.

## 4. Selective deployment across layers and stages

The current literature does not treat all linear layers as equally prunable. Amber Pruner is explicitly designed for the prefill stage, where linear projection layers are highly compute-dense in LLM inference. The target modules include \(q\_\text{proj}\), \(k\_\text{proj}\), \(v\_\text{proj}\), \(o\_\text{proj}\), \(gate\_\text{proj}\), \(up\_\text{proj}\), and \(down\_\text{proj}\), but the actual pruning policy is selective rather than uniform [2508.02128].

Its skip policy is defined by an end-to-end perturbation measure. For example, after pruning the input activation to the query projection, the relative perturbation is
\[
e_q(Y,Y') = \frac{\|Y-Y'\|_2}{\|Y\|_2+\varepsilon}.
\]
Using this criterion, the method reports that \(k\_\text{proj}\) and \(v\_\text{proj}\) are not worth pruning because with GQA they contribute less compute; \(o\_\text{proj}\) and \(up\_\text{proj}\) are sensitive and are preserved; \(down\_\text{proj}\) is the least sensitive and is pruned in all layers; and \(q\_\text{proj}\) and \(gate\_\text{proj}\) are selectively pruned layer by layer. The reported fraction of total linear computations accelerated is \(56.1\%\) for LLaMA3.1-8B, \(57.6\%\) for Qwen2-7B, and \(56.9\%\) for Qwen3-30B-A3B [2508.02128].

SCAP addresses a broader architecture set but with a different abstraction. Rather than fixing an \(N\!:\!M\) pattern, it generalizes sparsification by input activations of fully connected layers for application across recent Transformer Decoders, MoE, Mamba2, Encoding Transformer, and pre-quantized models. The common object remains the FC input activation tensor, but the masking rule is threshold-based rather than exact semi-structured selection [2412.07174].

## 5. Empirical behavior and sparsity-pattern tradeoffs

The strongest direct evidence for structured post-training activation pruning presently comes from Amber Pruner. Under the \(8\!:\!16\) pattern, using Amber-P (all), the reported zero-shot average changes are from \(0.6772\) to \(0.6703\) on LLaMA3.1-8B, from \(0.7138\) to \(0.7058\) on Qwen2-7B, and from \(0.7252\) to \(0.7216\) on Qwen3-30B-A3B, corresponding to drops of \(-0.7\%\), \(-0.8\%\), and \(-0.4\%\), respectively. The same tables show that naïve top-\(k\) activation pruning loses substantially more: \(-5.4\%\), \(-4.5\%\), and \(-3.1\%\) at \(8\!:\!16\). The paper further reports favorable generative and long-context behavior, including LLaMA3.1-8B GSM8K \(0.8127\) versus baseline \(0.8036\), and LongBench average \(0.3091\) versus \(0.3056\) under \(8\!:\!16\) [2508.02128].

The abstract of [2509.22166] places these results in a broader comparative frame. It states that pruning activations enables superior preservation of generative capabilities compared to weight pruning at equivalent sparsity levels, and that sparsity patterns beyond NVIDIA's standard \(2\!:\!4\) are important: the \(16\!:\!32\) pattern achieves performance nearly on par with unstructured sparsity, while the \(8\!:\!16\) pattern is emphasized as a superior candidate when balancing flexibility against hardware implementation complexity. Within the limits of the available abstract, this identifies pattern selection as a first-order algorithmic variable rather than a purely hardware-driven formatting choice [2509.22166].

SCAP provides an important unstructured baseline for interpreting these structured results. It reports robust Pareto efficiency compared to prior methods, translating to a \(1.5\times\) additional LLM decoding speedup against CATS at iso model quality. On Mistral-7B, the geometric mean decoding speedup over dense is reported as \(17.7\%\) for CATS and \(27.1\%\) for SCAP, with both at \(74.2\%\) zero-shot task performance. This does not establish \(N\!:\!M\) behavior directly, but it shows that post-training activation sparsity can yield measurable wall-clock gains while preserving model quality [2412.07174].

## 6. Hardware implications, sparse kernels, and quantized deployment

The systems rationale for post-training activation pruning differs from that of weight pruning. In SCAP, the intended execution model is sparse FC or GEMV under batch size \(1\) decoding, where zero entries in the activation vector permit skipping corresponding weight channels and therefore reduce both memory traffic and multiply-accumulate work. The paper explicitly notes that decoding is memory-bandwidth-bound, that a single sparse vector is the sweet spot, and that larger batches or beam search reduce exploitable structure because masks from different vectors overlap less [2412.07174].

Amber Pruner addresses a different operating point: prefill rather than decode. It targets sparse-dense GEMM or SpMM in compute-heavy projection layers and is candid that current general-purpose hardware has limited support for fine-grained sparse activations. The paper therefore reports coverage of linear computations that can be sparsified, rather than claiming a fully realized wall-clock deployment path on commodity stacks. Experiments were run on \(8\times\) Ascend 910B processors, and the main practical caveat is the lack of optimized SpMM kernels for this setting [2508.02128].

The same work introduces Outstanding-sparse, which composes Amber Pruner with SmoothQuant-based W8A8 PTQ. Standard SmoothQuant scaling is written as
\[
s_j = \frac{\max(|X_{:,j}|)^{\alpha}}{\max(|W_{:,j}|)^{\,1-\alpha}},
\]
while Outstanding-sparse flips this factor,
\[
\hat s_j = \frac{1}{s_j},
\]
to expand activation range rather than compress it; the reported choice is \(\alpha = 0.10\). The quantization setup uses \(50\) samples from BoolQ, with activations quantized per tensor and weights quantized per channel. At \(8\!:\!16\), the reported average change from the SQ-W8A8 baseline to O-sparse is from \(0.6757\) to \(0.6654\) on LLaMA3.1-8B, from \(0.7111\) to \(0.7069\) on Qwen2-7B, and from \(0.7236\) to \(0.7153\) on Qwen3-30B-A3B [2508.02128].

## 7. Limitations, misconceptions, and open problems

The most immediate limitation is that direct work on post-training \(N\!:\!M\) activation pruning remains narrow relative to the much larger literature on structured weight pruning. SCAP is directly about post-training activation pruning, but its mask is dynamic unstructured threshold sparsity rather than exact \(N\!:\!M\); calibration controls expected global sparsity, not deterministic local structure [2412.07174]. Amber Pruner is directly about training-free \(N\!:\!M\) activation sparsity, but its current scope is mainly prefill, its realized gains are constrained by sparse kernel availability, and its strongest scoring variant is said to be not applicable to MoE because tokens are dynamically routed to experts [2508.02128].

A second limitation is conceptual confusion between direct activation pruning and activation-aware weight pruning. EGGS-PTP and Symmetric Pruning are highly relevant for scoring design, relative importance, and structured selection, but neither constructs token-dependent or runtime activation masks. In EGGS-PTP, activations enter the RIA metric used to rank weights, and the central structural idea is connectivity-aware \(N\!:\!M\) weight masking inspired by expander graphs [2508.09471]. In Symmetric Pruning, activations appear in reconstruction-based saliency formulas for deleting weights, and the paper explicitly evaluates \(2\!:\!4\) and \(4\!:\!8\) structured pruning only on the weight side [2501.18980].

Open problems follow directly from these gaps. The EGGS-PTP discussion identifies activation-pruning-relevant questions such as how to define an activation-side analogue of the bipartite expansion objective, whether dynamic \(N\!:\!M\) activation masks can be generated cheaply enough at inference time, whether sparse activation kernels deliver the same practical gains as static sparse weights, and how activation pruning should be combined with weight \(N\!:\!M\) pruning [2508.09471]. The abstract of [2509.22166] adds a complementary systems agenda by motivating future hardware to support more flexible sparsity patterns. A plausible implication is that the mature form of post-training \(N\!:\!M\) activation pruning will depend not only on better saliency rules, but also on co-design between calibration, structured masking, sparse kernel support, and pattern-specific hardware execution.

Source: https://www.emergentmind.com/topics/post-training-n-m-activation-pruning