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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Yu, Yifan, Gan, Yu, Sarda, Nikhil, Tsai, Lillian, Shen, Jiaming, Zhou, Yanqi, Krishnamurthy, Arvind, Lai, Fan, Levy, Henry M., Culler, David
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915478222405632
author Yu, Yifan
Gan, Yu
Sarda, Nikhil
Tsai, Lillian
Shen, Jiaming
Zhou, Yanqi
Krishnamurthy, Arvind
Lai, Fan
Levy, Henry M.
Culler, David
author_facet Yu, Yifan
Gan, Yu
Sarda, Nikhil
Tsai, Lillian
Shen, Jiaming
Zhou, Yanqi
Krishnamurthy, Arvind
Lai, Fan
Levy, Henry M.
Culler, David
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2501_12689
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle IC-Cache: Efficient Large Language Model Serving via In-context Caching
Yu, Yifan
Gan, Yu
Sarda, Nikhil
Tsai, Lillian
Shen, Jiaming
Zhou, Yanqi
Krishnamurthy, Arvind
Lai, Fan
Levy, Henry M.
Culler, David
Machine Learning
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.
title IC-Cache: Efficient Large Language Model Serving via In-context Caching
topic Machine Learning
url https://arxiv.org/abs/2501.12689