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, existing sparse attention methods rely on coarse-grained semantic representations during block selection, which blur intra-block semantic boundaries and lead to the loss of critical information. To address this issue, we propose Punctuation-aware Hybrid Sparse Attention (PHSA), a natively trainable sparse attention framework that leverages punctuation tokens as semantic boundary anchors. Specifically, (1) we design a dual-branch aggregation mechanism that fuses global semantic representations with punctuation-enhanced boundary features, preserving the core semantic structure while introducing almost no additional computational overhead; (2) we introduce an extreme-sparsity-adaptive training and inference strategy that stabilizes model behavior under very low token activation ratios. Extensive experiments on general benchmarks and long-context evaluations demonstrate that PHSA consistently outperforms dense attention and state-of-the-art sparse attention baselines, including InfLLM v2. Specifically, for the 0.6B-parameter model with 32k-token input sequences, PHSA can reduce the information loss by 10.8% at a sparsity ratio of 97.3%.
The Challenge of Long-Context Modeling
Large Language Models (LLMs) struggle with long sequences because the standard "dense" attention mechanism has quadratic complexity ($O(L^2)$)—doubling the text length quadruples the computational cost. To mitigate this, researchers utilize sparse attention, which restricts the model's focus to a subset of the text.
Most current sparse methods group tokens into blocks and use average pooling to create a summary vector for each block. However, average pooling is often a "blunt instrument." It dilutes critical information—such as a specific key entity or a logical pivot—by averaging it with surrounding filler words. This "semantic blurring" leads to significant information loss, particularly in extreme sparsity regimes where the model ignores 95% or more of the context.
PHSA: Leveraging Punctuation as Semantic Anchors
PHSA moves away from simple averaging by leveraging the structural role of punctuation marks as "semantic anchors" to select the most relevant text blocks during long-context processing.
Core Components
- Dual-Branch Aggregation: For every block of text, PHSA calculates two representative vectors: a Global Branch ($M_o$) using standard average pooling of all tokens, and a Punctuation Branch ($M_p$) that pools only punctuation tokens (commas, periods, semicolons).
- Gating Mechanism: These branches are fused via a learnable gating parameter ($\lambda$), ensuring the model captures both the general context and the structural "skeleton" defined by punctuation.
- Top-K Selection: The model calculates relevance scores between the query and these hybrid vectors, activating only the most relevant blocks.
- Extreme-Sparsity Training: Unlike training-free methods, PHSA is natively trained with a strategy designed to stabilize performance even when the model is forced to look at only 1 or 2 blocks, preventing the performance collapse typical of sparse models.
Experimental Results
PHSA was evaluated using Qwen-based models across a variety of general and long-context benchmarks, including MMLU, GSM8K, and Needle-in-a-Haystack (NIAH).
Key Findings
- Superior Accuracy at High Sparsity: For a 0.6B-parameter model with a 32k context, PHSA reduced information loss by 10.8% compared to the state-of-the-art InfLLM v2 at a 97.3% sparsity ratio.
- Competitive with Dense Attention: PHSA often matched or outperformed standard dense attention on general benchmarks while offering significantly better scalability.
- Robust Retrieval: In NIAH tests, PHSA maintained high retrieval accuracy even at extreme sparsity (low Top-K), where baseline methods saw sharp performance drops.
- Cross-Lingual Generalization: Incorporating Chinese punctuation marks into the anchor set significantly boosted performance on Chinese-specific tasks.
Discussion and Future Work
While PHSA demonstrates that punctuation marks are effective semantic anchors, the authors note that not every mark is equally critical. Future work will involve refining the "anchor set" to exclude noise and investigating the behavior of punctuation-aware sparsity in larger frontier models exceeding 70B parameters. By focusing on the logical boundaries of language, PHSA provides a scalable path forward for efficient long-context modeling without sacrificing semantic precision.
Summary updated