Punctuation-aware Hybrid Trainable Sparse Attention for Large Language Models

Junxiang Qiu, Shuo Wang, Zhengsu Chen, Hengheng Zhang, Jinda Lu, Changcheng Li, Xinting Hu, Qi TianNeurIPS 2026

TL;DR

When large language models read massive documents, they save compute by skipping over irrelevant chunks of text—a trick called sparse attention. Usually, models decide which chunks to read by averaging all the words in a chunk together, which unfortunately turns sharp, important details into semantic mush. This paper shows that giving humble punctuation marks a dedicated seat at the table prevents this signal dilution, letting models ignore over 97% of a document while actually outperforming full, dense attention.

What Problem Does This Paper Address?

At the heart of modern LLMs lies the attention mechanism, where every new token looks back at every previous token. For a sequence of length $L$, this requires $O(L^2)$ operations. Feed a model a whole codebase or a novel, and your GPU memory and latency explode.

Figure 1: Comparison of the computational complexity of single-layer attention under dense (blue) and sparse (orange) settings for different sequence lengths.

Sparse attention fixes this by restricting attention to only the most relevant past tokens, dropping complexity to $O(L)$. To quickly find those relevant tokens without reading everything, existing methods chop the past text into fixed-size blocks (say, 16 tokens) and compute a single "summary" vector for each block via average pooling.

Here is the catch: averaging a 16-token block dilutes critical keywords—like a specific entity or number—with surrounding filler words. When you push the model into extreme sparsity (selecting only a tiny fraction of blocks to save maximum compute), those washed-out block summaries cause the model to miss vital context, and performance falls off a cliff.

Methods

Prior interpretability research noticed something peculiar about LLMs: they naturally use punctuation marks (commas, periods, semicolons, brackets) as semantic "anchors" that absorb and summarize the meaning of the preceding clause or sentence.

Building on this, the authors introduce Punctuation-aware Hybrid Sparse Attention (PHSA). Standard sparse setups divide the key-value cache into equal-sized blocks, automatically keeping the very first block (attention sinks) and a local window of recent tokens, while forcing intermediate blocks to compete for "Top-$K$" selection. PHSA keeps this standard scaffolding, but redesigns how each candidate block summarizes itself using a dual-branch aggregation:

  1. Global Branch ($M_0$): The standard mean-pooling of all token keys in the block.
  2. Punctuation Branch ($M_p$): Mean-pooling strictly over pure punctuation tokens in the block (identified automatically from the tokenizer vocabulary). If a block has no punctuation, it falls back to $M_0$.
Figure 2: Pipeline of PHSA. By splitting key blocks, we first compute the dual-branch representative tokens for each block, then calculate the relevance score with the query. Finally, we select the Top-K blocks, which, together with the initial block and local window blocks, form the to-be-computed indices for sparse attention.

These two vectors are blended via a simple weighted sum: $M(B_t) = \lambda M_0 + (1 - \lambda) M_p$ (with $\lambda = 0.9$ across experiments). Queries score against these hybrid block representatives to pick the Top-$K$ blocks. Crucially, PHSA works both as a plug-and-play, training-free upgrade during inference and as a native, trainable sparse attention mechanism.

Datasets

No new benchmarks were introduced; instead, the authors tested across a wide suite of existing datasets:

  • Training: Open-source corpora including DCLM, MAP-CC, UltraChat, Tulu V3, FineMath, MegaMath, plus proprietary educational data (punctuation made up ~10.16% of training tokens).
  • Evaluation: 15 general capability benchmarks (including GSM8K, MATH, MMLU, CMMLU, HumanEval, BBH), alongside long-context stress tests LongBench (QA, summarization, few-shot, and code) and Needle-in-a-Haystack (NIAH) for long-range retrieval.

Key Insights and Ideas

  • It really is about punctuation, not just "extra tokens": Could the boost just come from up-weighting any subset of tokens? When the authors replaced the punctuation branch with random tokens or high-frequency words, performance dropped back down. Punctuation uniquely acts as a structural boundary marker.
  • Code brackets count as punctuation too: Excluding general-purpose symbols like (), [], {} and %—keeping only prose delimiters like periods and commas—tanked LongBench scores from 28.13 to 26.76, hurting both code tasks and general QA.
  • Language-specific punctuation matters: Training with only English punctuation hurt performance on Chinese benchmarks. Simply adding Chinese punctuation marks to the filter set immediately recovered accuracy.
  • Train sparse to infer sparse: Training a model with a small Top-$K$ (like $K=2$ or $4$) forces it to pack sharper routing signals into its representations, preventing collapse when starved of tokens at inference time—though setting $K=0$ or $1$ during training is too extreme and degrades learning.

Key Results

  • Extreme Sparsity Retrieval: On 32k-token NIAH tasks at 97.3% sparsity, native PHSA training cuts retrieval error rates by 10.8% relative to the state-of-the-art sparse baseline InfLLM v2 (reaching 95.0% accuracy vs. 84.2% at Top-$K$=16).
Figure 3: Comparison of NIAH scores for PHSA and InfLLM v2 (training vs. training-free) at 32k sequence length.
  • Beating Dense Attention: On LongBench, PHSA achieves an average score of 28.13 (and 28.15 with bilingual punctuation), beating both InfLLM v2 (27.40) and full dense attention (27.86). On 15 general benchmarks (100B training tokens), PHSA at Top-$K$=4 averages 49.27, again edging out dense attention (48.96)—likely because filtering out noisy tokens sharpens model focus.
  • Plug-and-Play Gains: Applied without training to Qwen3-8B and MiniCPM4-0.5B, PHSA consistently improves NIAH retrieval across 16k and 32k contexts (with and without reasoning/"thinking" modes).
  • Virtually Free: At 32k sequence length, PHSA matches InfLLM v2 in peak memory (2692 MiB), throughput (1.46M tok/s), and latency (~22.47 ms).

Limitations and Future Work

The authors note that blindly throwing every punctuation token from a vocabulary into the punctuation branch likely introduces some noise alongside the useful semantic boundaries. Due to compute and space constraints, they left fine-grained screening—figuring out the optimal, minimal subset of punctuation anchors—as a promising avenue for future work.

Summary updated

Abstract

Attention serves as the fundamental mechanism for long-context modeling in large language models (LLMs), yet dense attention becomes structurally prohibitive for long sequences due to its quadratic complexity. Consequently, sparse attention has received increasing attention as a scalable alternative. However, sparse attention can miss relevant context, especially when very few tokens are selected. One possible reason is that averaging token representations within a block can dilute signals from important tokens, making relevant context harder to identify. To address this issue, we propose Punctuation-aware Hybrid Sparse Attention (PHSA), a trainable sparse attention mechanism. PHSA uses punctuation tokens, which often mark the ends of clauses and sentences, as an additional source of contextual information. It combines the average representation of all tokens in each block with a separate average over its punctuation tokens to guide context selection. We further study how training sparsity affects performance when only a small fraction of tokens is selected during inference. Experiments show that PHSA achieves a higher average LongBench score than both dense attention and InfLLM v2, while reducing retrieval errors by 10.8\% relative to InfLLM v2 at 97.3\% sparsity on 32k-token inputs.
BibTeX
@inproceedings{qiu2026punctuation,
  author = {Junxiang Qiu and Shuo Wang and Zhengsu Chen and Hengheng Zhang and Jinda Lu and Changcheng Li and Xinting Hu and Qi Tian},
  title = {{Punctuation-aware Hybrid Trainable Sparse Attention for Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=zsdhlfnDSO},
}
Figure