MeanCache: User-Centric Semantic Caching for LLM Web Services
作者: Waris Gill, Mohamed Elidrisi, Pallavi Kalapatapu, Ammar Ahmed, Ali Anwar, Muhammad Ali Gulzar
分类: cs.LG, cs.AI, cs.CL, cs.CR, cs.DC
发布日期: 2024-03-05 (更新: 2025-03-07)
备注: Accepted at 2025 IEEE 39th International Parallel and Distributed Processing Symposium (IPDPS)
期刊: 2025 IEEE International Parallel and Distributed Processing Symposium (IPDPS)
DOI: 10.1109/IPDPS64566.2025.00117
💡 一句话要点
提出MeanCache以解决LLM服务中的语义缓存问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 语义缓存 大型语言模型 联邦学习 查询相似性 用户隐私 计算成本 自然语言处理
📋 核心要点
- 现有的缓存方法无法有效识别LLM查询之间的语义相似性,导致高错误命中率和计算成本。
- MeanCache通过用户中心的语义缓存机制,利用联邦学习训练查询相似性模型,优化缓存命中率。
- 实验结果表明,MeanCache在语义缓存命中决策中F-score提高约17%,精度提升20%,存储需求减少83%。
📝 摘要(中文)
大型语言模型(LLM)如ChatGPT和Llama在自然语言处理和搜索引擎动态中引发了革命。然而,这些模型的计算成本极高,尤其是在处理重复查询时。现有的缓存方法无法有效识别LLM查询之间的语义相似性,导致较高的错误命中率。本文提出了MeanCache,一种用户中心的语义缓存机制,通过识别语义相似查询来优化缓存命中率。MeanCache利用联邦学习在不侵犯用户隐私的情况下训练查询相似性模型,显著降低延迟和成本,并提高模型性能。实验结果显示,MeanCache在语义缓存命中决策中F-score提高约17%,精度提升20%,同时存储需求减少83%。
🔬 方法详解
问题定义:本文旨在解决大型语言模型(LLM)在处理重复查询时的高计算成本问题。现有的缓存方法无法识别查询之间的语义相似性,导致较高的错误命中率和资源浪费。
核心思路:MeanCache通过识别语义相似查询来优化缓存命中率,利用联邦学习技术在用户设备上训练查询相似性模型,从而在不侵犯用户隐私的前提下提高缓存效率。
技术框架:MeanCache的整体架构包括用户设备上的本地缓存和联邦学习模块。用户的查询首先在本地缓存中查找,如果找到相似查询,则直接返回缓存结果;否则,向LLM发起请求。
关键创新:MeanCache的主要创新在于其用户中心的设计,通过联邦学习实现了隐私保护的同时提高了查询相似性识别的准确性。这与现有方法的根本区别在于其能够处理语义和上下文信息。
关键设计:在设计上,MeanCache采用了特定的损失函数来优化查询相似性模型,并在每个用户设备上维护一个本地缓存,减少了对LLM的请求频率,从而降低了延迟和计算成本。
🖼️ 关键图片
📊 实验亮点
实验结果显示,MeanCache在语义缓存命中决策中F-score提高约17%,精度提升20%。此外,存储需求减少83%,语义缓存命中决策速度加快11%,展现出优越的性能。
🎯 应用场景
MeanCache的潜在应用领域包括在线客服、智能助手和搜索引擎等需要频繁处理用户查询的场景。通过优化缓存机制,该研究可以显著降低服务提供商的计算负担,提高用户体验,并在环境保护方面产生积极影响。
📄 摘要(原文)
Large Language Models (LLMs) like ChatGPT and Llama have revolutionized natural language processing and search engine dynamics. However, these models incur exceptionally high computational costs. For instance, GPT-3 consists of 175 billion parameters, where inference demands billions of floating-point operations. Caching is a natural solution to reduce LLM inference costs on repeated queries, which constitute about 31% of the total queries. However, existing caching methods are incapable of finding semantic similarities among LLM queries nor do they operate on contextual queries, leading to unacceptable false hit-and-miss rates. This paper introduces MeanCache, a user-centric semantic cache for LLM-based services that identifies semantically similar queries to determine cache hit or miss. Using MeanCache, the response to a user's semantically similar query can be retrieved from a local cache rather than re-querying the LLM, thus reducing costs, service provider load, and environmental impact. MeanCache leverages Federated Learning (FL) to collaboratively train a query similarity model without violating user privacy. By placing a local cache in each user's device and using FL, MeanCache reduces the latency and costs and enhances model performance, resulting in lower false hit rates. MeanCache also encodes context chains for every cached query, offering a simple yet highly effective mechanism to discern contextual query responses from standalone. Our experiments benchmarked against the state-of-the-art caching method, reveal that MeanCache attains an approximately 17% higher F-score and a 20% increase in precision during semantic cache hit-and-miss decisions while performing even better on contextual queries. It also reduces the storage requirement by 83% and accelerates semantic cache hit-and-miss decisions by 11%.