Long Context Compression with Activation Beacon

Peitian Zhang, Zheng Liu, Shitao Xiao, Ninglu Shao, Qiwei Ye, Zhicheng Dou

Large Language Models (LLMs) face severe computational and memory bottlenecks when processing long contexts, primarily due to the massive size of their Key-Value (KV) caches. To address this, researchers have introduced Activation Beacon, a plug-in module that progressively compresses long contexts into compact "beacon token" activations. By training with random compression ratios, the model flexibly achieves up to an 8x KV cache reduction and a 2x inference speedup while seamlessly generalizing to 128K+ context lengths without sacrificing performance.

The Long-Context Bottleneck

Modern LLMs are increasingly expected to handle massive context windows for tasks like document understanding and codebase analysis. However, the standard Transformer architecture scales poorly: self-attention compute grows quadratically, and storing the KV cache for fast decoding consumes linear, often prohibitive, amounts of GPU memory.

Existing context compression methods fall short in several ways. "Soft prompt" methods summarize context into a few virtual tokens, but these create an information bottleneck and require expensive re-encoding during generation. Token-deletion methods (which drop "unimportant" tokens) rely heavily on knowing the user's query beforehand to judge importance. This makes them highly inefficient for multi-turn conversations where the query changes dynamically. Activation Beacon was designed to overcome these limitations by providing a compression method that is query-independent, preserves fine-grained details, and avoids re-encoding overhead.

The Solution: Activation Beacon

Activation Beacon acts as a plug-in module for transformer-based LLMs. Instead of compressing the text tokens themselves, it directly compresses the KV cache activations.

Progressive chunking and beacon token insertion

The compression workflow operates through several key mechanisms:

  1. Progressive Chunking: A long input is split into fixed-size chunks, and each chunk is further divided into smaller, fine-grained units.
  2. Beacon Tokens: A special <b> token is appended to the end of each fine-grained unit.
  3. Direct Activation Compression: The LLM processes the context chunk-by-chunk. During the forward pass, the model computes attention normally. However, after a chunk is processed, the KV activations of the raw text tokens are discarded. Only the KV activations of the <b> tokens are accumulated and passed forward to condition the next chunk.
  4. Auto-Regressive Training: The model is trained to predict the next token using this compressed context. Crucially, the base LLM weights are frozen; only the beacon token embeddings and their specific projection matrices are trained. Gradients flow continuously across all chunks.
  5. Dynamic Compression Ratios: During training, the compression ratio (how many raw tokens are squashed into one beacon token) is randomly sampled per chunk. This teaches the model to handle varying levels of compression at inference time.

Key Insights

  • Fine-Grained Attention Scope: Interleaving beacon tokens throughout a chunk—rather than dumping them all at the end—gives each beacon a differentiated attention scope. Ablation studies show this drastically improves the model's ability to retain complex, fine-grained information.
  • Free Length Generalization: Even though the model was only trained on sequences up to 20K tokens, it generalizes flawlessly to 128K+ contexts. Because it processes text chunk-by-chunk and only passes forward compressed states, the model never "realizes" it is operating out-of-distribution.
  • Query-Independence: Because Activation Beacon compresses the context before seeing the user's prompt, it doesn't need to re-compute the KV cache when a user asks a follow-up question. This makes it vastly superior to query-dependent token-eviction methods in multi-turn chat settings.

Key Results and Efficiency

Activation Beacon matches the performance of an uncompressed, fine-tuned baseline on rigorous long-context benchmarks like LongBench and Needle-in-a-Haystack, heavily outperforming existing compressors like ICAE, AutoCompressor, and LongLLMLingua. Furthermore, because the base LLM weights are frozen during training, the model suffers virtually zero degradation on standard short-context benchmarks (e.g., MMLU, GSM8K).

TFLOPs reduction across different models and context lengths

The efficiency gains are substantial. Using an x8 compression ratio, the method achieves an 8x reduction in KV cache memory and a 2x end-to-end inference speedup at 128K context lengths. In a 3-turn Multi-Needle task, Activation Beacon is up to 9.3x faster than LongLLMLingua and 3.6x faster than SnapKV, precisely because it avoids re-encoding the context.

Limitations and Future Work

While highly effective, the compressor's intelligence is sensitive to the diversity of its training data. Initial models struggled with complex multi-hop reasoning tasks until specific synthetic samples were added to the fine-tuning mix.

Looking forward, Activation Beacon focuses entirely on sequence-wise compression. This makes it orthogonal to compression along other dimensions, such as numerical quantization (e.g., KIVI) or channel compression (e.g., Multi-Head Latent Attention). Combining Activation Beacon with these complementary techniques represents a highly promising direction for extreme LLM efficiency.

Summary updated

BibTeX
@inproceedings{zhang2025long,
  author = {Peitian Zhang and Zheng Liu and Shitao Xiao and Ninglu Shao and Qiwei Ye and Zhicheng Dou},
  title = {{Long Context Compression with Activation Beacon}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=1eQT9OzfNQ},
}
Figure