arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.16843cs.CLcs.AI
收藏

LLMCache: 用于Transformer推理加速的分层缓存策略

LLMCache: Layer-Wise Caching Strategies for Accelerated Reuse in Transformer Inference

Analytics and AI/ML Specialist, Amazon Web Services, USA(亚马逊网络服务(AWS))

Harsh Vardhan Bansal

AI总结:

LLMCache通过分层缓存策略加速Transformer推理,利用语义相似性重用中间激活,实现推理时间提升3.1倍且精度损失低于0.5%。

摘要:

基于Transformer的语言模型在各种任务上取得了显著性能,但其高推理延迟对实时和大规模部署构成了重大挑战。尽管现有的缓存机制,如token级键值缓存,在自回归解码中提供了加速效果,但它们在范围和适用性上受到限制。在本文中,我们提出了LLMCache,一种新颖的分层缓存框架,通过基于输入序列语义相似性的中间激活重用来加速Transformer推理。与先前工作不同,LLMCache是模型无关的,可以在编码器和解码器架构中运行,并支持在任意Transformer层上进行缓存。我们引入了一种轻量级的指纹机制用于匹配语义相似的输入,并提出了自适应淘汰策略来管理缓存过期。在BERT和GPT-2上进行的实验显示,在SQuAD、WikiText-103和OpenBookQA上,推理时间可加速高达3.1倍,精度下降小于0.5%。我们的结果表明,LLMCache是一种实用且通用的解决方案,用于优化实际应用中的Transformer推理。

英文摘要:

Transformer-based language models have achieved remarkable performance across a wide range of tasks, yet their high inference latency poses a significant challenge for real-timeand large-scale deployment. While existing caching mechanisms,such as token-level key-value caches, offer speedups in autore-gressive decoding, they are limited in scope and applicability. In this paper, we present LLMCache, a novel layer-wise caching framework that accelerates transformer inference by reusing intermediate activations based on semantic similarity of input sequences. Unlike prior work, LLMCache is model-agnostic,operates across both encoder and decoder architectures, and supports caching at arbitrary transformer layers. We introduce a lightweight fingerprinting mechanism for matching seman-tically similar inputs and propose adaptive eviction strategies to manage cache staleness. Experiments on BERT and GPT-2 across SQuAD, WikiText-103, and OpenBookQA show up to 3.1 X speedup in inference time with <0.5% accuracy degradation. Our results highlight LLMCache as a practical and general-purpose solution for optimizing transformer inference in real-world applications

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑