NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Curse of High Dimensionality Issue in Transformer for Long-context Modeling

Shuhai Zhang, Zeng You, Yaofo Chen, Zhiquan Wen, Qianyue Wang, Zhijie Qiu, Yuanqing Li, Mingkui Tan · OpenReview

Abstract

Transformer-based large language models (LLMs) excel in natural language processing tasks by capturing long-range dependencies through self-attention mechanisms. However, long-context modeling faces significant computational inefficiencies due to redundant attention computations: while attention weights are often sparse, all tokens consume equal computational resources. In this paper, we reformulate traditional probabilistic sequence modeling as a supervised learning task, enabling the separation of relevant and irrelevant tokens and providing a clearer understanding of redundancy. Based on this reformulation, we theoretically analyze attention sparsity, revealing that only a few tokens significantly contribute to predictions. Building on this, we formulate attention optimization as a linear coding problem and propose a group coding strategy, theoretically showing its ability to improve robustness against random noise and enhance learning efficiency. Motivated by this, we propose Dynamic Group Attention (DGA), which leverages the group coding to explicitly reduce redundancy by aggregating less important tokens during attention computation. Empirical results show that our DGA significantly reduces computational costs while maintaining competitive performance.

Introduction

As Large Language Models (LLMs) are increasingly tasked with processing massive documents, they encounter the "Curse of High Dimensionality." In a standard Transformer, the self-attention mechanism treats every token in a long-context window with equal importance. However, research indicates that only a tiny fraction of these tokens actually drive the next-token prediction.

Existing solutions often rely on "pruning" or discarding tokens to save memory and compute. Unfortunately, this can be a blunt instrument; discarding tokens often breaks the informational "flow," leading to performance degradation in tasks requiring holistic understanding, such as summarization or complex multi-document QA. The challenge lies in reducing redundant computation for unimportant tokens without losing the critical interactions they might still provide.

Methodology: Dynamic Group Attention (DGA)

The authors address this by reformulating traditional probabilistic sequence modeling as a supervised learning task. This theoretical lens treats the context as a set of features and the next token as a label, making it easier to identify and analyze redundant "features" (tokens).

Building on this, they introduce Dynamic Group Attention (DGA), which follows a four-step process:

  1. Importance Scoring: The model calculates an importance score for each token based on accumulated attention weights.
  2. Focal vs. Non-Focal Separation: Tokens are split into two groups. A small subset of high-impact "focal tokens" is handled with standard, high-precision attention.
  3. Grouping & Aggregation: The remaining "non-focal" tokens are partitioned into groups of size $m$. Instead of attending to each token individually, the model attends to a single aggregated representation for each group.
  4. Complementary Keys/Values: To respect the autoregressive nature of LLMs, the authors add "complementary" keys. This ensures that a token currently being processed can still access the specific information of its immediate neighbors within its group, preventing information gaps.
Overview of the DGA mechanism: Rearranging tokens into focal/non-focal groups, aggregating non-focal tokens, and adding complementary keys.

Experimental Setup

The researchers evaluated DGA using the LLaMA2-7B architecture. The models were trained and continuously pre-trained on the SlimPajama and WikiText2 datasets. Performance was benchmarked using LongBench-E, a comprehensive suite for long-context understanding (up to 31k tokens) covering tasks such as single/multi-document QA, summarization, few-shot learning, and code generation.

Key Results and Insights

DGA demonstrates a superior balance between computational efficiency and task performance. The paper theoretically proves that as context length increases, attention weights become exponentially more sparse, concentrating the signal in fewer tokens. Furthermore, the authors show that grouping tokens acts as a denoising filter, making the model more robust to random noise and improving the stability of the optimization landscape.

Performance comparison across LongBench-E tasks and Inter-Token Latency (ITL) at 16k context length.

As shown in the results table above, DGA achieves significant speedups while maintaining high accuracy:

  • Speed: DGA-LLM achieved an Inter-Token Latency (ITL) of 28.80 ms at a 16k context length—2.42x faster than vanilla Llama2-7B and 3.55x faster than the LM-Infinite baseline.
  • Performance Retention: On the LongBench-E suite, DGA maintained an average score of 21.14, nearly matching the vanilla model (21.69) and significantly outperforming other sparse methods like StreamingLLM (16.43).
  • Long-Range Stability: While other methods saw sharp performance drops as context length increased to 32k, DGA remained competitive, proving that its grouping strategy preserves essential context better than simple discarding strategies.

Conclusion

Dynamic Group Attention (DGA) offers a principled solution to the redundancy problem in long-context Transformers. By explicitly grouping and aggregating redundant tokens rather than discarding them, DGA achieves dramatic reductions in latency while preserving the model's ability to understand complex, long-range dependencies. Future work will focus on automating hyperparameter selection and developing hardware-aware kernels to further enhance efficiency.

Summary updated

BibTeX
@inproceedings{zhang2025curse,
  author = {Shuhai Zhang and Zeng You and Yaofo Chen and Zhiquan Wen and Qianyue Wang and Zhijie Qiu and Yuanqing Li and Mingkui Tan},
  title = {{Curse of High Dimensionality Issue in Transformer for Long-context Modeling}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=CYmaCpGDDG},
}
Figure