现代大语言模型应用,如深度研究助手、编码代理和检索增强生成(RAG)系统,反复处理包含共享文档或代码片段的长提示历史,对键值(KV)缓存造成显著压力,必须在有限内存内维持高吞吐量和低延迟。前缀缓存通过重用已处理的token的KV缓存部分缓解了一些成本,但受限于严格的前缀匹配。位置无关缓存(PIC)允许在任意位置进行片段级别的重用,但需要选择性重新计算和位置编码(PE)调整。然而,由于这些操作在不同查询中变化,相同片段的KV在不同请求中会有所不同。此外,没有页面对齐,片段KV布局在内存中会分散,阻止页面共享。这些问题导致即使许多请求重用相同内容,HBM节省仍然有限。\n我们提出了MEPIC,一种内存高效的PIC系统,能够跨位置、请求和批次重用片段KV。MEPIC将片段KV对齐到分页存储,将重新计算从token级转移到block级,使得只有第一个block是请求特定的,通过Rotary Position Embedding(RoPE)融合在注意力内核中消除位置编码,使剩余块完全可共享。这些技术消除了大部分HBM中的重复片段KV,减少使用量在相同比例的延迟和准确性下比最先进的PIC高2倍,在长提示下可达5倍,而无需任何模型更改。
英文摘要:
Modern LLM applications such as deep-research assistants, coding agents, and Retrieval-Augmented Generation (RAG) systems, repeatedly process long prompt histories containing shared document or code chunks, creating significant pressure on the Key Value (KV) cache, which must operate within limited memory while sustaining high throughput and low latency. Prefix caching partially alleviates some of these costs by reusing KV cache for previously processed tokens, but limited by strict prefix matching. Position-independent caching (PIC) enables chunk-level reuse at arbitrary positions, but requires selective recomputation and positional-encoding (PE) adjustments. However, because these operations vary across queries, KV for the same chunk diverges across requests. Moreover, without page alignment, chunk KV layouts diverge in memory, preventing page sharing. These issues result in only modest HBM savings even when many requests reuse the same content.
We present MEPIC, a memory-efficient PIC system that enables chunk KV reuse across positions, requests, and batches. MEPIC aligns chunk KV to paged storage, shifts recomputation from token- to block-level so only the first block is request-specific, removes positional encodings via Rotary Position Embedding (RoPE) fusion in the attention kernel, and makes remaining blocks fully shareable. These techniques eliminate most duplicate chunk KV in HBM, reducing usage by up to 2x over state-of-the-art PIC at comparable latency and accuracy, and up to 5x for long prompts, without any model changes.
Semantic Caching for Low-Cost LLM Serving: From Offline Learning to Online Adaptation
University of Washington(华盛顿大学);Carnegie Mellon University(卡内基梅隆大学);The Chinese University of Hong Kong(香港中文大学);City University of Hong Kong(香港城市大学);Microsoft Research(微软研究院)
Recency/Frequency Adaptive KV Caching for Large Language Model Serving
Department of Computer Science, Johns Hopkins University, Baltimore, USA(约翰霍普金斯大学计算机科学系);Argonne National Laboratory, Lemont, USA(阿贡国家实验室);Parasail, Inc., San Mateo, USA(Parasail公司)
ElasticMM: Efficient Multimodal LLMs Serving with Elastic Multimodal Parallelism
Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);University of Electronic Science and Technology of China(电子科技大学);National University of Singapore(新加坡国立大学)
Reasoning Language Model Inference Serving Unveiled: An Empirical Study
The Hong Kong University of Science and Technology (Guangzhou)(香港科学与技术大学(广州));Shenzhen International Graduate School, Tsinghua University(清华大学深圳国际研究生院);HKBU(香港 Baptist University);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Harbin Institute of Technology, Shenzhen(哈尔滨工业大学(深圳));The Hong Kong University of Science and Technology(香港科学与技术大学)