Sim-LLM: Optimizing LLM Inference at the Edge through Inter-Task KV Reuse

Ruikun Luo, Changwei Gu, Qiang He, Feifei Chen, Song Wu, Hai Jin, Yun YangNeurIPS 2025

TL;DR

Sim-LLM is a novel framework designed to accelerate Large Language Model (LLM) inference on resource-constrained edge servers by reusing Key-Value (KV) caches from previously processed similar tasks. By leveraging the geographical and temporal similarity of edge-computing workloads, it achieves up to a 39.40% boost in throughput and a 34.65% reduction in memory usage with negligible impact on model accuracy.

The Edge Computing Bottleneck

Deploying LLMs at the "edge"—on servers physically close to users—is essential for low-latency applications like autonomous driving or smart city management. However, LLMs are notoriously memory-hungry. Beyond the model parameters themselves, the KV cache (which stores previously computed attention vectors to speed up token generation) grows linearly with sequence length and batch size.

On memory-constrained edge nodes, this KV cache quickly becomes a bottleneck. While existing research suggests compressing or evicting parts of the cache, these methods often require significant extra computation—a luxury edge servers don't have. Sim-LLM addresses this by asking a fundamental question: If two users ask similar questions, why recompute the entire KV cache from scratch?

The Sim-LLM Approach

The authors introduce Sim-LLM, which optimizes inference through a task-wise perspective rather than a token-wise one. Its architecture relies on three main pillars:

  1. Semantic Similarity Identification: To avoid the high cost of comparing every new prompt to every cached one, Sim-LLM uses Locality-Sensitive Hashing (LSH). This allows the system to quickly bucket similar tasks together. If a new task falls into a bucket with a high cosine similarity (threshold > 0.8) to a previous task, it’s flagged for KV reuse.
  2. The "Sandwich" KV Reuse Strategy: The researchers observed that the top layers of a Transformer model contain the most informative semantic data. When a similar task is found, Sim-LLM reuses the top-layer KV pairs from the previous task. This allows the model to skip the computation of intermediate layers entirely for the prefilling phase. For unmatched tasks, it uses a "sandwich" structure, retaining KVs only from the bottom three and top three layers to optimize the process.
  3. Across-Node Sharing: In a multi-node edge environment, servers maintain a Global Feature Table of "task prototypes." If a local server doesn't have a similar task cached, it can identify a neighboring server that does and offload the task there, maximizing system-wide resource utilization.

Key Insights: Exploiting Task Similarity

  • The "Hot Event" Phenomenon: Edge servers typically serve specific geographic regions. Consequently, user queries often revolve around the same local news, weather, or events, leading to high task similarity that can be exploited.
Heatmap showing similarity proportions across various datasets, highlighting the potential for task reuse.
  • Top-Layer Informational Density: The paper confirms that while lower layers focus on syntax, higher layers capture the semantic essence of a task. This justifies why reusing only the top-layer KV cache is sufficient to maintain accuracy while skipping intermediate computations.
  • Efficiency over Compression: Unlike previous methods that try to compress the cache (which adds compute overhead), Sim-LLM focuses on avoiding computation through intelligent retrieval.
  • The LSH Advantage: Moving from exhaustive search to LSH-based mapping is the "secret sauce" that makes similarity detection viable in real-time on low-power hardware.

Performance and Results

The framework was evaluated on Nvidia A40 and A100 GPUs using models like TinyLlama-1.1B, Llama2 (7B & 13B), and InternLM2-7B across diverse datasets (e.g., REDDIT, WIKI, GLUE).

  • Throughput: Achieved a speedup of up to 39.40% (averaging ~33%) compared to state-of-the-art baselines like StreamingLLM and H2O.
Throughput comparison demonstrating Sim-LLM's significant advantage over standard inference.
  • Memory: Reduced GPU memory consumption by up to 34.65%.
  • Accuracy: Perplexity (PPL) tests showed that Sim-LLM maintains competitive performance as cache size increases, as the reused KVs provide helpful context from similar previously encountered scenarios.
  • Scalability: The system successfully handled significantly larger maximum batch sizes (e.g., increasing Llama2-7B batch size from 128 to 640 on an A40).

Limitations and Future Work

While highly effective, Sim-LLM faces a few hurdles:

  • Storage Overhead: While Sim-LLM saves KV computation memory, it requires storage for the top-layer KV pairs and embeddings of previous tasks. If the cache grows too large, the storage cost could eventually outweigh the reuse benefits (mitigated via an LRU eviction policy).
  • Model Homogeneity: Currently, the system requires all edge servers to run identical models to share KV caches effectively.
  • Future Directions: The team plans to explore how to share KV caches across heterogeneous models (e.g., sharing knowledge between a 7B and a 13B model) to further increase the flexibility of edge deployments.

Summary updated

BibTeX
@inproceedings{luo2025sim,
  author = {Ruikun Luo and Changwei Gu and Qiang He and Feifei Chen and Song Wu and Hai Jin and Yun Yang},
  title = {{Sim-LLM: Optimizing LLM Inference at the Edge through Inter-Task KV Reuse}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=z1Cvcovlms},
}
Figure