用大模型预测指令相似性,提升推理缓存命中率。
InstCache: A Predictive Cache for LLM Serving
- 通过大模型重排指令表示空间,构建紧凑的语义邻近区域。
- 在WildChat上缓存命中率提升2.3倍,输出延迟降低最多50%。
- 适合高并发场景下的大模型服务系统优化,尤其对长尾请求有效。
大语言模型(LLMs)的广泛应用导致推理请求激增,缓存技术可利用数据复用来降低计算开销。现有基于标记级的键值(KV)缓存虽广泛使用,但请求量上升时开销显著。而指令级缓存虽具潜力,但因指令内容和长度变化大,短时间内重复指令稀少,难以有效缓存。为此,我们提出InstCache,一种用于大模型服务的预测缓存机制。借助大模型能力,将指令文本表示空间重新排列,形成足够的空间局部性,从而在运行时预测潜在相似指令并集中缓存。实验表明,在WildChat数据集上,InstCache的缓存命中率比传统方法上限高出2.3倍;在LMSys和Moss数据集上,vLLM的每输出令牌时间分别减少42.0%和50.0%。
原文摘要 · Abstract (English)
The revolutionary capabilities of Large Language Models (LLMs) are attracting rapidly growing popularity and leading to soaring user requests to inference serving systems. Caching techniques, which leverage data reuse to reduce computation, offer opportunities to optimize the performance of LLM inference engines. On the one hand, the low-level key-value (KV) cache working at the token level is widely adopted, albeit it incurs significant overhead as request volume grows. On the other hand, instruction-level caching, which stores full instruction-response pairs, is expected to play an increasingly crucial role. However, the high variability in the content and length of instructions make it rare for identical instructions to recur within a short time window, presenting challenges for effective caching instruction-response pairs. To address this challenge, we propose InstCache, a predictive caching mechanism for LLM serving systems. Leveraging the capability of LLMs, we can effectively reorder the representation space of instruction texts and develop a sufficient level of spatial locality. Such spatial locality enables us to predict potential instructions located in a compact region in the space, resulting in an effective caching system at runtime. Experimental results demonstrate that InstCache achieves a 2.3x higher hit rate compared to the upper bound of traditional caching mechanisms on WildChat dataset and reduces the time per output token of vLLM by up to 42.0% and 50.0% on LMSys and Moss datasets, respectively.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。