AI
New Framework Makes LLM Response Caching Work in Continuous Query Space
Researchers propose the first theoretical approach to semantic caching that handles infinite, continuous spaces of user queries rather than assuming a finite set of known requests.
As Large Language Models proliferate across industry and research, the computational burden of running inference at scale has become a critical challenge. One proven cost-reduction strategy is caching—storing previously generated responses so that users with similar queries can retrieve cached results instead of triggering expensive new computations.
The Problem With Existing Approaches#
Most current caching systems rely on a simplifying assumption: that the universe of possible queries is finite and known in advance, making it possible to learn serving costs and request patterns ahead of time. This assumption works reasonably well for controlled, closed environments. However, real-world LLM applications face something fundamentally different: users pose queries that inhabit an infinite, continuous semantic space. Existing discrete models fail to capture this reality.
A Continuous Solution#
A new paper from arXiv establishes the first rigorous theoretical framework for semantic LLM caching that operates in this continuous setting. The approach bridges the gap between discrete optimization and continuous representation spaces through two key innovations:
- Dynamic ε-net discretization — a technique for strategically sampling the continuous space
- Kernel Ridge Regression — a statistical method that quantifies uncertainty in cost estimates and generalizes feedback about query costs to nearby semantic neighbors
This combination allows the system to make informed caching decisions even when faced with novel, unseen queries.
Algorithms and Performance#
The researchers developed both offline learning and online adaptive algorithms designed to minimize switching costs—the overhead incurred when updating which responses stay in the cache. Their online algorithm achieves what's called a "sublinear regret bound," a theoretical guarantee that performance approaches the optimal strategy over time, and degrades gracefully to existing discrete bounds when applied to finite query sets.
Empirical testing shows the framework approximates optimal caching behavior while reducing computational overhead relative to preceding methods.

