---
title: Stochastic Additive No-mulT Attention (SANTA)
url: https://www.emergentmind.com/topics/stochastic-additive-no-mult-attention-santa
type: topic
---

# Stochastic Additive No-mulT Attention (SANTA)

Searching arXiv for the primary SANTA paper and a small set of related methods mentioned in the provided material so the article can include accurate citations.
Stochastic Additive No-mulT Attention (SANTA) is a stochastic sparse attention method for long-context autoregressive decoding that targets the memory-bandwidth bottleneck created by repeatedly streaming the key-value cache at each decode step. In standard scaled dot-product attention, a single query must read all $n_k$ key and value rows to compute
$$
y=\mathrm{softmax}\!\left(\frac{qK^\mathsf{T}}{\sqrt{d_k}}\right)V
=\sum_{i=1}^{n_k} p_i V_i,
$$
where $p_i$ denotes the post-softmax probability assigned to key $i$. SANTA replaces dense value aggregation with post-softmax sampling: it draws only $S \ll n_k$ indices from the categorical distribution defined by $p$ and aggregates the corresponding value rows using gather-and-add rather than dense multiply-accumulate. The method was introduced in “Stochastic Sparse Attention for Memory-Bound Inference” [2605.01910].

## 1. Decode-time motivation and computational setting

SANTA is motivated by the observation that autoregressive decoding becomes bandwidth-limited at long contexts because generating each new token requires reading the entire KV cache for all prior positions [2605.01910]. Even with highly optimized exact kernels such as FlashDecoding and FlashInfer, bandwidth dominates once $n_k$ is large because the kernel must read essentially the full KV state at every step. The paper gives a concrete scale point: for Llama-3.1-8B-Instruct at 32k tokens, streaming bf16 $K/V$ is approximately 128 MB per layer per generated token, and KV traffic scales linearly in context length $n_k$ and batch size.

For a single head with query $q\in\mathbb{R}^{1\times d_k}$, keys $K\in\mathbb{R}^{n_k\times d_k}$, and values $V\in\mathbb{R}^{n_k\times d_k}$, dense attention incurs value-stage cost per head of $O(n_k d_k)$ multiplications, $O(n_k d_k)$ additions, and $O(n_k d_k)$ memory reads for $V$. Typical head dimensions are reported as $d_k \approx 64$–$128$, while $n_k$ may range from 8k to 32k or beyond. Grouped-query attention reduces footprint by sharing keys and values across queries, but it does not remove the requirement that the cache be read at every decode step.

The central significance of this setting is that dense exact attention kernels are already highly optimized arithmetically, so further latency reduction at long contexts depends increasingly on reducing memory traffic rather than merely improving fused multiply-add throughput. SANTA therefore targets the value stage as a sparse cache-access problem rather than as a conventional low-rank or deterministic truncation problem.

## 2. Core estimator and unbiasedness

SANTA treats the post-softmax weights as a categorical distribution over indices $1,\dots,n_k$. Its default estimator uses i.i.d. draws with replacement:
$$
\widehat{AV}=\frac{1}{S}\sum_{s=1}^{S} V_{I_s},
\qquad
I_s \stackrel{\text{i.i.d.}}{\sim}\mathrm{Categorical}(p).
$$
Because
$$
\mathbb{E}[\widehat{AV}]
=\sum_i p_i V_i,
$$
the estimator is unbiased for the exact post-softmax value aggregation [2605.01910]. Sampling is implemented via inverse-CDF or categorical RNG, after which rows are gathered and added. The “No-mulT” label refers to the replacement of value-stage multiply-accumulate by gather-and-add, with only a final normalization by $1/S$.

The paper distinguishes clearly between with-replacement and without-replacement designs. SANTA’s default implementation uses with-replacement sampling, together with variance-reduced stratified or systematic constructions that preserve the same expectation. If sampling without replacement is imposed, unbiased estimation of the same target can be obtained through a Horvitz–Thompson-style correction:
$$
\widehat{AV}_{\rm HT}=\sum_{i\in\mathcal{S}}\frac{p_i}{\pi_i}V_i,
$$
where $\mathcal{S}$ is the sampled set and $\pi_i=\Pr(i\in\mathcal{S})$. The paper states that with-replacement sampling is simpler and GPU-friendly, and that the kernels use with-replacement or stratified/systematic variants with the same expectation.

This formulation implies a change in the asymptotic value-stage access pattern. Dense SDPA requires $n_k d_k$ value reads and the same order of additions and multiplications per head per query, whereas SANTA reduces this to $S d_k$ value reads, $S d_k$ additions, and only $d_k$ multiplications or divisions for normalization. When $S$ is much smaller than $n_k$, the method reduces value-cache traffic by a factor of $S/n_k$.

## 3. Variance, error behavior, and stratified variants

Let $\mu=\sum_i p_i V_i$ and define
$$
\Sigma=\mathrm{Cov}_{I\sim p}(V_I)
=\sum_i p_i(V_i-\mu)(V_i-\mu)^\top.
$$
For with-replacement sampling, the covariance of the estimator satisfies
$$
\mathrm{Cov}(\widehat{AV})=\frac{1}{S}\Sigma,
$$
and the mean-squared error obeys
$$
\mathbb{E}\!\left[\|\widehat{AV}-\mu\|_2^2\right]
=\frac{1}{S}\,\mathrm{tr}(\Sigma).
$$
The paper gives the bound
$$
\mathrm{tr}(\Sigma)\le \sum_i p_i\|V_i\|_2^2,
$$
which makes explicit that error decreases as $S$ increases. It also states a qualitative dependence on the attention distribution: variance is smaller when attention is peaked and larger when $p$ is flat or high-entropy [2605.01910].

A vector Bernstein tail bound is given under the condition $\|V_i-\mu\|_2\le V_{\max}$, yielding probabilistic control of $\|\widehat{AV}-\mu\|_2$. The empirical interpretation in the paper is that variance scales approximately as $1/S$ on log–log plots, which supports choosing $S$ to satisfy task-specific error tolerance.

To reduce variance while remaining GPU-friendly, the paper introduces equal-mass stratification over the attention CDF and names the resulting family S$^2$ANTA. The CDF $F$ over $[0,1)$ is partitioned into $S$ equal-probability strata $I_m=[m/S,(m+1)/S)$. Two variants are defined:

$$
\widehat{AV}^{\mathrm{ind}}
=\frac{1}{S}\sum_{m=0}^{S-1}V_{F^{-1}(T_m)},
\qquad
T_m\sim\mathrm{Unif}(I_m)
$$

and

$$
\widehat{AV}^{\mathrm{sys}}
=\frac{1}{S}\sum_{m=0}^{S-1}V_{F^{-1}(U+m/S)},
\qquad
U\sim\mathrm{Unif}([0,1/S)).
$$

Both are unbiased. For independent stratified sampling, the paper states
$$
\mathrm{Cov}\!\bigl(\widehat{AV}^{\mathrm{ind}}\bigr)
=\frac{1}{S^2}\sum_{m=0}^{S-1}\Sigma^{(m)}
\le_{\text{Loewner}}
\frac{1}{S}\Sigma,
$$
with strict improvement unless all stratum means coincide. Systematic sampling is likewise unbiased and empirically shows similar variance, although no general dominance theorem is claimed.

The paper also presents a general stratified estimator with stratum masses $w_j=\sum_{i\in\mathcal{S}_j}p_i$ and $m_j$ samples per stratum:
$$
\widehat{AV}
=\sum_j\frac{w_j}{m_j}\sum_s V_{I_{j,s}},
\qquad
I_{j,s}\sim p(\cdot\mid i\in\mathcal{S}_j).
$$
Classical Neyman allocation is cited as suggesting $m_j\propto w_j\sigma_j$, while the GPU kernels implement a proportional-allocation analogue across tiles based on tile mass. This suggests that SANTA is not only a sparsification mechanism but also a sampling-design problem in which estimator quality depends materially on how probability mass is partitioned.

## 4. Kernel architecture, bandwidth reduction, and implementation strategy

A central challenge for stochastic attention on GPUs is that sampling indices from the post-softmax distribution typically requires global softmax mass information to build a CDF. The paper therefore proposes two CUDA kernel strategies for parallelizing stochastic attention [2605.01910].

The first, S$^2$ANTA-prop, is a two-pass design with a global synchronization. In pass 1, the sequence dimension is split into tiles of length $B_{\rm tile}$, and per-tile exponentiated scores or equivalent local partition functions $Z_{\rm tile}$ are computed and written to global memory. The paper emphasizes that stashing scores is cheap because this stores only $1\times n_k$ scalars rather than $n_k\times d_k$ value vectors. A global budget allocation step then sums the tile masses to obtain the global partition function and assigns sample counts per tile in proportion to tile mass. Tiles with negligible mass receive $S_{\rm tile}=0$ and skip value reads. In pass 2, systematic sampling is performed within each tile using the stashed scores and allocated budget, integer counts $c_{h,n}$ are computed through stratified or systematic thresholds, and accumulation proceeds as $O_h += c_{h,n}V_{n,k}$, followed by normalization by $S$. The reported benefit is exact load balancing across tiles with maximal pruning of low-mass tiles; the reported cost is one global synchronization.

The second, S$^2$ANTA-flash, adopts speculative uniform per-tile sampling with deferred normalization. Each tile samples as if the whole mass were local, using a roughly uniform budget $S_{\rm tile}\approx S/T$. A merge kernel then computes the true global normalization and rescales tile partials:
$$
O_h = (1/Z_h)\sum_t W_{h,t}(\bar O_{h,t}/S_{\rm tile}),
$$
with
$$
W_{h,t}=\exp(m_{h,t}-m_h^*)\cdot \ell_{h,t}.
$$
This removes the global barrier and follows a FlashDecoding-style split–reduce pattern, but the paper identifies “sample waste” on low-mass tiles as the key drawback, since comparable accuracy then requires larger $S$.

The implementation discussion attributes speedups primarily to reduced value reads. At long context, value-cache streaming dominates decode time, and S$^2$ANTA-prop with sparse reads such as $S=128$ at 32k tokens yields greater than 90% reduction in value-stage traffic per query in single-head terms, together with similar arithmetic savings because the aggregation is mostly additive. Throughput-oriented details listed in the paper include contiguous gathers within tiles, shared-memory accumulation of counts $c_{h,n}$, on-the-fly RNG for systematic offsets, explicit handling of zero-budget tiles to avoid warp divergence, stashing scalar score statistics instead of vector values, and a largest-remainder integer allocator for tile budgets.

The practical implication is that SANTA’s gain depends not only on estimator sparsity but also on whether that sparsity can be mapped onto tile-local, coalesced, low-divergence GPU execution. The paper’s kernel design treats sampling as an integral part of attention implementation rather than as an abstract estimator layered on top of an unchanged dense kernel.

## 5. Bernoulli $qK^\mathsf{T}$ sampling and system-level integration

The paper presents Bernoulli $qK^\mathsf{T}$ sampling as a complementary score-stage sparsification technique. Its mechanism is to represent the normalized query as sparse ternary random variables in order to prune low-importance features and reduce key-feature reads during decoding [2605.01910]. After normalizing $q$ by a scalar norm at least as large as $\max_i |q_i|$, each element satisfies $q_i\in[-1,1]$. For samples $n=1,\dots,B$, one draws independent ternary Bernoulli vectors:
$$
b_i\sim\mathrm{Bernoulli}(|q_i|),
\qquad
\widehat q_i^{(n)} = b_i\cdot \mathrm{sign}(q_i)\in\{-1,0,+1\}.
$$
The score estimator is then
$$
\widehat p = \frac{\mathrm{norm}}{B}\sum_{n=1}^{B}\widehat q^{(n)}K^\mathsf{T},
$$
which is unbiased for $p=qK^\mathsf{T}$. Because $\widehat q^{(n)}$ is ternary, the resulting matrix product becomes multiplier-free in the sense that it can be implemented by gathering selected rows of $K^\mathsf{T}$, adding or subtracting them, and then applying normalization.

For grouped-query attention, the paper notes that the union of accessed features can approach dense if each query is sampled independently. It therefore proposes a mean group query:
$$
m=\frac{1}{|\mathcal{G}|}\sum_{g\in\mathcal{G}}|q_g|,
$$
sampled via Bernoulli on $m$, and then estimates each head’s score as
$$
\widehat p = \left(\widehat m\odot \frac{q}{m}\right)K^\mathsf{T}.
$$
This prunes features common to the group while compensating through elementwise scaling by $q/m$.

The empirical examples reported for the score stage are model-dependent. For $B=4$ in BitNet-2B, group key-feature access drops to approximately 84.7% with small accuracy loss. For Llama 8B at 4k, $B=8$ reduces key-feature access to approximately 72.8% with less than 2% accuracy degradation on NIAH and QA tasks. The paper further states that stratified Bernoulli sampling reduces variance and that the $\ell_2$ error of $\widehat p$ scales approximately as $O(1/B)$ in aggregate, consistent with Monte Carlo intuition.

SANTA and Bernoulli $qK^\mathsf{T}$ are described as orthogonal to upstream methods such as ternary or weight quantization, low-rank projections, KV-cache compression or quantization, grouped-query attention, and cache-management policies [2605.01910]. In this framing, SANTA reduces the number of accessed value elements in whatever cache representation is retained, while Bernoulli $qK^\mathsf{T}$ reduces the number of accessed key features. The paper therefore positions the combination as a route toward sparse, multiplier-free, and energy-efficient inference rather than as a replacement for compression or architectural changes.

## 6. Empirical behavior, limitations, and relation to other sparse attention approaches

On an NVIDIA RTX 6000 Ada, using single-step decode attention kernels with Llama-3.1-8B tensor shapes at 32,768 tokens, the paper reports that S$^2$ANTA-prop with $S=128$ achieves approximately $1.50\times$ speedup versus FlashInfer and FlashDecoding while matching SDPA accuracy on RULER long-context tasks within confidence intervals [2605.01910]. Under the same setting, S$^2$ANTA-flash achieves approximately $1.51\times$ speedup but requires a much larger budget, $S=2048$, to match accuracy because of speculative sample waste.

The 32k RULER results are reported as follows. For S$^2$ANTA-prop with $S=128$, the scores are FWE $95.40\pm1.10$, NIAH $98.25\pm0.62$, QA1 $64.40\pm4.50$, and QA2 $60.20\pm4.20$. For S$^2$ANTA-flash with $S=2048$, the scores are FWE $94.13\pm1.13$, NIAH $98.25\pm0.62$, QA1 $64.60\pm4.20$, and QA2 $60.00\pm4.40$. The SDPA baseline is FWE $95.60\pm1.00$, NIAH $98.35\pm0.62$, QA1 $64.00\pm4.10$, and QA2 $58.80\pm4.10$.

At 8k-token contexts, S$^2$ANTA-strat and S$^2$ANTA-sys with $S=256$ recover SDPA accuracy within approximately 1% across FWE, NIAH, and QA tasks while using only $S/n_k=3.125\%$ of value-stage reads and additions in the single-query, single-head view. For general reasoning benchmarks in a PyTorch reference implementation, the paper states that on GSM8K with Llama-3.1-8B, S$^2$ANTA-strat and S$^2$ANTA-sys approach SDPA accuracy at $S=256$, and that S$^2$ANTA-sys at $S=64$ reaches 76.42% versus SDPA 78.06% while using approximately 19% of value-stage operations and reads and no multiplications. On MMLU with the same model, S$^2$ANTA-strat and S$^2$ANTA-sys match or exceed SDPA near $S=256$ and outperform default SANTA across $S=64$–$256$.

The paper also identifies several failure modes and sensitivity patterns. Variance is higher when attention is flat, and stratified or systematic sampling improves robustness at small $S$. Layer-sensitivity ablations using one-hot attention with $S=1$ at a single layer show that certain layers are fragile, including Llama-8B’s first layer and middle layers in DeepSeek-7B, which motivates per-layer scheduling of $S$. The prefill regime is explicitly described as unfavorable for sparse value access because the union over many queries covers most value rows; the paper gives an example in which more than 94% of unique rows are read at $S=16$ across 1k–16k contexts with Gaussian inputs. This suggests that SANTA’s memory-sparsity benefits are fundamentally decode-centric even though it still reduces additions and eliminates multiplications during prefill.

The comparison to other sparse attention families is framed carefully. Deterministic top-$k$ attention reduces reads but is described as biased and potentially brittle on heavy-tailed or flat attention distributions, whereas SANTA is unbiased with controllable variance and shows stronger robustness at small budgets. Reformer, BigBird, Longformer, and Linformer are characterized as methods that restructure attention patterns or reduce complexity mainly in prefill, whereas SANTA targets decode-time bandwidth with post-softmax, distribution-aware sampling and preserves the exact distribution’s expectation [2605.01910]. The paper further states that importance-sampling approaches often operate pre-softmax, while SANTA’s novelty lies in post-softmax sampling that converts the value stage into multiplier-free aggregation of sampled value rows.

The limitations listed in the paper include sample waste in speculative kernels, higher variance in flat-attention regimes, the limited latency advantage of multiplier-free arithmetic on current GPUs optimized for dense FMAs, and the absence of strong prefill memory savings. Future directions named explicitly are tighter mass-aware scheduling without global barriers, hardware RNG and systematic samplers, adaptive per-layer $S$ selection via reinforcement learning or heuristics, end-to-end kernels combining Bernoulli score-stage sparsification with value-stage SANTA, and integration with KV compression for compound savings. Within that scope, SANTA is presented as a decode-oriented stochastic attention framework whose defining properties are unbiased post-softmax estimation, sparse value-cache access, and an implementation strategy aligned with bandwidth-dominated long-context inference.

Source: https://www.emergentmind.com/topics/stochastic-additive-no-mult-attention-santa