EdgeInfinite: A Memory-Efficient Infinite-Context Transformer for Edge Devices
Jiyu Chen, Shuang Peng, Daxiong Luo, Fan Yang, Renshou Wu, Fangyuan Li, Xiaoxin Chen
TL;DR
EdgeInfinite addresses the challenge of long-context processing on edge devices by integrating compressed memory into Transformer LLMs through a trainable memory-gating module, while preserving compatibility with standard Transformer architectures. It introduces three architectural pillars: segmented attention with ROPE for local context, a memory compression-decompression mechanism to store past context, and a memory-gating module that adaptively blends memory-based and local attention, with fine-tuning limited to a small parameter subset. The inference strategy further avoids quality loss by preserving sink and window tokens and by dynamically routing between long-context memory and short-context KV caches. Experimental results on LongBench with a BlueLM-3B backbone show EdgeInfinite achieving competitive or superior performance to baseline KV-cache methods and even FullKV, while markedly reducing memory usage and time to first token for long sequences, making it well-suited for edge deployment. Overall, EdgeInfinite provides a practical, transformer-compatible path to scalable infinite-context inference on resource-constrained devices.
Abstract
Transformer-based large language models (LLMs) encounter challenges in processing long sequences on edge devices due to the quadratic complexity of attention mechanisms and growing memory demands from Key-Value (KV) cache. Existing KV cache optimizations struggle with irreversible token eviction in long-output tasks, while alternative sequence modeling architectures prove costly to adopt within established Transformer infrastructure. We present EdgeInfinite, a memory-efficient solution for infinite contexts that integrates compressed memory into Transformer-based LLMs through a trainable memory-gating module. This approach maintains full compatibility with standard Transformer architectures, requiring fine-tuning only a small part of parameters, and enables selective activation of the memory-gating module for long and short context task routing. The experimental result shows that EdgeInfinite achieves comparable performance to baseline Transformer-based LLM on long context benchmarks while optimizing memory consumption and time to first token.
