ParallelComp: Parallel Long-Context Compressor for Length Extrapolation

Jing Xiong, Jianghan Shen, Chuanyang Zheng, Zhongwei Wan, Chenyang Zhao, Chiwun Yang, Fanghua Ye, Hongxia Yang, Lingpeng Kong, Ngai Wong

TL;DR

ParallelComp is a training-free framework that enables 8B-parameter Large Language Models (LLMs) to extrapolate from an 8K training window to 128K tokens on a single A100 GPU. By combining parallel chunk processing with a novel KV cache eviction strategy, it achieves 91.17% of GPT-4’s performance on ultra-long contexts while delivering a massive 23.5x acceleration in the prefill stage.

What Problem Does This Paper Address?

While we want LLMs to process massive documents, most models are limited by their training context (e.g., 8K or 32K tokens). Extending this "context window" during inference—known as length extrapolation—usually hits two major walls:

  1. Memory Bottlenecks: The Key-Value (KV) cache, which stores the model's "memory" of previous tokens, grows linearly with sequence length, quickly exhausting GPU VRAM.
  2. Attention Biases: LLMs suffer from the "attention sink" phenomenon, where the model disproportionately focuses on the very first or last tokens, regardless of their actual relevance. In parallel processing setups, these biases become even more complex and can degrade performance.

Existing training-free methods often struggle to balance memory efficiency with the need to maintain the model's reasoning capabilities over long distances.

Methods

ParallelComp introduces a three-step pipeline to handle ultra-long sequences efficiently:

  1. Parallel Attention: The input is split into chunks based on the model’s original maximum context length. These chunks are processed independently and in parallel.
  2. Parallel KV Cache Eviction: To keep memory usage under control, the system calculates a "self-information" score for tokens. It then dynamically evicts redundant chunks and irrelevant tokens from the KV cache.
  3. Global Attention & Calibration: The remaining "compressed" KV caches are concatenated. A global attention operation is then performed to ensure the model can still see dependencies across the entire sequence.
Overview of the ParallelComp pipeline

A key innovation is the Attention Calibration strategy. The authors found that parallel attention creates unique bias patterns. By selectively evicting tokens with abnormally high attention scores in specific layers, they "re-level" the attention distribution, allowing the model to focus on truly relevant information.

Datasets

The authors evaluated ParallelComp across several rigorous benchmarks:

  • LongBench: A comprehensive benchmark for long-context understanding (QA, summarization, etc.).
  • InfiniteBench: Specifically designed for ultra-long context tasks (up to 128K+ tokens).
  • NarrativeQA: Used to test language modeling performance via perplexity (PPL) calculations.

Key Insights and Ideas

  • The Inevitability of Collapse: The authors provide a theoretical proof showing that as sequence length increases, attention "collapse" (extreme sparsity) is mathematically inevitable. ParallelComp turns this into an advantage by using that sparsity to justify aggressive KV cache eviction.
  • Parallel vs. Normal Attention: Parallel processing changes how the model "looks" at data. Normal attention is heavily concentrated at the start and end (a U-shape distribution), while parallel attention exhibits a multi-peak distribution that requires different calibration.
Comparison of Normal vs. Parallel attention distributions
  • Layer-Specific Sensitivity: Not all layers are the same. The authors discovered that evicting "sink tokens" in early layers can destroy retrieval performance, but doing so in deeper layers actually helps the model reason better by mitigating recency bias.
  • Diverse Bias Patterns: Beyond the standard "attention sink," the paper identifies several patterns like "Mountain-shape" and "Uniform-shape" distributions that emerge in long-context settings, which must be accounted for during parallel processing.

Key Results

  • Performance: An 8B model trained on only 8K context achieved 91.17% of GPT-4’s performance on ultra-long tasks, outperforming strong closed-source models like Claude-2 and Kimi-Chat.
  • Efficiency: ParallelComp achieved a 23.50x speedup in the prefill stage and a 1.76x improvement in chunk throughput compared to standard baselines.
  • Retrieval Accuracy: On "needle-in-a-haystack" tasks (finding a specific fact in a sea of text), ParallelComp was the only training-free model to maintain over 90% accuracy across all tested lengths.

Limitations and Future Work

While ParallelComp is highly effective for retrieval and summarization, the authors note that the impact of their eviction strategy on very specific, nuanced reasoning tasks remains a subject for further study.

Future work includes:

  • Scaling the method to handle contexts beyond 100K+ tokens.
  • Exploring "test-time scaling," where the model can dynamically adjust its compression ratio based on the complexity of the query.
  • Applying these techniques to improve long-chain reasoning and ultra-long in-context learning.

The code is available at https://github.com/menik1126/ParallelComp.

Summary updated

BibTeX
@inproceedings{xiong2025parallelcomp,
  author = {Jing Xiong and Jianghan Shen and Chuanyang Zheng and Zhongwei Wan and Chenyang Zhao and Chiwun Yang and Fanghua Ye and Hongxia Yang and Lingpeng Kong and Ngai Wong},
  title = {{ParallelComp: Parallel Long-Context Compressor for Length Extrapolation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=BiM4ewH9zD},
}
Figure