arXiv:2411.02820cs.MAcs.AI2024-11被引 33

跨大模型共享注意力缓存,显著提升多模型协同推理速度。

DroidSpeak: KV Cache Sharing for Cross-LLM Communication and Multi-LLM Serving

  • 通过选择性重计算部分层的键值缓存,实现不同模型间缓存复用。
  • 在多个数据集上达到4倍吞吐提升,预填充阶段快3.1倍。
  • 适合需要多模型协作的企业级智能系统部署场景。

复合型AI系统(如代理系统)正成为大规模企业应用的新趋势,多个专用大模型协同处理不同用户、任务或角色。这些场景中,不同模型常处理具有相同上下文前缀的输入。尽管已有研究实现单模型内前缀键值(KV)缓存复用,但如何让一个模型复用另一个不同模型的缓存仍属未解问题。本文提出DroidSpeak,首个支持跨分布式节点上不同大模型间KV缓存共享的推理系统,前提是模型架构一致。我们首次系统研究跨模型缓存共享对质量的影响,并据此设计策略:仅重计算少数层的缓存,其余部分直接复用,质量损失可忽略。通过分层重计算与缓存加载的流水线优化,进一步提升性能。实验表明,在多种数据集和模型组合下,相比不支持跨模型共享的基线,DroidSpeak实现最高4倍吞吐提升,预填充时间缩短约3.1倍,且在F1、Rouge-L及代码相似度等指标上质量几乎无损。

原文摘要 · Abstract (English)

Compound AI systems, such as agentic systems, are an emerging trend in large-scale enterprise settings, with multiple LLMs specialized for different users, tasks, and/or roles working together. In these scenarios, different models often process inputs that share the same context prefix. Although much work was done in the past to enable the reuse of prefix KV caches across inputs for a single model, how to enable one model to reuse the prefix KV caches of a different model remains an open question. We introduce DroidSpeak, the first distributed LLM inference system that enables KV cache reuse across distributed nodes running inference of different LLMs, so long as the LLMs have the same architecture. We present the first study that aims at understanding the impact of sharing KV caches across different LLMs, and if/when such sharing affects quality. Inspired by the findings, we present DroidSpeak, which selectively recomputes a few layers of the KV cache produced by another LLM and reuses the remaining layers, with negligible quality loss. Moreover, carefully pipelining the layer-wise re-computation and the loading of reused KV cache further improves the inference performance. Experiments on diverse datasets and model pairs demonstrate that DroidSpeak achieves up to 4x throughput improvement and about 3.1x faster prefill (time to first token), with negligible loss of quality in F1 scores, Rouge-L or code similarity score, compared to the baseline which does not allow any sharing across models.

大模型推理缓存复用多模型协同性能优化

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