arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2512.16822cs.LG
收藏

MEPIC:内存高效的无位置依赖缓存用于大语言模型服务

MEPIC: Memory Efficient Position Independent Caching for LLM Serving

Huawei Technologies Canada Co., Ltd.(华为技术加拿大有限公司);Huawei Technologies Co., Ltd.(华为技术有限公司)

Qian Wang, Zahra Yousefijamarani, Morgan Lindsay Heisler, Rongzhi Gu, Bai Xiaolong, Shan Yizhou, Wei Zhang, Wang Lan, Ying Xiong, Yong Zhang, Zhenan Fan

AI总结:

MEPIC通过内存高效的无位置依赖缓存技术,实现跨请求和批次的片段KV重用,显著减少HBM使用量,提升大语言模型服务性能。

摘要:

现代大语言模型应用,如深度研究助手、编码代理和检索增强生成(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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑