Memorizzazione nella cache adattiva di prompt semantici con VectorQ
Adaptive Semantic Prompt Caching with VectorQ
February 6, 2025
Autori: Luis Gaspar Schroeder, Shu Liu, Alejandro Cuadron, Mark Zhao, Stephan Krusche, Alfons Kemper, Matei Zaharia, Joseph E. Gonzalez
cs.AI
Abstract
Le cache delle prompt semantiche riducono la latenza e i costi dell'inferenza dei grandi modelli linguistici (LLM) riutilizzando le risposte generate dai LLM memorizzate per prompt semanticamente simili. Le metriche di similarità vettoriale assegnano un punteggio numerico per quantificare la similarità tra un prompt incorporato e il suo vicino più prossimo nella cache. I sistemi esistenti si basano su una soglia statica per classificare se il punteggio di similarità è sufficientemente alto da risultare in un colpo di cache. Mostriamo che questa soglia unica non è sufficiente tra prompt diversi. Proponiamo VectorQ, un framework per apprendere regioni di soglia specifiche per l'embedding che si adattano alla complessità e all'incertezza di un embedding. Attraverso valutazioni su una combinazione di quattro set di dati diversi, mostriamo che VectorQ supera costantemente i sistemi all'avanguardia su tutte le soglie statiche, raggiungendo aumenti fino a 12 volte nel tasso di colpi di cache e riduzioni del tasso di errore fino al 92%.
English
Semantic prompt caches reduce the latency and cost of large language model
(LLM) inference by reusing cached LLM-generated responses for semantically
similar prompts. Vector similarity metrics assign a numerical score to quantify
the similarity between an embedded prompt and its nearest neighbor in the
cache. Existing systems rely on a static threshold to classify whether the
similarity score is sufficiently high to result in a cache hit. We show that
this one-size-fits-all threshold is insufficient across different prompts. We
propose VectorQ, a framework to learn embedding-specific threshold regions that
adapt to the complexity and uncertainty of an embedding. Through evaluations on
a combination of four diverse datasets, we show that VectorQ consistently
outperforms state-of-the-art systems across all static thresholds, achieving up
to 12x increases in cache hit rate and error rate reductions up to 92%.Summary
AI-Generated Summary