arXiv:2501.12689cs.LG2025-01被引 15

用历史请求提升小模型能力,让大模型服务更高效

IC-Cache: Efficient Large Language Model Serving via In-context Caching

  • 用相似历史对话作上下文示例,让小模型模仿大模型推理
  • 实测吞吐提升1.4到5.9倍,延迟降低28%至71%
  • 适合需要低延迟、低成本部署大模型的场景

大型语言模型在各类应用中表现优异,但大规模部署面临资源消耗大、延迟高的挑战。真实场景研究显示,超过70%的用户请求具有语义相似性,表明请求间存在知识迁移潜力。然而,直接缓存并复用历史响应会导致质量显著下降。本文提出IC-Cache,一种支持实时能力增强的缓存系统:通过将更大模型的历史请求-响应对作为上下文示例,使小型模型能模仿甚至超越其组合能力(如推理),实现请求的有选择性卸载,从而降低计算成本与延迟。该实时增强在大规模下引入响应质量、延迟与系统吞吐间的复杂权衡。IC-Cache针对新请求高效选取相似且高价值的示例,拼接至输入前;在大规模下,自适应地根据响应质量与负载路由请求至不同能力的LLM。系统采用成本感知的离线缓存重放机制,优化示例质量以最大化在线缓存效率。在数百万条真实请求上的评估表明,IC-Cache在不损害响应质量的前提下,使服务吞吐提升1.4–5.9倍,延迟降低28%–71%。

原文摘要 · Abstract (English)

Large language models (LLMs) have excelled in various applications, yet serving them at scale is challenging due to their substantial resource demands and high latency. Our real-world studies reveal that over 70% of user requests to LLMs have semantically similar counterparts, suggesting the potential for knowledge transfer among requests. However, naively caching and reusing past responses leads to a big quality drop. In this paper, we introduce IC-Cache, a caching system that enables live LLM capability augmentation to improve serving efficiency: by leveraging historical request-response pairs from larger models as in-context examples, IC-Cache empowers small LLMs to imitate and even exceed the compositional abilities (e.g., reasoning) of their larger counterparts, enabling selective offloading of requests to reduce cost and latency. Achieving this live augmentation at scale introduces intricate trade-offs between response quality, latency, and system throughput. For a new request, IC-Cache efficiently selects similar, high-utility examples to prepend them to the new request's input. At scale, it adaptively routes requests across LLMs of varying capabilities, accounting for response quality and serving loads. IC-Cache employs a cost-aware cache replay mechanism that refines example quality offline to maximize online cache utility and efficiency. Evaluations on millions of realistic requests demonstrate that IC-Cache improves LLM serving throughput by 1.4-5.9x and reduces latency by 28-71% without hurting response quality.

大模型推理缓存优化上下文学习

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。