Clustering-driven Memory Compression for On-device Large Language Models
Ondrej Bohdal, Pramit Saha, Umberto Michieli, Mete Ozay, Taha Ceritli
TL;DR
The paper tackles the challenge of personalizing on-device LLMs under tight context budgets by introducing clustering-driven memory compression. Memories from user interactions are first encoded into memory tokens, then grouped with K-Means, and merged within clusters to produce cluster-level representations whose tokens total $K \cdot D_m$. This approach reduces context size while preserving coherence across heterogeneous memories, delivering higher ROUGE-L performance than naive averaging or direct concatenation across multiple on-device models and tasks. The method demonstrates consistent token efficiency and improved personalization quality, highlighting its practical impact for privacy-preserving, edge-based NLP systems.
Abstract
Large language models (LLMs) often rely on user-specific memories distilled from past interactions to enable personalized generation. A common practice is to concatenate these memories with the input prompt, but this approach quickly exhausts the limited context available in on-device LLMs. Compressing memories by averaging can mitigate context growth, yet it frequently harms performance due to semantic conflicts across heterogeneous memories. In this work, we introduce a clustering-based memory compression strategy that balances context efficiency and personalization quality. Our method groups memories by similarity and merges them within clusters prior to concatenation, thereby preserving coherence while reducing redundancy. Experiments demonstrate that our approach substantially lowers the number of memory tokens while outperforming baseline strategies such as naive averaging or direct concatenation. Furthermore, for a fixed context budget, clustering-driven merging yields more compact memory representations and consistently enhances generation quality.
