Editor’s introduction
The study focuses on sparse attention mechanisms in large language models (LLMs), specifically examining how input-dependent execution patterns create detectable memory access traces on shared GPUs. It identifies a micro-architectural side channel called Sparsity-Induced Memory Access (SIMA), which arises from variations in key-value cache access during inference. SparLeak, a phase-aware attack, uses these traces to infer sensitive information—such as user query attributes during prefill and reconstructed response tokens during decoding. The researchers evaluated three LLM architectures—LongChat-7B, LLaMA3-8B, and Qwen3-8B—using three sparse attention methods, including activation-based saliency, block-level scoring, and learned predictors. Findings show high attack success rates across settings, indicating that SIMA leakage is a consistent risk in sparse-attention-based inference.
Introduction
The widespread deployment of large language models (LLMs) has driven the use of increasingly long context to improve generation quality and reduce hallucinations. However, the quadratic cost of attention makes long-context inference computationally expensive. To mitigate this overhead, modern LLM systems increasingly adopt sparse attention mechanisms, which approximate full attention by selectively attending to a subset of tokens. This trend is reflected in long-context serving systems such as SGLang and vLLM, and is likely to intensify as model scales and context lengths grow. The tokens involved in sparse attention computation are typically identified using activation-based saliency, block-level scoring, or learned predictors. By pruning irrelevant tokens, sparse attention significantly reduces both prefill-phase and decoding-phase costs.
While designed for efficiency, sparse attention poses a new privacy threat in LLM inference. We find that sparse attention induces secret-dependent memory accesses in the GPU memory hierarchy by dynamically selecting and retrieving Key-Value (KV) tensors based on semantic relevance. These accesses occur internally during GPU execution and are not directly exposed through the LLM service interface. However, they induce observable contention in shared GPU micro-architectural components, such as caches and TLBs. From a security perspective, this effect gives rise to a new side-channel surface rooted in sparsity-induced memory access (SIMA) behavior, which has not been explored by existing works. The SIMA side channel captures how sparse attention externalizes semantic information through data-dependent interactions with the GPU memory hierarchy.
Challenges. While the SIMA side channel exposes a promising and principled attack surface, translating this leakage into practical, end-to-end attacks is non-trivial. Successfully exploiting SIMA in real LLM deployments requires overcoming several critical technical challenges. First, SIMA behavior is not directly observable. An attacker cannot see KV accesses or sparsity decisions, and must instead infer them indirectly from noisy GPU micro-architectural signals. Compounding this difficulty, LLM inference consists of two execution phases, prefill and decoding, with fundamentally different parallelism and access patterns: the prefill phase processes tokens in parallel and thus exposes a cumulative signal, whereas the decoding phase proceeds token by token and exposes a step-wise signal. These phases produce SIMA traces with distinct temporal structures and leakage characteristics, making it necessary to design phase-specific extraction methods. Second, even when micro-architectural leakage can be captured, it is spatially coarse. KV tensors are managed at virtual-memory page granularity, and each observed page access aggregates the KV states of many tokens. Consequently, the attacker only observes page-level SIMA traces that collapse multiple token-level accesses into a single event, obscuring fine-grained sparsity structure and discarding much of the information needed to distinguish individual tokens or prompt regions. Third, sparse attention traces encode computational importance rather than explicit lexical content. Recovering meaningful private information therefore requires reconstructing latent access structure and learning the statistical relationship between SIMA traces and high-level semantics or token identities.
Solutions. We present SparLeak, the first phase-aware side-channel framework that exploits SIMA behavior during LLM inference. SparLeak observes GPU micro-architectural signals and abstracts them into SIMA traces that reflect the input-dependent KV access behavior in prefill and decoding phases, respectively. SparLeak then converts these traces into approximate sparsity patterns and uses them as a structural signal to infer sensitive information without accessing the victim’s KV contents. To enable practical exploitation of SIMA leakage, SparLeak incorporates the following designs.
First, SparLeak introduces two GPU side-channel primitives to extract SIMA traces. It distinguishes prefill and decoding phases solely from GPU execution dynamics: the prefill phase performs highly parallel computation over the input context, whereas the decoding phase proceeds sequentially, generating one token at a time. Exploiting this transition, SparLeak recovers cumulative SIMA traces during the prefill phase using an L2-cache–based Invalidate+Compare primitive, and extracts step-wise SIMA traces during the decoding phase using a TLB-based Evict+Reload primitive.
Large Language Models Inference
Sparse attention. To improve inference efficiency, recent work proposes sparse attention mechanisms, motivated by the observation that only a small subset of tokens contributes substantially to attention outputs. Rather than attending to all tokens, sparse attention selectively restricts attention computation to a subset of tokens chosen based on the current query or decoding token, reducing computation and memory overhead in both prefill and decoding phases.
Existing sparse attention approaches mainly focus on identifying important tokens without explicitly computing full attention scores. They can be broadly categorized into three classes: (1) activation-based saliency methods that infer importance from model activations or residual norms; (2) block-level scoring methods that approximate attention at the block or page level and retain tokens from high-scoring blocks; and (3) learned predictors that use lightweight models to directly predict important tokens.
Under sparse attention, the model first identifies a subset of important tokens for a given token. This selection is ultimately realized at page granularity by the GPU memory subsystem: when a token is selected, the virtual memory pages containing its KV tensors are fetched from HBM into the on-chip cache hierarchy. The fetched KV tensors are then consumed by streaming multiprocessors (SMs) for attention computation, while tokens that are not selected do not trigger page accesses. Consequently, sparse attention induces data-dependent page-level memory access patterns that implicitly aggregate the activities of multiple tokens co-located within each page.
Motivation
In this section, we characterize sparsity patterns induced by sparse attention during LLM inference. These patterns differ between the prefill and decoding phases, revealing sensitive information about user queries and LLM generated responses, which motivates the SIMA side channel.
Sparse attention mechanisms fundamentally alter the execution behavior of LLM inference. By selectively computing attention over only a subset of tokens, sparse attention induces structured, input-dependent selection of key-value (KV) states, in contrast to dense attention where all tokens are uniformly accessed. While these selection decisions are made at the model level, they directly determine which KV tensors are accessed during inference and how frequently they are reused. From an execution perspective, such non-uniform KV access behavior inevitably translates into data-dependent interactions with the GPU memory hierarchy. Therefore, we characterize the sparsity patterns produced by sparse attention in the prefill and decoding phases, and show that they exhibit qualitatively different structures across the two phases. These differences motivate a phase-aware view of sparsity-induced leakage and SIMA-based side-channel attacks.
We use the LLaMA3-8B model with sparse attention enabled. In our setting, each inference request is formed by concatenating a fixed system prompt and a user-provided query. Unless otherwise stated, the prompt is identical across all motivation experiments and is constructed from an open-source healthcare dataset. All inputs are issued under a fixed system prompt built from an open-source healthcare dataset, with a total prompt length of approximately 2K tokens. During the prefill phase, sparse attention selects the top 10% of prompt tokens for each query token based on approximate attention scores.
Prefill-phase sparsity pattern. During the prefill phase, LLM processes entire input context in parallel under sparse attention. Rather than attending uniformly to all context tokens, sparse attention selectively activates a subset of tokens whose KV states contribute to the attention computation. As prefill proceeds, these selective activations form a characteristic sparsity pattern over the input context, reflecting how attention is distributed across different parts of the input.
Decoding-phase sparsity pattern. In contrast to the prefill phase, decoding phase proceeds autoregressively. At each decoding step, sparse attention selectively activates only a limited subset of context tokens when computing the next-token representation. Consequently, the sparsity pattern observed at a given step reflects which parts of the input context are selectively attended at that moment.
Threat Model
Adversary and attack goal. We consider an unprivileged adversary that runs a co-resident spy process on the same physical GPU as the victim, following the standard co-residency threat model in GPU side-channel attacks. The spy process issues GPU probing operations to observe micro-architectural effects induced by the victim’s sparse-attention computation.
The adversary’s goal is to infer sensitive information about both the user query and the LLM’s response via the SIMA side channel. Concretely, the adversary (i) performs Query Attribute Inference (QAI) by exploiting cumulative SIMA behavior during the prefill phase, and (ii) conducts Autoregressive Token Recovery (ATR) by leveraging step-wise SIMA observations during the decoding phase.
Adversary capabilities. Consistent with prior work, we consider an unprivileged adversary co-resident with the victim on the same physical GPU. This setting can arise when a local user runs a CUDA workload on a shared GPU or when a remote tenant’s job is co-scheduled on the same non-partitioned GPU. The adversary requires only user-level CUDA access and monitors memory-related micro-architectural effects, including L2 cache activity and TLB residency across context switches, by measuring the latency of its own probes. This requires no privileged counters, driver modifications, or access to victim memory. The resulting observations expose secret-dependent access patterns induced by sparse attention without directly revealing KV contents or exact victim addresses.
In addition, the adversary has no control over GPU scheduling or exact execution timing. Under the fixed-template serving setting and a fixed model and runtime configuration, we further assume that the adversary can calibrate contention-based probe mappings for the corresponding prompt-side KV pages offline and reuse them across victim invocations, without accessing KV contents or recovering exact runtime addresses.
Threat surface and practicality. Data-dependent KV accesses induced by sparse attention create the observable GPU memory effects exploited by SparLeak. We consider co-resident execution alongside deployed LLM services during normal, uninterrupted operation. Such services maintain long-lived model processes to avoid repeated initialization and continuously serve incoming requests. In this setting, the monitored prompt-side KV allocations are reused across requests, allowing offline page-probe mappings to remain applicable.
Prefill-Phase Sparsity Reconstruction
Reconstructing token-level sparsity patterns from page-level SIMA traces is challenging because page-level observations compress the activations of multiple tokens into a single value, thereby losing fine-grained intra-page information. A straightforward reconstruction that uniformly distributes the observed accesses across tokens within each page would fail to preserve the highly non-uniform structure of sparse attention. Fortunately, we find that the page-level cumulative access frequency is correlated with the latent token-level activation distribution within the page, providing a useful statistical cue for reconstruction.
This correlation is consistent with how sparse attention selects tokens during the prefill phase. For all query tokens, sparse attention repeatedly reuses only a small subset of highly relevant prompt tokens, while most prompt tokens are selected rarely. Such repeated selection yields a long-tailed distribution of token-level activation frequencies. Since page-level frequency is computed by summing token-level activations within each page, pages that contain one or more frequently selected tokens naturally accumulate higher total frequency and appear more concentrated at the token level. Conversely, pages dominated by infrequently selected tokens accumulate lower frequency and consequently appear flatter.
Motivated by this observation, SparLeak performs distributional reconstruction to reconstruct an approximate token-level sparsity from page-level SIMA traces. Concretely, SparLeak treats each page’s observed frequency as a control signal that determines how concentrated the token-level sparsity distribution should be: higher-frequency pages are modeled with more skewed token participation, while lower-frequency pages are modeled with flatter participation. The reconstructed token-level sparsity is generated in a way that preserves consistency with observed page-level frequency.
Decoding-Phase Sparsity Reconstruction
The decoding phase introduces a distinct reconstruction challenge. Unlike the cumulative prefill-phase trace, the step-wise SIMA trace provides only a binary observation for each page: an activated page indicates that some token within it is accessed, but does not reveal its intra-page activation pattern. We therefore examine whether the spatial distribution of activated pages at each decoding step provides additional information for reconstruction.
This behavior is consistent with the locality of sparse attention during the decoding phase. At each decoding step, sparse attention selects only a small set of prompt tokens, and these selections are not uniformly distributed across the prompt. Instead, selected tokens tend to cluster within a few contiguous regions, while most regions receive no activation. The page-level SIMA trace provides a coarse projection of this token-level selection onto page boundaries: clustered token selections lead to dense page-level activation, whereas isolated selections result in sparse page-level signals.
Motivated by this observation, SparLeak reconstructs an approximate token-level sparsity pattern by exploiting spatial locality in sparse attention. SparLeak uses the local density of page-level activations around a target page as a proxy for the extent of intra-page token participation. Based on this proxy, SparLeak instantiates a representative token-level sparsity pattern that is consistent with the observed page-level SIMA trace, while preserving the spatial structure and step-wise dynamics of sparse attention.
Evaluation Setup
Models. We evaluate three representative LLMs from different model families: LongChat-7B, LLaMA3-8B, and Qwen3-8B. Each model is configured with three classes of sparse attention mechanisms: (1) activation-based saliency, which identifies important tokens by comparing intermediate activations; (2) block-level scoring, which groups tokens into blocks or pages and computes approximate attention scores at the block level; and (3) learned predictors, which employ lightweight predictors to directly select salient tokens.
Datasets. We use three widely adopted datasets for privacy-sensitive evaluation: Healthcare, Financial QA, and Legal QA. In the Healthcare dataset, each sample contains only attribute values. We construct LLM inference requests by transforming these attributes into unstructured queries using templates generated by a public model. For the Financial QA and Legal QA datasets, we summarize multiple attributes within each query to enable attribute inference attacks. All constructed queries are fed into the deployed LLMs to generate responses, which are subsequently used to perform autoregressive token recovery attacks.
Metrics. We evaluate attack effectiveness separately for the prefill and decoding phases using phase-specific attack success rates. The prefill-phase attack success rate (PASR) is the fraction of correct attribute predictions among queries containing the corresponding attribute. Its denominator may therefore vary across attributes. The decoding-phase attack success rate (DASR) is the fraction of correctly reconstructed tokens per response, averaged across queries. Ablation studies additionally report the similarity between extracted SIMA traces and ground-truth sparsity patterns.
Attack Performance
Overall effectiveness. In the end-to-end attack, average PASR exceeds 91% across all datasets, while DASR ranges from 84.6% to 89.4%, with every setting exceeding 80%. The high O(T) performance confirms that token-level sparsity patterns inherently encode substantial information about private queries and generated responses. O(P+R) remains within approximately one percentage point of O(T), showing limited information loss from page aggregation after reconstruction. End-to-end performance is only about 2.5 points below the token-level oracle, showing that reconstruction recovers most information from noisy page-level traces.
Impact of attribute complexity. PASR varies across attribute types. Attributes with fewer classes, such as Gender in Healthcare, achieve near-perfect accuracy (around 97.9%), whereas those with larger label spaces, such as Entity in Financial QA, yield lower PASR (approximately 87.3%), reflecting the difficulty of distinguishing more semantic classes. Decoding DASR is less sensitive to attribute semantics because token recovery reconstructs output sequences. However, Financial QA consistently yields lower DASR than Healthcare and Legal QA, reflecting the greater lexical diversity and structural complexity of financial responses.
Impact of sparse attention mechanisms. Sparse attention mechanisms affect attack performance in both phases. Activation-based methods yield lower prefill PASR (approximately 86.4%) than block-level scoring and learned predictors, with the latter achieving the highest PASR (around 95.5%). Decoding follows a similar trend: activation-based methods yield lower DASR, block-level scoring provides moderate improvements, and learned predictors perform best across datasets and model backbones. These results suggest that more accurate sparsity estimation reduces information loss in SIMA traces, benefiting both attribute inference and token recovery.
Conclusion
We present SparLeak, the first study of micro-architectural privacy leakage in sparse-attention-based LLM serving. Sparse attention produces distinctive sparsity-induced memory access (SIMA) patterns that expose sensitive information through shared GPU resources. SparLeak exploits phase-specific SIMA traces for query attribute inference during prefill and autoregressive token recovery during decoding. Evaluations across multiple LLMs, sparse attention mechanisms, and datasets demonstrate its effectiveness and robustness.


