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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liu, Yuhan, Huang, Yuyang, Yao, Jiayi, Feng, Shaoting, Gu, Zhuohan, Du, Kuntai, Li, Hanchen, Cheng, Yihua, Jiang, Junchen, Lu, Shan, Musuvathi, Madan, Choukse, Esha
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913940554907648
author Liu, Yuhan
Huang, Yuyang
Yao, Jiayi
Feng, Shaoting
Gu, Zhuohan
Du, Kuntai
Li, Hanchen
Cheng, Yihua
Jiang, Junchen
Lu, Shan
Musuvathi, Madan
Choukse, Esha
author_facet Liu, Yuhan
Huang, Yuyang
Yao, Jiayi
Feng, Shaoting
Gu, Zhuohan
Du, Kuntai
Li, Hanchen
Cheng, Yihua
Jiang, Junchen
Lu, Shan
Musuvathi, Madan
Choukse, Esha
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2411_02820
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle DroidSpeak: KV Cache Sharing for Cross-LLM Communication and Multi-LLM Serving
Liu, Yuhan
Huang, Yuyang
Yao, Jiayi
Feng, Shaoting
Gu, Zhuohan
Du, Kuntai
Li, Hanchen
Cheng, Yihua
Jiang, Junchen
Lu, Shan
Musuvathi, Madan
Choukse, Esha
Multiagent Systems
Artificial Intelligence
Computation and Language
Machine Learning
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.
title DroidSpeak: KV Cache Sharing for Cross-LLM Communication and Multi-LLM Serving
topic Multiagent Systems
Artificial Intelligence
Computation and Language
Machine Learning
url https://arxiv.org/abs/2411.02820