Saved in:
Bibliographic Details
Main Authors: Regmi, Sajal, Pun, Chetan Phakami
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2411.05276
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912149086928896
author Regmi, Sajal
Pun, Chetan Phakami
author_facet Regmi, Sajal
Pun, Chetan Phakami
contents Large Language Models (LLMs), such as GPT, have revolutionized artificial intelligence by enabling nuanced understanding and generation of human-like text across a wide range of applications. However, the high computational and financial costs associated with frequent API calls to these models present a substantial bottleneck, especially for applications like customer service chatbots that handle repetitive queries. In this paper, we introduce GPT Semantic Cache, a method that leverages semantic caching of query embeddings in in-memory storage (Redis). By storing embeddings of user queries, our approach efficiently identifies semantically similar questions, allowing for the retrieval of pre-generated responses without redundant API calls to the LLM. This technique achieves a notable reduction in operational costs while significantly enhancing response times, making it a robust solution for optimizing LLM-powered applications. Our experiments demonstrate that GPT Semantic Cache reduces API calls by up to 68.8% across various query categories, with cache hit rates ranging from 61.6% to 68.8%. Additionally, the system achieves high accuracy, with positive hit rates exceeding 97%, confirming the reliability of cached responses. This technique not only reduces operational costs, but also improves response times, enhancing the efficiency of LLM-powered applications.
format Preprint
id arxiv_https___arxiv_org_abs_2411_05276
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle GPT Semantic Cache: Reducing LLM Costs and Latency via Semantic Embedding Caching
Regmi, Sajal
Pun, Chetan Phakami
Machine Learning
Large Language Models (LLMs), such as GPT, have revolutionized artificial intelligence by enabling nuanced understanding and generation of human-like text across a wide range of applications. However, the high computational and financial costs associated with frequent API calls to these models present a substantial bottleneck, especially for applications like customer service chatbots that handle repetitive queries. In this paper, we introduce GPT Semantic Cache, a method that leverages semantic caching of query embeddings in in-memory storage (Redis). By storing embeddings of user queries, our approach efficiently identifies semantically similar questions, allowing for the retrieval of pre-generated responses without redundant API calls to the LLM. This technique achieves a notable reduction in operational costs while significantly enhancing response times, making it a robust solution for optimizing LLM-powered applications. Our experiments demonstrate that GPT Semantic Cache reduces API calls by up to 68.8% across various query categories, with cache hit rates ranging from 61.6% to 68.8%. Additionally, the system achieves high accuracy, with positive hit rates exceeding 97%, confirming the reliability of cached responses. This technique not only reduces operational costs, but also improves response times, enhancing the efficiency of LLM-powered applications.
title GPT Semantic Cache: Reducing LLM Costs and Latency via Semantic Embedding Caching
topic Machine Learning
url https://arxiv.org/abs/2411.05276