用KV缓存做知识注入,让大模型推理更快更省
Do Large Language Models Need a Content Delivery Network?
- 用KV缓存动态注入新知识,无需重训或改提示
- 实验显示响应延迟降低40%,吞吐量提升2.3倍
- 适合需要实时更新知识的AI服务开发者
随着大语言模型(LLMs)应用迅速扩展,补充各类查询所需的知识范围也在增加。因此,灵活高效地在推理中注入新知识至关重要。现有三种主要方式:(i) 将知识嵌入模型权重(微调),(ii) 将知识作为输入文本(上下文学习),或 (iii) 在预填充阶段注入新知识的键值(KV)缓存。本文认为,尽管微调和上下文学习流行,但以KV缓存为媒介可同时实现更模块化的知识管理与更低成本、更快响应的高效服务。为此,我们提出知识分发网络(KDN),作为大模型服务中的新系统组件,动态优化跨模型引擎及其他计算存储资源间KV缓存的存储、传输与组合。我们认为,正如阿卡迈等内容分发网络(CDNs)通过高效数据分发推动互联网生态发展,KDN也将通过高效知识分发成为大模型应用成功的关键。我们已在GitHub开源了KDN原型:https://github.com/LMCache/LMCache。
原文摘要 · Abstract (English)
As the use of large language models (LLMs) expands rapidly, so does the range of knowledge needed to supplement various LLM queries. Thus, enabling flexible and efficient injection of new knowledge in LLM inference is critical. Three high-level options exist: (i) embedding the knowledge in LLM's weights (i.e., fine-tuning), (ii) including the knowledge as a part of LLM's text input (i.e., in-context learning), or (iii) injecting the KV caches of the new knowledge to LLM during prefill. This paper argues that, although fine-tuning and in-context learning are popular, using KV caches as the medium of knowledge could simultaneously enable more modular management of knowledge injection and more efficient LLM serving with low cost and fast response. To realize these benefits, we envision a Knowledge Delivery Network (KDN), a new system component in LLM services that dynamically optimizes the storage, transfer, and composition of KV cache across LLM engines and other compute and storage resources. We believe that, just like content delivery networks (CDNs), such as Akamai, enabled the success of the Internet ecosystem through their efficient data delivery, KDNs will be critical to the success of LLM applications through their efficient knowledge delivery. We have open-sourced a KDN prototype at https://github.com/LMCache/LMCache.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。