Abstract
Large Language Models (LLMs) face a significant "memory wall" due to the linear growth of the Key-Value (KV) cache with input length, hindering deployment on memory-constrained edge devices. We present InfiniPot, a training-free framework that enables pre-trained LLMs to process virtually infinite context lengths within a strictly fixed memory budget. InfiniPot utilizes Continual Context Distillation (CCD), an iterative "consume-and-compress" approach that identifies and retains critical tokens using a novel Catalyst Prompt (CaP) and Novelty under Compression (NuC) metric. Experimental results demonstrate that a model with a 4K-token memory capacity can outperform models trained for 32K+ contexts, maintaining high accuracy on retrieval tasks up to 1 million tokens.
Introduction
The primary bottleneck for deploying LLMs on mobile hardware is the KV cache. As context length increases, the memory required to store previous token information grows linearly, quickly exceeding available RAM. Existing solutions either require expensive fine-tuning or simple eviction strategies that often discard critical information from the beginning or middle of a text. InfiniPot addresses this by answering a fundamental question: how can we identify essential tokens for future, unknown queries in a streaming, memory-constrained environment?
Methods
InfiniPot introduces Continual Context Distillation (CCD), which treats the KV cache like a fixed-size "memory pot." When the pot is full, the system distills the essence of the current content to make room for new data.
The framework relies on three core innovations:
- Catalyst Prompt (CaP): Since the model doesn't know the future context, InfiniPot injects a "volatile" auxiliary prompt (e.g., "Summarize the critical points...") at the end of a memory chunk. This forces the model to generate attention scores that highlight which tokens are most representative right now, acting as a proxy for future importance.
- Novelty under Compression (NuC): This metric uses cross-entropy to identify tokens that contain information not yet well-represented in the existing compressed cache. It ensures that "surprising" or unique information isn't accidentally distilled away.
- Context-Reset Rotary Positional Embedding (CR-RoPE): Standard positional embeddings break when sequences get too long. InfiniPot re-indexes the positions of the retained tokens to fit within the model's original training range, keeping the model within its "comfort zone."
Key Results
Evaluation on LongBench shows that a Mistral-7B model using InfiniPot with only a 4K cache achieved a score of 44.22, nearly matching the performance of the same model using a 32K cache (47.84) and beating GPT-3.5-16K (43.74).
In the "Needle In A Haystack" retrieval test, InfiniPot maintained high accuracy up to 1 million tokens using only a 4K memory budget. In contrast, standard models and other compression techniques (like StreamingLLM or H2O) saw performance collapse after 32K tokens. Furthermore, InfiniPot offers consistent throughput and superior prefill speed compared to SnapKV for contexts exceeding 50K tokens.
Conclusion
InfiniPot demonstrates that the ability to identify important context is latent in pre-trained LLMs. By combining future-looking attention proxies (CaP) with past-looking novelty metrics (NuC), it enables infinite context processing on edge devices without any parameter updates. Future work will explore adaptive compression ratios and validation on specialized mobile hardware.
Summary updated